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 #[cfg(feature = "generate")]
1801 pub fn sql(&self) -> String {
1802 crate::generator::Generator::sql(self).unwrap_or_default()
1803 }
1804
1805 #[cfg(feature = "generate")]
1811 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1812 crate::generate(self, dialect).unwrap_or_default()
1813 }
1814}
1815
1816impl Expression {
1819 pub fn variant_name(&self) -> &'static str {
1822 match self {
1823 Expression::Literal(_) => "literal",
1824 Expression::Boolean(_) => "boolean",
1825 Expression::Null(_) => "null",
1826 Expression::Identifier(_) => "identifier",
1827 Expression::Column(_) => "column",
1828 Expression::Table(_) => "table",
1829 Expression::Star(_) => "star",
1830 Expression::BracedWildcard(_) => "braced_wildcard",
1831 Expression::Select(_) => "select",
1832 Expression::Union(_) => "union",
1833 Expression::Intersect(_) => "intersect",
1834 Expression::Except(_) => "except",
1835 Expression::Subquery(_) => "subquery",
1836 Expression::PipeOperator(_) => "pipe_operator",
1837 Expression::Pivot(_) => "pivot",
1838 Expression::PivotAlias(_) => "pivot_alias",
1839 Expression::Unpivot(_) => "unpivot",
1840 Expression::Values(_) => "values",
1841 Expression::PreWhere(_) => "pre_where",
1842 Expression::Stream(_) => "stream",
1843 Expression::UsingData(_) => "using_data",
1844 Expression::XmlNamespace(_) => "xml_namespace",
1845 Expression::Insert(_) => "insert",
1846 Expression::Update(_) => "update",
1847 Expression::Delete(_) => "delete",
1848 Expression::Copy(_) => "copy",
1849 Expression::Put(_) => "put",
1850 Expression::StageReference(_) => "stage_reference",
1851 Expression::Alias(_) => "alias",
1852 Expression::Cast(_) => "cast",
1853 Expression::Collation(_) => "collation",
1854 Expression::Case(_) => "case",
1855 Expression::And(_) => "and",
1856 Expression::Or(_) => "or",
1857 Expression::Add(_) => "add",
1858 Expression::Sub(_) => "sub",
1859 Expression::Mul(_) => "mul",
1860 Expression::Div(_) => "div",
1861 Expression::Mod(_) => "mod",
1862 Expression::Eq(_) => "eq",
1863 Expression::Neq(_) => "neq",
1864 Expression::Lt(_) => "lt",
1865 Expression::Lte(_) => "lte",
1866 Expression::Gt(_) => "gt",
1867 Expression::Gte(_) => "gte",
1868 Expression::Like(_) => "like",
1869 Expression::ILike(_) => "i_like",
1870 Expression::Match(_) => "match",
1871 Expression::BitwiseAnd(_) => "bitwise_and",
1872 Expression::BitwiseOr(_) => "bitwise_or",
1873 Expression::BitwiseXor(_) => "bitwise_xor",
1874 Expression::Concat(_) => "concat",
1875 Expression::Adjacent(_) => "adjacent",
1876 Expression::TsMatch(_) => "ts_match",
1877 Expression::PropertyEQ(_) => "property_e_q",
1878 Expression::ArrayContainsAll(_) => "array_contains_all",
1879 Expression::ArrayContainedBy(_) => "array_contained_by",
1880 Expression::ArrayOverlaps(_) => "array_overlaps",
1881 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1882 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1883 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1884 Expression::ExtendsLeft(_) => "extends_left",
1885 Expression::ExtendsRight(_) => "extends_right",
1886 Expression::Not(_) => "not",
1887 Expression::Neg(_) => "neg",
1888 Expression::BitwiseNot(_) => "bitwise_not",
1889 Expression::In(_) => "in",
1890 Expression::Between(_) => "between",
1891 Expression::IsNull(_) => "is_null",
1892 Expression::IsTrue(_) => "is_true",
1893 Expression::IsFalse(_) => "is_false",
1894 Expression::IsJson(_) => "is_json",
1895 Expression::Is(_) => "is",
1896 Expression::Exists(_) => "exists",
1897 Expression::MemberOf(_) => "member_of",
1898 Expression::Function(_) => "function",
1899 Expression::AggregateFunction(_) => "aggregate_function",
1900 Expression::WindowFunction(_) => "window_function",
1901 Expression::From(_) => "from",
1902 Expression::Join(_) => "join",
1903 Expression::JoinedTable(_) => "joined_table",
1904 Expression::Where(_) => "where",
1905 Expression::GroupBy(_) => "group_by",
1906 Expression::Having(_) => "having",
1907 Expression::OrderBy(_) => "order_by",
1908 Expression::Limit(_) => "limit",
1909 Expression::Offset(_) => "offset",
1910 Expression::Qualify(_) => "qualify",
1911 Expression::With(_) => "with",
1912 Expression::Cte(_) => "cte",
1913 Expression::DistributeBy(_) => "distribute_by",
1914 Expression::ClusterBy(_) => "cluster_by",
1915 Expression::SortBy(_) => "sort_by",
1916 Expression::LateralView(_) => "lateral_view",
1917 Expression::Hint(_) => "hint",
1918 Expression::Pseudocolumn(_) => "pseudocolumn",
1919 Expression::Connect(_) => "connect",
1920 Expression::Prior(_) => "prior",
1921 Expression::ConnectByRoot(_) => "connect_by_root",
1922 Expression::MatchRecognize(_) => "match_recognize",
1923 Expression::Ordered(_) => "ordered",
1924 Expression::Window(_) => "window",
1925 Expression::Over(_) => "over",
1926 Expression::WithinGroup(_) => "within_group",
1927 Expression::DataType(_) => "data_type",
1928 Expression::Array(_) => "array",
1929 Expression::Struct(_) => "struct",
1930 Expression::Tuple(_) => "tuple",
1931 Expression::Interval(_) => "interval",
1932 Expression::ConcatWs(_) => "concat_ws",
1933 Expression::Substring(_) => "substring",
1934 Expression::Upper(_) => "upper",
1935 Expression::Lower(_) => "lower",
1936 Expression::Length(_) => "length",
1937 Expression::Trim(_) => "trim",
1938 Expression::LTrim(_) => "l_trim",
1939 Expression::RTrim(_) => "r_trim",
1940 Expression::Replace(_) => "replace",
1941 Expression::Reverse(_) => "reverse",
1942 Expression::Left(_) => "left",
1943 Expression::Right(_) => "right",
1944 Expression::Repeat(_) => "repeat",
1945 Expression::Lpad(_) => "lpad",
1946 Expression::Rpad(_) => "rpad",
1947 Expression::Split(_) => "split",
1948 Expression::RegexpLike(_) => "regexp_like",
1949 Expression::RegexpReplace(_) => "regexp_replace",
1950 Expression::RegexpExtract(_) => "regexp_extract",
1951 Expression::Overlay(_) => "overlay",
1952 Expression::Abs(_) => "abs",
1953 Expression::Round(_) => "round",
1954 Expression::Floor(_) => "floor",
1955 Expression::Ceil(_) => "ceil",
1956 Expression::Power(_) => "power",
1957 Expression::Sqrt(_) => "sqrt",
1958 Expression::Cbrt(_) => "cbrt",
1959 Expression::Ln(_) => "ln",
1960 Expression::Log(_) => "log",
1961 Expression::Exp(_) => "exp",
1962 Expression::Sign(_) => "sign",
1963 Expression::Greatest(_) => "greatest",
1964 Expression::Least(_) => "least",
1965 Expression::CurrentDate(_) => "current_date",
1966 Expression::CurrentTime(_) => "current_time",
1967 Expression::CurrentTimestamp(_) => "current_timestamp",
1968 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1969 Expression::AtTimeZone(_) => "at_time_zone",
1970 Expression::DateAdd(_) => "date_add",
1971 Expression::DateSub(_) => "date_sub",
1972 Expression::DateDiff(_) => "date_diff",
1973 Expression::DateTrunc(_) => "date_trunc",
1974 Expression::Extract(_) => "extract",
1975 Expression::ToDate(_) => "to_date",
1976 Expression::ToTimestamp(_) => "to_timestamp",
1977 Expression::Date(_) => "date",
1978 Expression::Time(_) => "time",
1979 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1980 Expression::UnixDate(_) => "unix_date",
1981 Expression::UnixSeconds(_) => "unix_seconds",
1982 Expression::UnixMillis(_) => "unix_millis",
1983 Expression::UnixMicros(_) => "unix_micros",
1984 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1985 Expression::TimeStrToDate(_) => "time_str_to_date",
1986 Expression::DateToDi(_) => "date_to_di",
1987 Expression::DiToDate(_) => "di_to_date",
1988 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1989 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1990 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1991 Expression::YearOfWeek(_) => "year_of_week",
1992 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1993 Expression::Coalesce(_) => "coalesce",
1994 Expression::NullIf(_) => "null_if",
1995 Expression::IfFunc(_) => "if_func",
1996 Expression::IfNull(_) => "if_null",
1997 Expression::Nvl(_) => "nvl",
1998 Expression::Nvl2(_) => "nvl2",
1999 Expression::TryCast(_) => "try_cast",
2000 Expression::SafeCast(_) => "safe_cast",
2001 Expression::Count(_) => "count",
2002 Expression::Sum(_) => "sum",
2003 Expression::Avg(_) => "avg",
2004 Expression::Min(_) => "min",
2005 Expression::Max(_) => "max",
2006 Expression::GroupConcat(_) => "group_concat",
2007 Expression::StringAgg(_) => "string_agg",
2008 Expression::ListAgg(_) => "list_agg",
2009 Expression::ArrayAgg(_) => "array_agg",
2010 Expression::CountIf(_) => "count_if",
2011 Expression::SumIf(_) => "sum_if",
2012 Expression::Stddev(_) => "stddev",
2013 Expression::StddevPop(_) => "stddev_pop",
2014 Expression::StddevSamp(_) => "stddev_samp",
2015 Expression::Variance(_) => "variance",
2016 Expression::VarPop(_) => "var_pop",
2017 Expression::VarSamp(_) => "var_samp",
2018 Expression::Median(_) => "median",
2019 Expression::Mode(_) => "mode",
2020 Expression::First(_) => "first",
2021 Expression::Last(_) => "last",
2022 Expression::AnyValue(_) => "any_value",
2023 Expression::ApproxDistinct(_) => "approx_distinct",
2024 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2025 Expression::ApproxPercentile(_) => "approx_percentile",
2026 Expression::Percentile(_) => "percentile",
2027 Expression::LogicalAnd(_) => "logical_and",
2028 Expression::LogicalOr(_) => "logical_or",
2029 Expression::Skewness(_) => "skewness",
2030 Expression::BitwiseCount(_) => "bitwise_count",
2031 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2032 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2033 Expression::BoolXorAgg(_) => "bool_xor_agg",
2034 Expression::RowNumber(_) => "row_number",
2035 Expression::Rank(_) => "rank",
2036 Expression::DenseRank(_) => "dense_rank",
2037 Expression::NTile(_) => "n_tile",
2038 Expression::Lead(_) => "lead",
2039 Expression::Lag(_) => "lag",
2040 Expression::FirstValue(_) => "first_value",
2041 Expression::LastValue(_) => "last_value",
2042 Expression::NthValue(_) => "nth_value",
2043 Expression::PercentRank(_) => "percent_rank",
2044 Expression::CumeDist(_) => "cume_dist",
2045 Expression::PercentileCont(_) => "percentile_cont",
2046 Expression::PercentileDisc(_) => "percentile_disc",
2047 Expression::Contains(_) => "contains",
2048 Expression::StartsWith(_) => "starts_with",
2049 Expression::EndsWith(_) => "ends_with",
2050 Expression::Position(_) => "position",
2051 Expression::Initcap(_) => "initcap",
2052 Expression::Ascii(_) => "ascii",
2053 Expression::Chr(_) => "chr",
2054 Expression::CharFunc(_) => "char_func",
2055 Expression::Soundex(_) => "soundex",
2056 Expression::Levenshtein(_) => "levenshtein",
2057 Expression::ByteLength(_) => "byte_length",
2058 Expression::Hex(_) => "hex",
2059 Expression::LowerHex(_) => "lower_hex",
2060 Expression::Unicode(_) => "unicode",
2061 Expression::ModFunc(_) => "mod_func",
2062 Expression::Random(_) => "random",
2063 Expression::Rand(_) => "rand",
2064 Expression::TruncFunc(_) => "trunc_func",
2065 Expression::Pi(_) => "pi",
2066 Expression::Radians(_) => "radians",
2067 Expression::Degrees(_) => "degrees",
2068 Expression::Sin(_) => "sin",
2069 Expression::Cos(_) => "cos",
2070 Expression::Tan(_) => "tan",
2071 Expression::Asin(_) => "asin",
2072 Expression::Acos(_) => "acos",
2073 Expression::Atan(_) => "atan",
2074 Expression::Atan2(_) => "atan2",
2075 Expression::IsNan(_) => "is_nan",
2076 Expression::IsInf(_) => "is_inf",
2077 Expression::IntDiv(_) => "int_div",
2078 Expression::Decode(_) => "decode",
2079 Expression::DateFormat(_) => "date_format",
2080 Expression::FormatDate(_) => "format_date",
2081 Expression::Year(_) => "year",
2082 Expression::Month(_) => "month",
2083 Expression::Day(_) => "day",
2084 Expression::Hour(_) => "hour",
2085 Expression::Minute(_) => "minute",
2086 Expression::Second(_) => "second",
2087 Expression::DayOfWeek(_) => "day_of_week",
2088 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2089 Expression::DayOfMonth(_) => "day_of_month",
2090 Expression::DayOfYear(_) => "day_of_year",
2091 Expression::WeekOfYear(_) => "week_of_year",
2092 Expression::Quarter(_) => "quarter",
2093 Expression::AddMonths(_) => "add_months",
2094 Expression::MonthsBetween(_) => "months_between",
2095 Expression::LastDay(_) => "last_day",
2096 Expression::NextDay(_) => "next_day",
2097 Expression::Epoch(_) => "epoch",
2098 Expression::EpochMs(_) => "epoch_ms",
2099 Expression::FromUnixtime(_) => "from_unixtime",
2100 Expression::UnixTimestamp(_) => "unix_timestamp",
2101 Expression::MakeDate(_) => "make_date",
2102 Expression::MakeTimestamp(_) => "make_timestamp",
2103 Expression::TimestampTrunc(_) => "timestamp_trunc",
2104 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2105 Expression::SessionUser(_) => "session_user",
2106 Expression::SHA(_) => "s_h_a",
2107 Expression::SHA1Digest(_) => "s_h_a1_digest",
2108 Expression::TimeToUnix(_) => "time_to_unix",
2109 Expression::ArrayFunc(_) => "array_func",
2110 Expression::ArrayLength(_) => "array_length",
2111 Expression::ArraySize(_) => "array_size",
2112 Expression::Cardinality(_) => "cardinality",
2113 Expression::ArrayContains(_) => "array_contains",
2114 Expression::ArrayPosition(_) => "array_position",
2115 Expression::ArrayAppend(_) => "array_append",
2116 Expression::ArrayPrepend(_) => "array_prepend",
2117 Expression::ArrayConcat(_) => "array_concat",
2118 Expression::ArraySort(_) => "array_sort",
2119 Expression::ArrayReverse(_) => "array_reverse",
2120 Expression::ArrayDistinct(_) => "array_distinct",
2121 Expression::ArrayJoin(_) => "array_join",
2122 Expression::ArrayToString(_) => "array_to_string",
2123 Expression::Unnest(_) => "unnest",
2124 Expression::Explode(_) => "explode",
2125 Expression::ExplodeOuter(_) => "explode_outer",
2126 Expression::ArrayFilter(_) => "array_filter",
2127 Expression::ArrayTransform(_) => "array_transform",
2128 Expression::ArrayFlatten(_) => "array_flatten",
2129 Expression::ArrayCompact(_) => "array_compact",
2130 Expression::ArrayIntersect(_) => "array_intersect",
2131 Expression::ArrayUnion(_) => "array_union",
2132 Expression::ArrayExcept(_) => "array_except",
2133 Expression::ArrayRemove(_) => "array_remove",
2134 Expression::ArrayZip(_) => "array_zip",
2135 Expression::Sequence(_) => "sequence",
2136 Expression::Generate(_) => "generate",
2137 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2138 Expression::ToArray(_) => "to_array",
2139 Expression::StarMap(_) => "star_map",
2140 Expression::StructFunc(_) => "struct_func",
2141 Expression::StructExtract(_) => "struct_extract",
2142 Expression::NamedStruct(_) => "named_struct",
2143 Expression::MapFunc(_) => "map_func",
2144 Expression::MapFromEntries(_) => "map_from_entries",
2145 Expression::MapFromArrays(_) => "map_from_arrays",
2146 Expression::MapKeys(_) => "map_keys",
2147 Expression::MapValues(_) => "map_values",
2148 Expression::MapContainsKey(_) => "map_contains_key",
2149 Expression::MapConcat(_) => "map_concat",
2150 Expression::ElementAt(_) => "element_at",
2151 Expression::TransformKeys(_) => "transform_keys",
2152 Expression::TransformValues(_) => "transform_values",
2153 Expression::FunctionEmits(_) => "function_emits",
2154 Expression::JsonExtract(_) => "json_extract",
2155 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2156 Expression::JsonExtractPath(_) => "json_extract_path",
2157 Expression::JsonArray(_) => "json_array",
2158 Expression::JsonObject(_) => "json_object",
2159 Expression::JsonQuery(_) => "json_query",
2160 Expression::JsonValue(_) => "json_value",
2161 Expression::JsonArrayLength(_) => "json_array_length",
2162 Expression::JsonKeys(_) => "json_keys",
2163 Expression::JsonType(_) => "json_type",
2164 Expression::ParseJson(_) => "parse_json",
2165 Expression::ToJson(_) => "to_json",
2166 Expression::JsonSet(_) => "json_set",
2167 Expression::JsonInsert(_) => "json_insert",
2168 Expression::JsonRemove(_) => "json_remove",
2169 Expression::JsonMergePatch(_) => "json_merge_patch",
2170 Expression::JsonArrayAgg(_) => "json_array_agg",
2171 Expression::JsonObjectAgg(_) => "json_object_agg",
2172 Expression::Convert(_) => "convert",
2173 Expression::Typeof(_) => "typeof",
2174 Expression::Lambda(_) => "lambda",
2175 Expression::Parameter(_) => "parameter",
2176 Expression::Placeholder(_) => "placeholder",
2177 Expression::NamedArgument(_) => "named_argument",
2178 Expression::TableArgument(_) => "table_argument",
2179 Expression::SqlComment(_) => "sql_comment",
2180 Expression::NullSafeEq(_) => "null_safe_eq",
2181 Expression::NullSafeNeq(_) => "null_safe_neq",
2182 Expression::Glob(_) => "glob",
2183 Expression::SimilarTo(_) => "similar_to",
2184 Expression::Any(_) => "any",
2185 Expression::All(_) => "all",
2186 Expression::Overlaps(_) => "overlaps",
2187 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2188 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2189 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2190 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2191 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2192 Expression::Subscript(_) => "subscript",
2193 Expression::Dot(_) => "dot",
2194 Expression::MethodCall(_) => "method_call",
2195 Expression::ArraySlice(_) => "array_slice",
2196 Expression::CreateTable(_) => "create_table",
2197 Expression::DropTable(_) => "drop_table",
2198 Expression::Undrop(_) => "undrop",
2199 Expression::AlterTable(_) => "alter_table",
2200 Expression::CreateIndex(_) => "create_index",
2201 Expression::DropIndex(_) => "drop_index",
2202 Expression::CreateView(_) => "create_view",
2203 Expression::DropView(_) => "drop_view",
2204 Expression::AlterView(_) => "alter_view",
2205 Expression::AlterIndex(_) => "alter_index",
2206 Expression::Truncate(_) => "truncate",
2207 Expression::Use(_) => "use",
2208 Expression::Cache(_) => "cache",
2209 Expression::Uncache(_) => "uncache",
2210 Expression::LoadData(_) => "load_data",
2211 Expression::Pragma(_) => "pragma",
2212 Expression::Grant(_) => "grant",
2213 Expression::Revoke(_) => "revoke",
2214 Expression::Comment(_) => "comment",
2215 Expression::SetStatement(_) => "set_statement",
2216 Expression::CreateSchema(_) => "create_schema",
2217 Expression::DropSchema(_) => "drop_schema",
2218 Expression::DropNamespace(_) => "drop_namespace",
2219 Expression::CreateDatabase(_) => "create_database",
2220 Expression::DropDatabase(_) => "drop_database",
2221 Expression::CreateFunction(_) => "create_function",
2222 Expression::DropFunction(_) => "drop_function",
2223 Expression::CreateProcedure(_) => "create_procedure",
2224 Expression::DropProcedure(_) => "drop_procedure",
2225 Expression::CreateSequence(_) => "create_sequence",
2226 Expression::CreateSynonym(_) => "create_synonym",
2227 Expression::DropSequence(_) => "drop_sequence",
2228 Expression::AlterSequence(_) => "alter_sequence",
2229 Expression::CreateTrigger(_) => "create_trigger",
2230 Expression::DropTrigger(_) => "drop_trigger",
2231 Expression::CreateType(_) => "create_type",
2232 Expression::DropType(_) => "drop_type",
2233 Expression::Describe(_) => "describe",
2234 Expression::Show(_) => "show",
2235 Expression::Command(_) => "command",
2236 Expression::TryCatch(_) => "try_catch",
2237 Expression::Kill(_) => "kill",
2238 Expression::Execute(_) => "execute",
2239 Expression::Raw(_) => "raw",
2240 Expression::CreateTask(_) => "create_task",
2241 Expression::Paren(_) => "paren",
2242 Expression::Annotated(_) => "annotated",
2243 Expression::Refresh(_) => "refresh",
2244 Expression::LockingStatement(_) => "locking_statement",
2245 Expression::SequenceProperties(_) => "sequence_properties",
2246 Expression::TruncateTable(_) => "truncate_table",
2247 Expression::Clone(_) => "clone",
2248 Expression::Attach(_) => "attach",
2249 Expression::Detach(_) => "detach",
2250 Expression::Install(_) => "install",
2251 Expression::Summarize(_) => "summarize",
2252 Expression::Declare(_) => "declare",
2253 Expression::DeclareItem(_) => "declare_item",
2254 Expression::Set(_) => "set",
2255 Expression::Heredoc(_) => "heredoc",
2256 Expression::SetItem(_) => "set_item",
2257 Expression::QueryBand(_) => "query_band",
2258 Expression::UserDefinedFunction(_) => "user_defined_function",
2259 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2260 Expression::ProjectionDef(_) => "projection_def",
2261 Expression::TableAlias(_) => "table_alias",
2262 Expression::ByteString(_) => "byte_string",
2263 Expression::HexStringExpr(_) => "hex_string_expr",
2264 Expression::UnicodeString(_) => "unicode_string",
2265 Expression::ColumnPosition(_) => "column_position",
2266 Expression::ColumnDef(_) => "column_def",
2267 Expression::AlterColumn(_) => "alter_column",
2268 Expression::AlterSortKey(_) => "alter_sort_key",
2269 Expression::AlterSet(_) => "alter_set",
2270 Expression::RenameColumn(_) => "rename_column",
2271 Expression::Comprehension(_) => "comprehension",
2272 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2273 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2274 Expression::IndexConstraintOption(_) => "index_constraint_option",
2275 Expression::ColumnConstraint(_) => "column_constraint",
2276 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2277 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2278 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2279 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2280 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2281 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2282 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2283 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2284 Expression::WithOperator(_) => "with_operator",
2285 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2286 "generated_as_identity_column_constraint"
2287 }
2288 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2289 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2290 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2291 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2292 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2293 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2294 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2295 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2296 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2297 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2298 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2299 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2300 Expression::PathColumnConstraint(_) => "path_column_constraint",
2301 Expression::Constraint(_) => "constraint",
2302 Expression::Export(_) => "export",
2303 Expression::Filter(_) => "filter",
2304 Expression::Changes(_) => "changes",
2305 Expression::CopyParameter(_) => "copy_parameter",
2306 Expression::Credentials(_) => "credentials",
2307 Expression::Directory(_) => "directory",
2308 Expression::ForeignKey(_) => "foreign_key",
2309 Expression::ColumnPrefix(_) => "column_prefix",
2310 Expression::PrimaryKey(_) => "primary_key",
2311 Expression::IntoClause(_) => "into_clause",
2312 Expression::JoinHint(_) => "join_hint",
2313 Expression::Opclass(_) => "opclass",
2314 Expression::Index(_) => "index",
2315 Expression::IndexParameters(_) => "index_parameters",
2316 Expression::ConditionalInsert(_) => "conditional_insert",
2317 Expression::MultitableInserts(_) => "multitable_inserts",
2318 Expression::OnConflict(_) => "on_conflict",
2319 Expression::OnCondition(_) => "on_condition",
2320 Expression::Returning(_) => "returning",
2321 Expression::Introducer(_) => "introducer",
2322 Expression::PartitionRange(_) => "partition_range",
2323 Expression::Fetch(_) => "fetch",
2324 Expression::Group(_) => "group",
2325 Expression::Cube(_) => "cube",
2326 Expression::Rollup(_) => "rollup",
2327 Expression::GroupingSets(_) => "grouping_sets",
2328 Expression::LimitOptions(_) => "limit_options",
2329 Expression::Lateral(_) => "lateral",
2330 Expression::TableFromRows(_) => "table_from_rows",
2331 Expression::RowsFrom(_) => "rows_from",
2332 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2333 Expression::WithFill(_) => "with_fill",
2334 Expression::Property(_) => "property",
2335 Expression::GrantPrivilege(_) => "grant_privilege",
2336 Expression::GrantPrincipal(_) => "grant_principal",
2337 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2338 Expression::AlgorithmProperty(_) => "algorithm_property",
2339 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2340 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2341 Expression::BackupProperty(_) => "backup_property",
2342 Expression::BuildProperty(_) => "build_property",
2343 Expression::BlockCompressionProperty(_) => "block_compression_property",
2344 Expression::CharacterSetProperty(_) => "character_set_property",
2345 Expression::ChecksumProperty(_) => "checksum_property",
2346 Expression::CollateProperty(_) => "collate_property",
2347 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2348 Expression::DataDeletionProperty(_) => "data_deletion_property",
2349 Expression::DefinerProperty(_) => "definer_property",
2350 Expression::DistKeyProperty(_) => "dist_key_property",
2351 Expression::DistributedByProperty(_) => "distributed_by_property",
2352 Expression::DistStyleProperty(_) => "dist_style_property",
2353 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2354 Expression::EngineProperty(_) => "engine_property",
2355 Expression::ToTableProperty(_) => "to_table_property",
2356 Expression::ExecuteAsProperty(_) => "execute_as_property",
2357 Expression::ExternalProperty(_) => "external_property",
2358 Expression::FallbackProperty(_) => "fallback_property",
2359 Expression::FileFormatProperty(_) => "file_format_property",
2360 Expression::CredentialsProperty(_) => "credentials_property",
2361 Expression::FreespaceProperty(_) => "freespace_property",
2362 Expression::InheritsProperty(_) => "inherits_property",
2363 Expression::InputModelProperty(_) => "input_model_property",
2364 Expression::OutputModelProperty(_) => "output_model_property",
2365 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2366 Expression::JournalProperty(_) => "journal_property",
2367 Expression::LanguageProperty(_) => "language_property",
2368 Expression::EnviromentProperty(_) => "enviroment_property",
2369 Expression::ClusteredByProperty(_) => "clustered_by_property",
2370 Expression::DictProperty(_) => "dict_property",
2371 Expression::DictRange(_) => "dict_range",
2372 Expression::OnCluster(_) => "on_cluster",
2373 Expression::LikeProperty(_) => "like_property",
2374 Expression::LocationProperty(_) => "location_property",
2375 Expression::LockProperty(_) => "lock_property",
2376 Expression::LockingProperty(_) => "locking_property",
2377 Expression::LogProperty(_) => "log_property",
2378 Expression::MaterializedProperty(_) => "materialized_property",
2379 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2380 Expression::OnProperty(_) => "on_property",
2381 Expression::OnCommitProperty(_) => "on_commit_property",
2382 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2383 Expression::PartitionByProperty(_) => "partition_by_property",
2384 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2385 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2386 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2387 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2388 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2389 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2390 Expression::PartitionList(_) => "partition_list",
2391 Expression::Partition(_) => "partition",
2392 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2393 Expression::UniqueKeyProperty(_) => "unique_key_property",
2394 Expression::RollupProperty(_) => "rollup_property",
2395 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2396 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2397 Expression::RemoteWithConnectionModelProperty(_) => {
2398 "remote_with_connection_model_property"
2399 }
2400 Expression::ReturnsProperty(_) => "returns_property",
2401 Expression::RowFormatProperty(_) => "row_format_property",
2402 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2403 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2404 Expression::QueryTransform(_) => "query_transform",
2405 Expression::SampleProperty(_) => "sample_property",
2406 Expression::SecurityProperty(_) => "security_property",
2407 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2408 Expression::SemanticView(_) => "semantic_view",
2409 Expression::SerdeProperties(_) => "serde_properties",
2410 Expression::SetProperty(_) => "set_property",
2411 Expression::SharingProperty(_) => "sharing_property",
2412 Expression::SetConfigProperty(_) => "set_config_property",
2413 Expression::SettingsProperty(_) => "settings_property",
2414 Expression::SortKeyProperty(_) => "sort_key_property",
2415 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2416 Expression::SqlSecurityProperty(_) => "sql_security_property",
2417 Expression::StabilityProperty(_) => "stability_property",
2418 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2419 Expression::TemporaryProperty(_) => "temporary_property",
2420 Expression::Tags(_) => "tags",
2421 Expression::TransformModelProperty(_) => "transform_model_property",
2422 Expression::TransientProperty(_) => "transient_property",
2423 Expression::UsingTemplateProperty(_) => "using_template_property",
2424 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2425 Expression::VolatileProperty(_) => "volatile_property",
2426 Expression::WithDataProperty(_) => "with_data_property",
2427 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2428 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2429 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2430 Expression::WithProcedureOptions(_) => "with_procedure_options",
2431 Expression::EncodeProperty(_) => "encode_property",
2432 Expression::IncludeProperty(_) => "include_property",
2433 Expression::Properties(_) => "properties",
2434 Expression::OptionsProperty(_) => "options_property",
2435 Expression::InputOutputFormat(_) => "input_output_format",
2436 Expression::Reference(_) => "reference",
2437 Expression::QueryOption(_) => "query_option",
2438 Expression::WithTableHint(_) => "with_table_hint",
2439 Expression::IndexTableHint(_) => "index_table_hint",
2440 Expression::HistoricalData(_) => "historical_data",
2441 Expression::Get(_) => "get",
2442 Expression::SetOperation(_) => "set_operation",
2443 Expression::Var(_) => "var",
2444 Expression::Variadic(_) => "variadic",
2445 Expression::Version(_) => "version",
2446 Expression::Schema(_) => "schema",
2447 Expression::Lock(_) => "lock",
2448 Expression::TableSample(_) => "table_sample",
2449 Expression::Tag(_) => "tag",
2450 Expression::UnpivotColumns(_) => "unpivot_columns",
2451 Expression::WindowSpec(_) => "window_spec",
2452 Expression::SessionParameter(_) => "session_parameter",
2453 Expression::PseudoType(_) => "pseudo_type",
2454 Expression::ObjectIdentifier(_) => "object_identifier",
2455 Expression::Transaction(_) => "transaction",
2456 Expression::Commit(_) => "commit",
2457 Expression::Rollback(_) => "rollback",
2458 Expression::AlterSession(_) => "alter_session",
2459 Expression::Analyze(_) => "analyze",
2460 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2461 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2462 Expression::AnalyzeSample(_) => "analyze_sample",
2463 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2464 Expression::AnalyzeDelete(_) => "analyze_delete",
2465 Expression::AnalyzeWith(_) => "analyze_with",
2466 Expression::AnalyzeValidate(_) => "analyze_validate",
2467 Expression::AddPartition(_) => "add_partition",
2468 Expression::AttachOption(_) => "attach_option",
2469 Expression::DropPartition(_) => "drop_partition",
2470 Expression::ReplacePartition(_) => "replace_partition",
2471 Expression::DPipe(_) => "d_pipe",
2472 Expression::Operator(_) => "operator",
2473 Expression::PivotAny(_) => "pivot_any",
2474 Expression::Aliases(_) => "aliases",
2475 Expression::AtIndex(_) => "at_index",
2476 Expression::FromTimeZone(_) => "from_time_zone",
2477 Expression::FormatPhrase(_) => "format_phrase",
2478 Expression::ForIn(_) => "for_in",
2479 Expression::TimeUnit(_) => "time_unit",
2480 Expression::IntervalOp(_) => "interval_op",
2481 Expression::IntervalSpan(_) => "interval_span",
2482 Expression::HavingMax(_) => "having_max",
2483 Expression::CosineDistance(_) => "cosine_distance",
2484 Expression::DotProduct(_) => "dot_product",
2485 Expression::EuclideanDistance(_) => "euclidean_distance",
2486 Expression::ManhattanDistance(_) => "manhattan_distance",
2487 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2488 Expression::Booland(_) => "booland",
2489 Expression::Boolor(_) => "boolor",
2490 Expression::ParameterizedAgg(_) => "parameterized_agg",
2491 Expression::ArgMax(_) => "arg_max",
2492 Expression::ArgMin(_) => "arg_min",
2493 Expression::ApproxTopK(_) => "approx_top_k",
2494 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2495 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2496 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2497 Expression::ApproxTopSum(_) => "approx_top_sum",
2498 Expression::ApproxQuantiles(_) => "approx_quantiles",
2499 Expression::Minhash(_) => "minhash",
2500 Expression::FarmFingerprint(_) => "farm_fingerprint",
2501 Expression::Float64(_) => "float64",
2502 Expression::Transform(_) => "transform",
2503 Expression::Translate(_) => "translate",
2504 Expression::Grouping(_) => "grouping",
2505 Expression::GroupingId(_) => "grouping_id",
2506 Expression::Anonymous(_) => "anonymous",
2507 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2508 Expression::CombinedAggFunc(_) => "combined_agg_func",
2509 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2510 Expression::HashAgg(_) => "hash_agg",
2511 Expression::Hll(_) => "hll",
2512 Expression::Apply(_) => "apply",
2513 Expression::ToBoolean(_) => "to_boolean",
2514 Expression::List(_) => "list",
2515 Expression::ToMap(_) => "to_map",
2516 Expression::Pad(_) => "pad",
2517 Expression::ToChar(_) => "to_char",
2518 Expression::ToNumber(_) => "to_number",
2519 Expression::ToDouble(_) => "to_double",
2520 Expression::Int64(_) => "int64",
2521 Expression::StringFunc(_) => "string_func",
2522 Expression::ToDecfloat(_) => "to_decfloat",
2523 Expression::TryToDecfloat(_) => "try_to_decfloat",
2524 Expression::ToFile(_) => "to_file",
2525 Expression::Columns(_) => "columns",
2526 Expression::ConvertToCharset(_) => "convert_to_charset",
2527 Expression::ConvertTimezone(_) => "convert_timezone",
2528 Expression::GenerateSeries(_) => "generate_series",
2529 Expression::AIAgg(_) => "a_i_agg",
2530 Expression::AIClassify(_) => "a_i_classify",
2531 Expression::ArrayAll(_) => "array_all",
2532 Expression::ArrayAny(_) => "array_any",
2533 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2534 Expression::StPoint(_) => "st_point",
2535 Expression::StDistance(_) => "st_distance",
2536 Expression::StringToArray(_) => "string_to_array",
2537 Expression::ArraySum(_) => "array_sum",
2538 Expression::ObjectAgg(_) => "object_agg",
2539 Expression::CastToStrType(_) => "cast_to_str_type",
2540 Expression::CheckJson(_) => "check_json",
2541 Expression::CheckXml(_) => "check_xml",
2542 Expression::TranslateCharacters(_) => "translate_characters",
2543 Expression::CurrentSchemas(_) => "current_schemas",
2544 Expression::CurrentDatetime(_) => "current_datetime",
2545 Expression::Localtime(_) => "localtime",
2546 Expression::Localtimestamp(_) => "localtimestamp",
2547 Expression::Systimestamp(_) => "systimestamp",
2548 Expression::CurrentSchema(_) => "current_schema",
2549 Expression::CurrentUser(_) => "current_user",
2550 Expression::UtcTime(_) => "utc_time",
2551 Expression::UtcTimestamp(_) => "utc_timestamp",
2552 Expression::Timestamp(_) => "timestamp",
2553 Expression::DateBin(_) => "date_bin",
2554 Expression::Datetime(_) => "datetime",
2555 Expression::DatetimeAdd(_) => "datetime_add",
2556 Expression::DatetimeSub(_) => "datetime_sub",
2557 Expression::DatetimeDiff(_) => "datetime_diff",
2558 Expression::DatetimeTrunc(_) => "datetime_trunc",
2559 Expression::Dayname(_) => "dayname",
2560 Expression::MakeInterval(_) => "make_interval",
2561 Expression::PreviousDay(_) => "previous_day",
2562 Expression::Elt(_) => "elt",
2563 Expression::TimestampAdd(_) => "timestamp_add",
2564 Expression::TimestampSub(_) => "timestamp_sub",
2565 Expression::TimestampDiff(_) => "timestamp_diff",
2566 Expression::TimeSlice(_) => "time_slice",
2567 Expression::TimeAdd(_) => "time_add",
2568 Expression::TimeSub(_) => "time_sub",
2569 Expression::TimeDiff(_) => "time_diff",
2570 Expression::TimeTrunc(_) => "time_trunc",
2571 Expression::DateFromParts(_) => "date_from_parts",
2572 Expression::TimeFromParts(_) => "time_from_parts",
2573 Expression::DecodeCase(_) => "decode_case",
2574 Expression::Decrypt(_) => "decrypt",
2575 Expression::DecryptRaw(_) => "decrypt_raw",
2576 Expression::Encode(_) => "encode",
2577 Expression::Encrypt(_) => "encrypt",
2578 Expression::EncryptRaw(_) => "encrypt_raw",
2579 Expression::EqualNull(_) => "equal_null",
2580 Expression::ToBinary(_) => "to_binary",
2581 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2582 Expression::Base64DecodeString(_) => "base64_decode_string",
2583 Expression::Base64Encode(_) => "base64_encode",
2584 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2585 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2586 Expression::GapFill(_) => "gap_fill",
2587 Expression::GenerateDateArray(_) => "generate_date_array",
2588 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2589 Expression::GetExtract(_) => "get_extract",
2590 Expression::Getbit(_) => "getbit",
2591 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2592 Expression::HexEncode(_) => "hex_encode",
2593 Expression::Compress(_) => "compress",
2594 Expression::DecompressBinary(_) => "decompress_binary",
2595 Expression::DecompressString(_) => "decompress_string",
2596 Expression::Xor(_) => "xor",
2597 Expression::Nullif(_) => "nullif",
2598 Expression::JSON(_) => "j_s_o_n",
2599 Expression::JSONPath(_) => "j_s_o_n_path",
2600 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2601 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2602 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2603 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2604 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2605 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2606 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2607 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2608 Expression::Format(_) => "format",
2609 Expression::JSONKeys(_) => "j_s_o_n_keys",
2610 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2611 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2612 Expression::JSONObject(_) => "j_s_o_n_object",
2613 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2614 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2615 Expression::JSONArray(_) => "j_s_o_n_array",
2616 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2617 Expression::JSONExists(_) => "j_s_o_n_exists",
2618 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2619 Expression::JSONSchema(_) => "j_s_o_n_schema",
2620 Expression::JSONSet(_) => "j_s_o_n_set",
2621 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2622 Expression::JSONValue(_) => "j_s_o_n_value",
2623 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2624 Expression::JSONRemove(_) => "j_s_o_n_remove",
2625 Expression::JSONTable(_) => "j_s_o_n_table",
2626 Expression::JSONType(_) => "j_s_o_n_type",
2627 Expression::ObjectInsert(_) => "object_insert",
2628 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2629 Expression::OpenJSON(_) => "open_j_s_o_n",
2630 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2631 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2632 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2633 Expression::JSONCast(_) => "j_s_o_n_cast",
2634 Expression::JSONExtract(_) => "j_s_o_n_extract",
2635 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2636 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2637 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2638 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2639 Expression::JSONFormat(_) => "j_s_o_n_format",
2640 Expression::JSONBool(_) => "j_s_o_n_bool",
2641 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2642 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2643 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2644 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2645 Expression::ParseJSON(_) => "parse_j_s_o_n",
2646 Expression::ParseUrl(_) => "parse_url",
2647 Expression::ParseIp(_) => "parse_ip",
2648 Expression::ParseTime(_) => "parse_time",
2649 Expression::ParseDatetime(_) => "parse_datetime",
2650 Expression::Map(_) => "map",
2651 Expression::MapCat(_) => "map_cat",
2652 Expression::MapDelete(_) => "map_delete",
2653 Expression::MapInsert(_) => "map_insert",
2654 Expression::MapPick(_) => "map_pick",
2655 Expression::ScopeResolution(_) => "scope_resolution",
2656 Expression::Slice(_) => "slice",
2657 Expression::VarMap(_) => "var_map",
2658 Expression::MatchAgainst(_) => "match_against",
2659 Expression::MD5Digest(_) => "m_d5_digest",
2660 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2661 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2662 Expression::Monthname(_) => "monthname",
2663 Expression::Ntile(_) => "ntile",
2664 Expression::Normalize(_) => "normalize",
2665 Expression::Normal(_) => "normal",
2666 Expression::Predict(_) => "predict",
2667 Expression::MLTranslate(_) => "m_l_translate",
2668 Expression::FeaturesAtTime(_) => "features_at_time",
2669 Expression::GenerateEmbedding(_) => "generate_embedding",
2670 Expression::MLForecast(_) => "m_l_forecast",
2671 Expression::ModelAttribute(_) => "model_attribute",
2672 Expression::VectorSearch(_) => "vector_search",
2673 Expression::Quantile(_) => "quantile",
2674 Expression::ApproxQuantile(_) => "approx_quantile",
2675 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2676 Expression::Randn(_) => "randn",
2677 Expression::Randstr(_) => "randstr",
2678 Expression::RangeN(_) => "range_n",
2679 Expression::RangeBucket(_) => "range_bucket",
2680 Expression::ReadCSV(_) => "read_c_s_v",
2681 Expression::ReadParquet(_) => "read_parquet",
2682 Expression::Reduce(_) => "reduce",
2683 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2684 Expression::RegexpILike(_) => "regexp_i_like",
2685 Expression::RegexpFullMatch(_) => "regexp_full_match",
2686 Expression::RegexpInstr(_) => "regexp_instr",
2687 Expression::RegexpSplit(_) => "regexp_split",
2688 Expression::RegexpCount(_) => "regexp_count",
2689 Expression::RegrValx(_) => "regr_valx",
2690 Expression::RegrValy(_) => "regr_valy",
2691 Expression::RegrAvgy(_) => "regr_avgy",
2692 Expression::RegrAvgx(_) => "regr_avgx",
2693 Expression::RegrCount(_) => "regr_count",
2694 Expression::RegrIntercept(_) => "regr_intercept",
2695 Expression::RegrR2(_) => "regr_r2",
2696 Expression::RegrSxx(_) => "regr_sxx",
2697 Expression::RegrSxy(_) => "regr_sxy",
2698 Expression::RegrSyy(_) => "regr_syy",
2699 Expression::RegrSlope(_) => "regr_slope",
2700 Expression::SafeAdd(_) => "safe_add",
2701 Expression::SafeDivide(_) => "safe_divide",
2702 Expression::SafeMultiply(_) => "safe_multiply",
2703 Expression::SafeSubtract(_) => "safe_subtract",
2704 Expression::SHA2(_) => "s_h_a2",
2705 Expression::SHA2Digest(_) => "s_h_a2_digest",
2706 Expression::SortArray(_) => "sort_array",
2707 Expression::SplitPart(_) => "split_part",
2708 Expression::SubstringIndex(_) => "substring_index",
2709 Expression::StandardHash(_) => "standard_hash",
2710 Expression::StrPosition(_) => "str_position",
2711 Expression::Search(_) => "search",
2712 Expression::SearchIp(_) => "search_ip",
2713 Expression::StrToDate(_) => "str_to_date",
2714 Expression::DateStrToDate(_) => "date_str_to_date",
2715 Expression::DateToDateStr(_) => "date_to_date_str",
2716 Expression::StrToTime(_) => "str_to_time",
2717 Expression::StrToUnix(_) => "str_to_unix",
2718 Expression::StrToMap(_) => "str_to_map",
2719 Expression::NumberToStr(_) => "number_to_str",
2720 Expression::FromBase(_) => "from_base",
2721 Expression::Stuff(_) => "stuff",
2722 Expression::TimeToStr(_) => "time_to_str",
2723 Expression::TimeStrToTime(_) => "time_str_to_time",
2724 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2725 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2726 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2727 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2728 Expression::Unhex(_) => "unhex",
2729 Expression::Uniform(_) => "uniform",
2730 Expression::UnixToStr(_) => "unix_to_str",
2731 Expression::UnixToTime(_) => "unix_to_time",
2732 Expression::Uuid(_) => "uuid",
2733 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2734 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2735 Expression::Corr(_) => "corr",
2736 Expression::WidthBucket(_) => "width_bucket",
2737 Expression::CovarSamp(_) => "covar_samp",
2738 Expression::CovarPop(_) => "covar_pop",
2739 Expression::Week(_) => "week",
2740 Expression::XMLElement(_) => "x_m_l_element",
2741 Expression::XMLGet(_) => "x_m_l_get",
2742 Expression::XMLTable(_) => "x_m_l_table",
2743 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2744 Expression::Zipf(_) => "zipf",
2745 Expression::Merge(_) => "merge",
2746 Expression::When(_) => "when",
2747 Expression::Whens(_) => "whens",
2748 Expression::NextValueFor(_) => "next_value_for",
2749 Expression::ReturnStmt(_) => "return_stmt",
2750 }
2751 }
2752
2753 pub fn get_this(&self) -> Option<&Expression> {
2755 match self {
2756 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2758 Expression::Upper(f)
2760 | Expression::Lower(f)
2761 | Expression::Length(f)
2762 | Expression::LTrim(f)
2763 | Expression::RTrim(f)
2764 | Expression::Reverse(f)
2765 | Expression::Abs(f)
2766 | Expression::Sqrt(f)
2767 | Expression::Cbrt(f)
2768 | Expression::Ln(f)
2769 | Expression::Exp(f)
2770 | Expression::Sign(f)
2771 | Expression::Date(f)
2772 | Expression::Time(f)
2773 | Expression::Initcap(f)
2774 | Expression::Ascii(f)
2775 | Expression::Chr(f)
2776 | Expression::Soundex(f)
2777 | Expression::ByteLength(f)
2778 | Expression::Hex(f)
2779 | Expression::LowerHex(f)
2780 | Expression::Unicode(f)
2781 | Expression::Typeof(f)
2782 | Expression::Explode(f)
2783 | Expression::ExplodeOuter(f)
2784 | Expression::MapFromEntries(f)
2785 | Expression::MapKeys(f)
2786 | Expression::MapValues(f)
2787 | Expression::ArrayLength(f)
2788 | Expression::ArraySize(f)
2789 | Expression::Cardinality(f)
2790 | Expression::ArrayReverse(f)
2791 | Expression::ArrayDistinct(f)
2792 | Expression::ArrayFlatten(f)
2793 | Expression::ArrayCompact(f)
2794 | Expression::ToArray(f)
2795 | Expression::JsonArrayLength(f)
2796 | Expression::JsonKeys(f)
2797 | Expression::JsonType(f)
2798 | Expression::ParseJson(f)
2799 | Expression::ToJson(f)
2800 | Expression::Radians(f)
2801 | Expression::Degrees(f)
2802 | Expression::Sin(f)
2803 | Expression::Cos(f)
2804 | Expression::Tan(f)
2805 | Expression::Asin(f)
2806 | Expression::Acos(f)
2807 | Expression::Atan(f)
2808 | Expression::IsNan(f)
2809 | Expression::IsInf(f)
2810 | Expression::Year(f)
2811 | Expression::Month(f)
2812 | Expression::Day(f)
2813 | Expression::Hour(f)
2814 | Expression::Minute(f)
2815 | Expression::Second(f)
2816 | Expression::DayOfWeek(f)
2817 | Expression::DayOfWeekIso(f)
2818 | Expression::DayOfMonth(f)
2819 | Expression::DayOfYear(f)
2820 | Expression::WeekOfYear(f)
2821 | Expression::Quarter(f)
2822 | Expression::Epoch(f)
2823 | Expression::EpochMs(f)
2824 | Expression::BitwiseCount(f)
2825 | Expression::DateFromUnixDate(f)
2826 | Expression::UnixDate(f)
2827 | Expression::UnixSeconds(f)
2828 | Expression::UnixMillis(f)
2829 | Expression::UnixMicros(f)
2830 | Expression::TimeStrToDate(f)
2831 | Expression::DateToDi(f)
2832 | Expression::DiToDate(f)
2833 | Expression::TsOrDiToDi(f)
2834 | Expression::TsOrDsToDatetime(f)
2835 | Expression::TsOrDsToTimestamp(f)
2836 | Expression::YearOfWeek(f)
2837 | Expression::YearOfWeekIso(f)
2838 | Expression::SHA(f)
2839 | Expression::SHA1Digest(f)
2840 | Expression::TimeToUnix(f)
2841 | Expression::TimeStrToUnix(f)
2842 | Expression::Int64(f)
2843 | Expression::JSONBool(f)
2844 | Expression::MD5NumberLower64(f)
2845 | Expression::MD5NumberUpper64(f)
2846 | Expression::DateStrToDate(f)
2847 | Expression::DateToDateStr(f) => Some(&f.this),
2848 Expression::Power(f)
2850 | Expression::NullIf(f)
2851 | Expression::IfNull(f)
2852 | Expression::Nvl(f)
2853 | Expression::Contains(f)
2854 | Expression::StartsWith(f)
2855 | Expression::EndsWith(f)
2856 | Expression::Levenshtein(f)
2857 | Expression::ModFunc(f)
2858 | Expression::IntDiv(f)
2859 | Expression::Atan2(f)
2860 | Expression::AddMonths(f)
2861 | Expression::MonthsBetween(f)
2862 | Expression::NextDay(f)
2863 | Expression::UnixToTimeStr(f)
2864 | Expression::ArrayContains(f)
2865 | Expression::ArrayPosition(f)
2866 | Expression::ArrayAppend(f)
2867 | Expression::ArrayPrepend(f)
2868 | Expression::ArrayUnion(f)
2869 | Expression::ArrayExcept(f)
2870 | Expression::ArrayRemove(f)
2871 | Expression::StarMap(f)
2872 | Expression::MapFromArrays(f)
2873 | Expression::MapContainsKey(f)
2874 | Expression::ElementAt(f)
2875 | Expression::JsonMergePatch(f)
2876 | Expression::JSONBContains(f)
2877 | Expression::JSONBExtract(f) => Some(&f.this),
2878 Expression::Sum(af)
2880 | Expression::Avg(af)
2881 | Expression::Min(af)
2882 | Expression::Max(af)
2883 | Expression::ArrayAgg(af)
2884 | Expression::CountIf(af)
2885 | Expression::Stddev(af)
2886 | Expression::StddevPop(af)
2887 | Expression::StddevSamp(af)
2888 | Expression::Variance(af)
2889 | Expression::VarPop(af)
2890 | Expression::VarSamp(af)
2891 | Expression::Median(af)
2892 | Expression::Mode(af)
2893 | Expression::First(af)
2894 | Expression::Last(af)
2895 | Expression::AnyValue(af)
2896 | Expression::ApproxDistinct(af)
2897 | Expression::ApproxCountDistinct(af)
2898 | Expression::LogicalAnd(af)
2899 | Expression::LogicalOr(af)
2900 | Expression::Skewness(af)
2901 | Expression::ArrayConcatAgg(af)
2902 | Expression::ArrayUniqueAgg(af)
2903 | Expression::BoolXorAgg(af)
2904 | Expression::BitwiseAndAgg(af)
2905 | Expression::BitwiseOrAgg(af)
2906 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2907 Expression::And(op)
2909 | Expression::Or(op)
2910 | Expression::Add(op)
2911 | Expression::Sub(op)
2912 | Expression::Mul(op)
2913 | Expression::Div(op)
2914 | Expression::Mod(op)
2915 | Expression::Eq(op)
2916 | Expression::Neq(op)
2917 | Expression::Lt(op)
2918 | Expression::Lte(op)
2919 | Expression::Gt(op)
2920 | Expression::Gte(op)
2921 | Expression::BitwiseAnd(op)
2922 | Expression::BitwiseOr(op)
2923 | Expression::BitwiseXor(op)
2924 | Expression::Concat(op)
2925 | Expression::Adjacent(op)
2926 | Expression::TsMatch(op)
2927 | Expression::PropertyEQ(op)
2928 | Expression::ArrayContainsAll(op)
2929 | Expression::ArrayContainedBy(op)
2930 | Expression::ArrayOverlaps(op)
2931 | Expression::JSONBContainsAllTopKeys(op)
2932 | Expression::JSONBContainsAnyTopKeys(op)
2933 | Expression::JSONBDeleteAtPath(op)
2934 | Expression::ExtendsLeft(op)
2935 | Expression::ExtendsRight(op)
2936 | Expression::Is(op)
2937 | Expression::MemberOf(op)
2938 | Expression::Match(op)
2939 | Expression::NullSafeEq(op)
2940 | Expression::NullSafeNeq(op)
2941 | Expression::Glob(op)
2942 | Expression::BitwiseLeftShift(op)
2943 | Expression::BitwiseRightShift(op) => Some(&op.left),
2944 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2946 Expression::Alias(a) => Some(&a.this),
2948 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2949 Expression::Paren(p) => Some(&p.this),
2950 Expression::Annotated(a) => Some(&a.this),
2951 Expression::Subquery(s) => Some(&s.this),
2952 Expression::Where(w) => Some(&w.this),
2953 Expression::Having(h) => Some(&h.this),
2954 Expression::Qualify(q) => Some(&q.this),
2955 Expression::IsNull(i) => Some(&i.this),
2956 Expression::Exists(e) => Some(&e.this),
2957 Expression::Ordered(o) => Some(&o.this),
2958 Expression::WindowFunction(wf) => Some(&wf.this),
2959 Expression::Cte(cte) => Some(&cte.this),
2960 Expression::Between(b) => Some(&b.this),
2961 Expression::In(i) => Some(&i.this),
2962 Expression::ReturnStmt(e) => Some(e),
2963 _ => None,
2964 }
2965 }
2966
2967 pub fn get_expression(&self) -> Option<&Expression> {
2969 match self {
2970 Expression::And(op)
2972 | Expression::Or(op)
2973 | Expression::Add(op)
2974 | Expression::Sub(op)
2975 | Expression::Mul(op)
2976 | Expression::Div(op)
2977 | Expression::Mod(op)
2978 | Expression::Eq(op)
2979 | Expression::Neq(op)
2980 | Expression::Lt(op)
2981 | Expression::Lte(op)
2982 | Expression::Gt(op)
2983 | Expression::Gte(op)
2984 | Expression::BitwiseAnd(op)
2985 | Expression::BitwiseOr(op)
2986 | Expression::BitwiseXor(op)
2987 | Expression::Concat(op)
2988 | Expression::Adjacent(op)
2989 | Expression::TsMatch(op)
2990 | Expression::PropertyEQ(op)
2991 | Expression::ArrayContainsAll(op)
2992 | Expression::ArrayContainedBy(op)
2993 | Expression::ArrayOverlaps(op)
2994 | Expression::JSONBContainsAllTopKeys(op)
2995 | Expression::JSONBContainsAnyTopKeys(op)
2996 | Expression::JSONBDeleteAtPath(op)
2997 | Expression::ExtendsLeft(op)
2998 | Expression::ExtendsRight(op)
2999 | Expression::Is(op)
3000 | Expression::MemberOf(op)
3001 | Expression::Match(op)
3002 | Expression::NullSafeEq(op)
3003 | Expression::NullSafeNeq(op)
3004 | Expression::Glob(op)
3005 | Expression::BitwiseLeftShift(op)
3006 | Expression::BitwiseRightShift(op) => Some(&op.right),
3007 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3009 Expression::Power(f)
3011 | Expression::NullIf(f)
3012 | Expression::IfNull(f)
3013 | Expression::Nvl(f)
3014 | Expression::Contains(f)
3015 | Expression::StartsWith(f)
3016 | Expression::EndsWith(f)
3017 | Expression::Levenshtein(f)
3018 | Expression::ModFunc(f)
3019 | Expression::IntDiv(f)
3020 | Expression::Atan2(f)
3021 | Expression::AddMonths(f)
3022 | Expression::MonthsBetween(f)
3023 | Expression::NextDay(f)
3024 | Expression::UnixToTimeStr(f)
3025 | Expression::ArrayContains(f)
3026 | Expression::ArrayPosition(f)
3027 | Expression::ArrayAppend(f)
3028 | Expression::ArrayPrepend(f)
3029 | Expression::ArrayUnion(f)
3030 | Expression::ArrayExcept(f)
3031 | Expression::ArrayRemove(f)
3032 | Expression::StarMap(f)
3033 | Expression::MapFromArrays(f)
3034 | Expression::MapContainsKey(f)
3035 | Expression::ElementAt(f)
3036 | Expression::JsonMergePatch(f)
3037 | Expression::JSONBContains(f)
3038 | Expression::JSONBExtract(f) => Some(&f.expression),
3039 _ => None,
3040 }
3041 }
3042
3043 pub fn get_expressions(&self) -> &[Expression] {
3045 match self {
3046 Expression::Select(s) => &s.expressions,
3047 Expression::Function(f) => &f.args,
3048 Expression::AggregateFunction(f) => &f.args,
3049 Expression::From(f) => &f.expressions,
3050 Expression::GroupBy(g) => &g.expressions,
3051 Expression::In(i) => &i.expressions,
3052 Expression::Array(a) => &a.expressions,
3053 Expression::Tuple(t) => &t.expressions,
3054 Expression::Coalesce(f)
3055 | Expression::Greatest(f)
3056 | Expression::Least(f)
3057 | Expression::ArrayConcat(f)
3058 | Expression::ArrayIntersect(f)
3059 | Expression::ArrayZip(f)
3060 | Expression::MapConcat(f)
3061 | Expression::JsonArray(f) => &f.expressions,
3062 _ => &[],
3063 }
3064 }
3065
3066 pub fn get_name(&self) -> &str {
3068 match self {
3069 Expression::Identifier(id) => &id.name,
3070 Expression::Column(col) => &col.name.name,
3071 Expression::Table(t) => &t.name.name,
3072 Expression::Literal(lit) => lit.value_str(),
3073 Expression::Star(_) => "*",
3074 Expression::Function(f) => &f.name,
3075 Expression::AggregateFunction(f) => &f.name,
3076 Expression::Alias(a) => a.this.get_name(),
3077 Expression::Boolean(b) => {
3078 if b.value {
3079 "TRUE"
3080 } else {
3081 "FALSE"
3082 }
3083 }
3084 Expression::Null(_) => "NULL",
3085 _ => "",
3086 }
3087 }
3088
3089 pub fn get_alias(&self) -> &str {
3091 match self {
3092 Expression::Alias(a) => &a.alias.name,
3093 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3094 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3095 _ => "",
3096 }
3097 }
3098
3099 pub fn get_output_name(&self) -> &str {
3101 match self {
3102 Expression::Alias(a) => &a.alias.name,
3103 Expression::Column(c) => &c.name.name,
3104 Expression::Identifier(id) => &id.name,
3105 Expression::Literal(lit) => lit.value_str(),
3106 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3107 Expression::Star(_) => "*",
3108 _ => "",
3109 }
3110 }
3111
3112 pub fn get_comments(&self) -> Vec<&str> {
3114 match self {
3115 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3116 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3117 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3118 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3119 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3120 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3121 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3122 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3123 }
3124 Expression::And(op)
3125 | Expression::Or(op)
3126 | Expression::Add(op)
3127 | Expression::Sub(op)
3128 | Expression::Mul(op)
3129 | Expression::Div(op)
3130 | Expression::Mod(op)
3131 | Expression::Eq(op)
3132 | Expression::Neq(op)
3133 | Expression::Lt(op)
3134 | Expression::Lte(op)
3135 | Expression::Gt(op)
3136 | Expression::Gte(op)
3137 | Expression::Concat(op)
3138 | Expression::BitwiseAnd(op)
3139 | Expression::BitwiseOr(op)
3140 | Expression::BitwiseXor(op) => {
3141 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3142 }
3143 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3144 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3145 _ => Vec::new(),
3146 }
3147 }
3148}
3149
3150impl fmt::Display for Expression {
3151 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3152 match self {
3154 Expression::Literal(lit) => write!(f, "{}", lit),
3155 Expression::Identifier(id) => write!(f, "{}", id),
3156 Expression::Column(col) => write!(f, "{}", col),
3157 Expression::Star(_) => write!(f, "*"),
3158 Expression::Null(_) => write!(f, "NULL"),
3159 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3160 Expression::Select(_) => write!(f, "SELECT ..."),
3161 _ => write!(f, "{:?}", self),
3162 }
3163 }
3164}
3165
3166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3176#[cfg_attr(feature = "bindings", derive(TS))]
3177#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3178pub enum Literal {
3179 String(String),
3181 Number(String),
3183 HexString(String),
3185 HexNumber(String),
3187 BitString(String),
3188 ByteString(String),
3190 NationalString(String),
3192 Date(String),
3194 Time(String),
3196 Timestamp(String),
3198 Datetime(String),
3200 TripleQuotedString(String, char),
3203 EscapeString(String),
3205 DollarString(String),
3207 RawString(String),
3211}
3212
3213impl Literal {
3214 pub fn value_str(&self) -> &str {
3216 match self {
3217 Literal::String(s)
3218 | Literal::Number(s)
3219 | Literal::HexString(s)
3220 | Literal::HexNumber(s)
3221 | Literal::BitString(s)
3222 | Literal::ByteString(s)
3223 | Literal::NationalString(s)
3224 | Literal::Date(s)
3225 | Literal::Time(s)
3226 | Literal::Timestamp(s)
3227 | Literal::Datetime(s)
3228 | Literal::EscapeString(s)
3229 | Literal::DollarString(s)
3230 | Literal::RawString(s) => s.as_str(),
3231 Literal::TripleQuotedString(s, _) => s.as_str(),
3232 }
3233 }
3234
3235 pub fn is_string(&self) -> bool {
3237 matches!(
3238 self,
3239 Literal::String(_)
3240 | Literal::NationalString(_)
3241 | Literal::EscapeString(_)
3242 | Literal::DollarString(_)
3243 | Literal::RawString(_)
3244 | Literal::TripleQuotedString(_, _)
3245 )
3246 }
3247
3248 pub fn is_number(&self) -> bool {
3250 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3251 }
3252}
3253
3254impl fmt::Display for Literal {
3255 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3256 match self {
3257 Literal::String(s) => write!(f, "'{}'", s),
3258 Literal::Number(n) => write!(f, "{}", n),
3259 Literal::HexString(h) => write!(f, "X'{}'", h),
3260 Literal::HexNumber(h) => write!(f, "0x{}", h),
3261 Literal::BitString(b) => write!(f, "B'{}'", b),
3262 Literal::ByteString(b) => write!(f, "b'{}'", b),
3263 Literal::NationalString(s) => write!(f, "N'{}'", s),
3264 Literal::Date(d) => write!(f, "DATE '{}'", d),
3265 Literal::Time(t) => write!(f, "TIME '{}'", t),
3266 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3267 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3268 Literal::TripleQuotedString(s, q) => {
3269 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3270 }
3271 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3272 Literal::DollarString(s) => write!(f, "$${}$$", s),
3273 Literal::RawString(s) => write!(f, "r'{}'", s),
3274 }
3275 }
3276}
3277
3278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3280#[cfg_attr(feature = "bindings", derive(TS))]
3281pub struct BooleanLiteral {
3282 pub value: bool,
3283}
3284
3285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3287#[cfg_attr(feature = "bindings", derive(TS))]
3288pub struct Null;
3289
3290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3297#[cfg_attr(feature = "bindings", derive(TS))]
3298pub struct Identifier {
3299 pub name: String,
3301 pub quoted: bool,
3303 #[serde(default)]
3304 pub trailing_comments: Vec<String>,
3305 #[serde(default, skip_serializing_if = "Option::is_none")]
3307 pub span: Option<Span>,
3308}
3309
3310impl Identifier {
3311 pub fn new(name: impl Into<String>) -> Self {
3312 Self {
3313 name: name.into(),
3314 quoted: false,
3315 trailing_comments: Vec::new(),
3316 span: None,
3317 }
3318 }
3319
3320 pub fn quoted(name: impl Into<String>) -> Self {
3321 Self {
3322 name: name.into(),
3323 quoted: true,
3324 trailing_comments: Vec::new(),
3325 span: None,
3326 }
3327 }
3328
3329 pub fn empty() -> Self {
3330 Self {
3331 name: String::new(),
3332 quoted: false,
3333 trailing_comments: Vec::new(),
3334 span: None,
3335 }
3336 }
3337
3338 pub fn is_empty(&self) -> bool {
3339 self.name.is_empty()
3340 }
3341
3342 pub fn with_span(mut self, span: Span) -> Self {
3344 self.span = Some(span);
3345 self
3346 }
3347}
3348
3349impl fmt::Display for Identifier {
3350 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3351 if self.quoted {
3352 write!(f, "\"{}\"", self.name)
3353 } else {
3354 write!(f, "{}", self.name)
3355 }
3356 }
3357}
3358
3359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3365#[cfg_attr(feature = "bindings", derive(TS))]
3366pub struct Column {
3367 pub name: Identifier,
3369 pub table: Option<Identifier>,
3371 #[serde(default)]
3373 pub join_mark: bool,
3374 #[serde(default)]
3376 pub trailing_comments: Vec<String>,
3377 #[serde(default, skip_serializing_if = "Option::is_none")]
3379 pub span: Option<Span>,
3380 #[serde(default, skip_serializing_if = "Option::is_none")]
3382 pub inferred_type: Option<DataType>,
3383}
3384
3385impl fmt::Display for Column {
3386 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3387 if let Some(table) = &self.table {
3388 write!(f, "{}.{}", table, self.name)
3389 } else {
3390 write!(f, "{}", self.name)
3391 }
3392 }
3393}
3394
3395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3402#[cfg_attr(feature = "bindings", derive(TS))]
3403pub struct TableRef {
3404 pub name: Identifier,
3406 pub schema: Option<Identifier>,
3408 pub catalog: Option<Identifier>,
3410 pub alias: Option<Identifier>,
3412 #[serde(default)]
3414 pub alias_explicit_as: bool,
3415 #[serde(default)]
3417 pub column_aliases: Vec<Identifier>,
3418 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3420 pub leading_comments: Vec<String>,
3421 #[serde(default)]
3423 pub trailing_comments: Vec<String>,
3424 #[serde(default)]
3426 pub when: Option<Box<HistoricalData>>,
3427 #[serde(default)]
3429 pub only: bool,
3430 #[serde(default)]
3432 pub final_: bool,
3433 #[serde(default, skip_serializing_if = "Option::is_none")]
3435 pub table_sample: Option<Box<Sample>>,
3436 #[serde(default)]
3438 pub hints: Vec<Expression>,
3439 #[serde(default, skip_serializing_if = "Option::is_none")]
3442 pub system_time: Option<String>,
3443 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3445 pub partitions: Vec<Identifier>,
3446 #[serde(default, skip_serializing_if = "Option::is_none")]
3449 pub identifier_func: Option<Box<Expression>>,
3450 #[serde(default, skip_serializing_if = "Option::is_none")]
3452 pub changes: Option<Box<Changes>>,
3453 #[serde(default, skip_serializing_if = "Option::is_none")]
3455 pub version: Option<Box<Version>>,
3456 #[serde(default, skip_serializing_if = "Option::is_none")]
3458 pub span: Option<Span>,
3459}
3460
3461impl TableRef {
3462 pub fn new(name: impl Into<String>) -> Self {
3463 Self {
3464 name: Identifier::new(name),
3465 schema: None,
3466 catalog: None,
3467 alias: None,
3468 alias_explicit_as: false,
3469 column_aliases: Vec::new(),
3470 leading_comments: Vec::new(),
3471 trailing_comments: Vec::new(),
3472 when: None,
3473 only: false,
3474 final_: false,
3475 table_sample: None,
3476 hints: Vec::new(),
3477 system_time: None,
3478 partitions: Vec::new(),
3479 identifier_func: None,
3480 changes: None,
3481 version: None,
3482 span: None,
3483 }
3484 }
3485
3486 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3488 let mut t = Self::new(name);
3489 t.schema = Some(Identifier::new(schema));
3490 t
3491 }
3492
3493 pub fn new_with_catalog(
3495 name: impl Into<String>,
3496 schema: impl Into<String>,
3497 catalog: impl Into<String>,
3498 ) -> Self {
3499 let mut t = Self::new(name);
3500 t.schema = Some(Identifier::new(schema));
3501 t.catalog = Some(Identifier::new(catalog));
3502 t
3503 }
3504
3505 pub fn from_identifier(name: Identifier) -> Self {
3507 Self {
3508 name,
3509 schema: None,
3510 catalog: None,
3511 alias: None,
3512 alias_explicit_as: false,
3513 column_aliases: Vec::new(),
3514 leading_comments: Vec::new(),
3515 trailing_comments: Vec::new(),
3516 when: None,
3517 only: false,
3518 final_: false,
3519 table_sample: None,
3520 hints: Vec::new(),
3521 system_time: None,
3522 partitions: Vec::new(),
3523 identifier_func: None,
3524 changes: None,
3525 version: None,
3526 span: None,
3527 }
3528 }
3529
3530 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3531 self.alias = Some(Identifier::new(alias));
3532 self
3533 }
3534
3535 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3536 self.schema = Some(Identifier::new(schema));
3537 self
3538 }
3539}
3540
3541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3546#[cfg_attr(feature = "bindings", derive(TS))]
3547pub struct Star {
3548 pub table: Option<Identifier>,
3550 pub except: Option<Vec<Identifier>>,
3552 pub replace: Option<Vec<Alias>>,
3554 pub rename: Option<Vec<(Identifier, Identifier)>>,
3556 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3558 pub trailing_comments: Vec<String>,
3559 #[serde(default, skip_serializing_if = "Option::is_none")]
3561 pub span: Option<Span>,
3562}
3563
3564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3588#[cfg_attr(feature = "bindings", derive(TS))]
3589pub struct Select {
3590 pub expressions: Vec<Expression>,
3592 pub from: Option<From>,
3594 pub joins: Vec<Join>,
3596 pub lateral_views: Vec<LateralView>,
3597 #[serde(default, skip_serializing_if = "Option::is_none")]
3599 pub prewhere: Option<Expression>,
3600 pub where_clause: Option<Where>,
3601 pub group_by: Option<GroupBy>,
3602 pub having: Option<Having>,
3603 pub qualify: Option<Qualify>,
3604 pub order_by: Option<OrderBy>,
3605 pub distribute_by: Option<DistributeBy>,
3606 pub cluster_by: Option<ClusterBy>,
3607 pub sort_by: Option<SortBy>,
3608 pub limit: Option<Limit>,
3609 pub offset: Option<Offset>,
3610 #[serde(default, skip_serializing_if = "Option::is_none")]
3612 pub limit_by: Option<Vec<Expression>>,
3613 pub fetch: Option<Fetch>,
3614 pub distinct: bool,
3615 pub distinct_on: Option<Vec<Expression>>,
3616 pub top: Option<Top>,
3617 pub with: Option<With>,
3618 pub sample: Option<Sample>,
3619 #[serde(default, skip_serializing_if = "Option::is_none")]
3621 pub settings: Option<Vec<Expression>>,
3622 #[serde(default, skip_serializing_if = "Option::is_none")]
3624 pub format: Option<Expression>,
3625 pub windows: Option<Vec<NamedWindow>>,
3626 pub hint: Option<Hint>,
3627 pub connect: Option<Connect>,
3629 pub into: Option<SelectInto>,
3631 #[serde(default)]
3633 pub locks: Vec<Lock>,
3634 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3636 pub for_xml: Vec<Expression>,
3637 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3639 pub for_json: Vec<Expression>,
3640 #[serde(default)]
3642 pub leading_comments: Vec<String>,
3643 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3646 pub post_select_comments: Vec<String>,
3647 #[serde(default, skip_serializing_if = "Option::is_none")]
3649 pub kind: Option<String>,
3650 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3652 pub operation_modifiers: Vec<String>,
3653 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3655 pub qualify_after_window: bool,
3656 #[serde(default, skip_serializing_if = "Option::is_none")]
3658 pub option: Option<String>,
3659 #[serde(default, skip_serializing_if = "Option::is_none")]
3662 pub exclude: Option<Vec<Expression>>,
3663}
3664
3665impl Select {
3666 pub fn new() -> Self {
3667 Self {
3668 expressions: Vec::new(),
3669 from: None,
3670 joins: Vec::new(),
3671 lateral_views: Vec::new(),
3672 prewhere: None,
3673 where_clause: None,
3674 group_by: None,
3675 having: None,
3676 qualify: None,
3677 order_by: None,
3678 distribute_by: None,
3679 cluster_by: None,
3680 sort_by: None,
3681 limit: None,
3682 offset: None,
3683 limit_by: None,
3684 fetch: None,
3685 distinct: false,
3686 distinct_on: None,
3687 top: None,
3688 with: None,
3689 sample: None,
3690 settings: None,
3691 format: None,
3692 windows: None,
3693 hint: None,
3694 connect: None,
3695 into: None,
3696 locks: Vec::new(),
3697 for_xml: Vec::new(),
3698 for_json: Vec::new(),
3699 leading_comments: Vec::new(),
3700 post_select_comments: Vec::new(),
3701 kind: None,
3702 operation_modifiers: Vec::new(),
3703 qualify_after_window: false,
3704 option: None,
3705 exclude: None,
3706 }
3707 }
3708
3709 pub fn column(mut self, expr: Expression) -> Self {
3711 self.expressions.push(expr);
3712 self
3713 }
3714
3715 pub fn from(mut self, table: Expression) -> Self {
3717 self.from = Some(From {
3718 expressions: vec![table],
3719 });
3720 self
3721 }
3722
3723 pub fn where_(mut self, condition: Expression) -> Self {
3725 self.where_clause = Some(Where { this: condition });
3726 self
3727 }
3728
3729 pub fn distinct(mut self) -> Self {
3731 self.distinct = true;
3732 self
3733 }
3734
3735 pub fn join(mut self, join: Join) -> Self {
3737 self.joins.push(join);
3738 self
3739 }
3740
3741 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3743 self.order_by = Some(OrderBy {
3744 expressions,
3745 siblings: false,
3746 comments: Vec::new(),
3747 });
3748 self
3749 }
3750
3751 pub fn limit(mut self, n: Expression) -> Self {
3753 self.limit = Some(Limit {
3754 this: n,
3755 percent: false,
3756 comments: Vec::new(),
3757 });
3758 self
3759 }
3760
3761 pub fn offset(mut self, n: Expression) -> Self {
3763 self.offset = Some(Offset {
3764 this: n,
3765 rows: None,
3766 });
3767 self
3768 }
3769}
3770
3771impl Default for Select {
3772 fn default() -> Self {
3773 Self::new()
3774 }
3775}
3776
3777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3783#[cfg_attr(feature = "bindings", derive(TS))]
3784pub struct Union {
3785 pub left: Expression,
3787 pub right: Expression,
3789 pub all: bool,
3791 #[serde(default)]
3793 pub distinct: bool,
3794 pub with: Option<With>,
3796 pub order_by: Option<OrderBy>,
3798 pub limit: Option<Box<Expression>>,
3800 pub offset: Option<Box<Expression>>,
3802 #[serde(default, skip_serializing_if = "Option::is_none")]
3804 pub distribute_by: Option<DistributeBy>,
3805 #[serde(default, skip_serializing_if = "Option::is_none")]
3807 pub sort_by: Option<SortBy>,
3808 #[serde(default, skip_serializing_if = "Option::is_none")]
3810 pub cluster_by: Option<ClusterBy>,
3811 #[serde(default)]
3813 pub by_name: bool,
3814 #[serde(default, skip_serializing_if = "Option::is_none")]
3816 pub side: Option<String>,
3817 #[serde(default, skip_serializing_if = "Option::is_none")]
3819 pub kind: Option<String>,
3820 #[serde(default)]
3822 pub corresponding: bool,
3823 #[serde(default)]
3825 pub strict: bool,
3826 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3828 pub on_columns: Vec<Expression>,
3829}
3830
3831impl Drop for Union {
3834 fn drop(&mut self) {
3835 loop {
3836 if let Expression::Union(ref mut inner) = self.left {
3837 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3838 let old_left = std::mem::replace(&mut self.left, next_left);
3839 drop(old_left);
3840 } else {
3841 break;
3842 }
3843 }
3844 }
3845}
3846
3847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3852#[cfg_attr(feature = "bindings", derive(TS))]
3853pub struct Intersect {
3854 pub left: Expression,
3856 pub right: Expression,
3858 pub all: bool,
3860 #[serde(default)]
3862 pub distinct: bool,
3863 pub with: Option<With>,
3865 pub order_by: Option<OrderBy>,
3867 pub limit: Option<Box<Expression>>,
3869 pub offset: Option<Box<Expression>>,
3871 #[serde(default, skip_serializing_if = "Option::is_none")]
3873 pub distribute_by: Option<DistributeBy>,
3874 #[serde(default, skip_serializing_if = "Option::is_none")]
3876 pub sort_by: Option<SortBy>,
3877 #[serde(default, skip_serializing_if = "Option::is_none")]
3879 pub cluster_by: Option<ClusterBy>,
3880 #[serde(default)]
3882 pub by_name: bool,
3883 #[serde(default, skip_serializing_if = "Option::is_none")]
3885 pub side: Option<String>,
3886 #[serde(default, skip_serializing_if = "Option::is_none")]
3888 pub kind: Option<String>,
3889 #[serde(default)]
3891 pub corresponding: bool,
3892 #[serde(default)]
3894 pub strict: bool,
3895 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3897 pub on_columns: Vec<Expression>,
3898}
3899
3900impl Drop for Intersect {
3901 fn drop(&mut self) {
3902 loop {
3903 if let Expression::Intersect(ref mut inner) = self.left {
3904 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3905 let old_left = std::mem::replace(&mut self.left, next_left);
3906 drop(old_left);
3907 } else {
3908 break;
3909 }
3910 }
3911 }
3912}
3913
3914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3919#[cfg_attr(feature = "bindings", derive(TS))]
3920pub struct Except {
3921 pub left: Expression,
3923 pub right: Expression,
3925 pub all: bool,
3927 #[serde(default)]
3929 pub distinct: bool,
3930 pub with: Option<With>,
3932 pub order_by: Option<OrderBy>,
3934 pub limit: Option<Box<Expression>>,
3936 pub offset: Option<Box<Expression>>,
3938 #[serde(default, skip_serializing_if = "Option::is_none")]
3940 pub distribute_by: Option<DistributeBy>,
3941 #[serde(default, skip_serializing_if = "Option::is_none")]
3943 pub sort_by: Option<SortBy>,
3944 #[serde(default, skip_serializing_if = "Option::is_none")]
3946 pub cluster_by: Option<ClusterBy>,
3947 #[serde(default)]
3949 pub by_name: bool,
3950 #[serde(default, skip_serializing_if = "Option::is_none")]
3952 pub side: Option<String>,
3953 #[serde(default, skip_serializing_if = "Option::is_none")]
3955 pub kind: Option<String>,
3956 #[serde(default)]
3958 pub corresponding: bool,
3959 #[serde(default)]
3961 pub strict: bool,
3962 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3964 pub on_columns: Vec<Expression>,
3965}
3966
3967impl Drop for Except {
3968 fn drop(&mut self) {
3969 loop {
3970 if let Expression::Except(ref mut inner) = self.left {
3971 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3972 let old_left = std::mem::replace(&mut self.left, next_left);
3973 drop(old_left);
3974 } else {
3975 break;
3976 }
3977 }
3978 }
3979}
3980
3981#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3983#[cfg_attr(feature = "bindings", derive(TS))]
3984pub struct SelectInto {
3985 pub this: Expression,
3987 #[serde(default)]
3989 pub temporary: bool,
3990 #[serde(default)]
3992 pub unlogged: bool,
3993 #[serde(default)]
3995 pub bulk_collect: bool,
3996 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3998 pub expressions: Vec<Expression>,
3999}
4000
4001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4011#[cfg_attr(feature = "bindings", derive(TS))]
4012pub struct Subquery {
4013 pub this: Expression,
4015 pub alias: Option<Identifier>,
4017 pub column_aliases: Vec<Identifier>,
4019 #[serde(default)]
4021 pub alias_explicit_as: bool,
4022 #[serde(skip_serializing_if = "Option::is_none", default)]
4024 pub alias_keyword: Option<String>,
4025 pub order_by: Option<OrderBy>,
4027 pub limit: Option<Limit>,
4029 pub offset: Option<Offset>,
4031 #[serde(default, skip_serializing_if = "Option::is_none")]
4033 pub distribute_by: Option<DistributeBy>,
4034 #[serde(default, skip_serializing_if = "Option::is_none")]
4036 pub sort_by: Option<SortBy>,
4037 #[serde(default, skip_serializing_if = "Option::is_none")]
4039 pub cluster_by: Option<ClusterBy>,
4040 #[serde(default)]
4042 pub lateral: bool,
4043 #[serde(default)]
4047 pub modifiers_inside: bool,
4048 #[serde(default)]
4050 pub trailing_comments: Vec<String>,
4051 #[serde(default, skip_serializing_if = "Option::is_none")]
4053 pub inferred_type: Option<DataType>,
4054}
4055
4056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4061#[cfg_attr(feature = "bindings", derive(TS))]
4062pub struct PipeOperator {
4063 pub this: Expression,
4065 pub expression: Expression,
4067}
4068
4069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4071#[cfg_attr(feature = "bindings", derive(TS))]
4072pub struct Values {
4073 pub expressions: Vec<Tuple>,
4075 pub alias: Option<Identifier>,
4077 pub column_aliases: Vec<Identifier>,
4079}
4080
4081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4091#[cfg_attr(feature = "bindings", derive(TS))]
4092pub struct Pivot {
4093 pub this: Expression,
4095 #[serde(default)]
4098 pub expressions: Vec<Expression>,
4099 #[serde(default)]
4101 pub fields: Vec<Expression>,
4102 #[serde(default)]
4104 pub using: Vec<Expression>,
4105 #[serde(default)]
4107 pub group: Option<Box<Expression>>,
4108 #[serde(default)]
4110 pub unpivot: bool,
4111 #[serde(default)]
4113 pub into: Option<Box<Expression>>,
4114 #[serde(default)]
4116 pub alias: Option<Identifier>,
4117 #[serde(default)]
4119 pub include_nulls: Option<bool>,
4120 #[serde(default)]
4122 pub default_on_null: Option<Box<Expression>>,
4123 #[serde(default, skip_serializing_if = "Option::is_none")]
4125 pub with: Option<With>,
4126}
4127
4128#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4130#[cfg_attr(feature = "bindings", derive(TS))]
4131pub struct Unpivot {
4132 pub this: Expression,
4133 pub value_column: Identifier,
4134 pub name_column: Identifier,
4135 pub columns: Vec<Expression>,
4136 pub alias: Option<Identifier>,
4137 #[serde(default)]
4139 pub value_column_parenthesized: bool,
4140 #[serde(default)]
4142 pub include_nulls: Option<bool>,
4143 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4145 pub extra_value_columns: Vec<Identifier>,
4146}
4147
4148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4151#[cfg_attr(feature = "bindings", derive(TS))]
4152pub struct PivotAlias {
4153 pub this: Expression,
4154 pub alias: Expression,
4155}
4156
4157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4159#[cfg_attr(feature = "bindings", derive(TS))]
4160pub struct PreWhere {
4161 pub this: Expression,
4162}
4163
4164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4166#[cfg_attr(feature = "bindings", derive(TS))]
4167pub struct Stream {
4168 pub this: Expression,
4169 #[serde(skip_serializing_if = "Option::is_none")]
4170 pub on: Option<Expression>,
4171 #[serde(skip_serializing_if = "Option::is_none")]
4172 pub show_initial_rows: Option<bool>,
4173}
4174
4175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4177#[cfg_attr(feature = "bindings", derive(TS))]
4178pub struct UsingData {
4179 pub this: Expression,
4180}
4181
4182#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4184#[cfg_attr(feature = "bindings", derive(TS))]
4185pub struct XmlNamespace {
4186 pub this: Expression,
4187 #[serde(skip_serializing_if = "Option::is_none")]
4188 pub alias: Option<Identifier>,
4189}
4190
4191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4193#[cfg_attr(feature = "bindings", derive(TS))]
4194pub struct RowFormat {
4195 pub delimited: bool,
4196 pub fields_terminated_by: Option<String>,
4197 pub collection_items_terminated_by: Option<String>,
4198 pub map_keys_terminated_by: Option<String>,
4199 pub lines_terminated_by: Option<String>,
4200 pub null_defined_as: Option<String>,
4201}
4202
4203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4205#[cfg_attr(feature = "bindings", derive(TS))]
4206pub struct DirectoryInsert {
4207 pub local: bool,
4208 pub path: String,
4209 pub row_format: Option<RowFormat>,
4210 #[serde(default)]
4212 pub stored_as: Option<String>,
4213}
4214
4215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4217#[cfg_attr(feature = "bindings", derive(TS))]
4218pub struct Insert {
4219 pub table: TableRef,
4220 pub columns: Vec<Identifier>,
4221 pub values: Vec<Vec<Expression>>,
4222 pub query: Option<Expression>,
4223 pub overwrite: bool,
4225 pub partition: Vec<(Identifier, Option<Expression>)>,
4227 #[serde(default)]
4229 pub directory: Option<DirectoryInsert>,
4230 #[serde(default)]
4232 pub returning: Vec<Expression>,
4233 #[serde(default)]
4235 pub output: Option<OutputClause>,
4236 #[serde(default)]
4238 pub on_conflict: Option<Box<Expression>>,
4239 #[serde(default)]
4241 pub leading_comments: Vec<String>,
4242 #[serde(default)]
4244 pub if_exists: bool,
4245 #[serde(default)]
4247 pub with: Option<With>,
4248 #[serde(default)]
4250 pub ignore: bool,
4251 #[serde(default)]
4253 pub source_alias: Option<Identifier>,
4254 #[serde(default)]
4256 pub alias: Option<Identifier>,
4257 #[serde(default)]
4259 pub alias_explicit_as: bool,
4260 #[serde(default)]
4262 pub default_values: bool,
4263 #[serde(default)]
4265 pub by_name: bool,
4266 #[serde(default, skip_serializing_if = "Option::is_none")]
4268 pub conflict_action: Option<String>,
4269 #[serde(default)]
4271 pub is_replace: bool,
4272 #[serde(default, skip_serializing_if = "Option::is_none")]
4274 pub hint: Option<Hint>,
4275 #[serde(default)]
4277 pub replace_where: Option<Box<Expression>>,
4278 #[serde(default)]
4280 pub source: Option<Box<Expression>>,
4281 #[serde(default, skip_serializing_if = "Option::is_none")]
4283 pub function_target: Option<Box<Expression>>,
4284 #[serde(default, skip_serializing_if = "Option::is_none")]
4286 pub partition_by: Option<Box<Expression>>,
4287 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4289 pub settings: Vec<Expression>,
4290}
4291
4292#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4294#[cfg_attr(feature = "bindings", derive(TS))]
4295pub struct OutputClause {
4296 pub columns: Vec<Expression>,
4298 #[serde(default)]
4300 pub into_table: Option<Expression>,
4301}
4302
4303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4305#[cfg_attr(feature = "bindings", derive(TS))]
4306pub struct Update {
4307 pub table: TableRef,
4308 #[serde(default)]
4309 pub hint: Option<Hint>,
4310 #[serde(default)]
4312 pub extra_tables: Vec<TableRef>,
4313 #[serde(default)]
4315 pub table_joins: Vec<Join>,
4316 pub set: Vec<(Identifier, Expression)>,
4317 pub from_clause: Option<From>,
4318 #[serde(default)]
4320 pub from_joins: Vec<Join>,
4321 pub where_clause: Option<Where>,
4322 #[serde(default)]
4324 pub returning: Vec<Expression>,
4325 #[serde(default)]
4327 pub output: Option<OutputClause>,
4328 #[serde(default)]
4330 pub with: Option<With>,
4331 #[serde(default)]
4333 pub leading_comments: Vec<String>,
4334 #[serde(default)]
4336 pub limit: Option<Expression>,
4337 #[serde(default)]
4339 pub order_by: Option<OrderBy>,
4340 #[serde(default)]
4342 pub from_before_set: bool,
4343}
4344
4345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4347#[cfg_attr(feature = "bindings", derive(TS))]
4348pub struct Delete {
4349 pub table: TableRef,
4350 #[serde(default)]
4351 pub hint: Option<Hint>,
4352 #[serde(default, skip_serializing_if = "Option::is_none")]
4354 pub on_cluster: Option<OnCluster>,
4355 pub alias: Option<Identifier>,
4357 #[serde(default)]
4359 pub alias_explicit_as: bool,
4360 pub using: Vec<TableRef>,
4362 pub where_clause: Option<Where>,
4363 #[serde(default)]
4365 pub output: Option<OutputClause>,
4366 #[serde(default)]
4368 pub leading_comments: Vec<String>,
4369 #[serde(default)]
4371 pub with: Option<With>,
4372 #[serde(default)]
4374 pub limit: Option<Expression>,
4375 #[serde(default)]
4377 pub order_by: Option<OrderBy>,
4378 #[serde(default)]
4380 pub returning: Vec<Expression>,
4381 #[serde(default)]
4384 pub tables: Vec<TableRef>,
4385 #[serde(default)]
4388 pub tables_from_using: bool,
4389 #[serde(default)]
4391 pub joins: Vec<Join>,
4392 #[serde(default)]
4394 pub force_index: Option<String>,
4395 #[serde(default)]
4397 pub no_from: bool,
4398}
4399
4400#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4402#[cfg_attr(feature = "bindings", derive(TS))]
4403pub struct CopyStmt {
4404 pub this: Expression,
4406 pub kind: bool,
4408 pub files: Vec<Expression>,
4410 #[serde(default)]
4412 pub params: Vec<CopyParameter>,
4413 #[serde(default)]
4415 pub credentials: Option<Box<Credentials>>,
4416 #[serde(default)]
4418 pub is_into: bool,
4419 #[serde(default)]
4421 pub with_wrapped: bool,
4422}
4423
4424#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4426#[cfg_attr(feature = "bindings", derive(TS))]
4427pub struct CopyParameter {
4428 pub name: String,
4429 pub value: Option<Expression>,
4430 pub values: Vec<Expression>,
4431 #[serde(default)]
4433 pub eq: bool,
4434}
4435
4436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4438#[cfg_attr(feature = "bindings", derive(TS))]
4439pub struct Credentials {
4440 pub credentials: Vec<(String, String)>,
4441 pub encryption: Option<String>,
4442 pub storage: Option<String>,
4443}
4444
4445#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4447#[cfg_attr(feature = "bindings", derive(TS))]
4448pub struct PutStmt {
4449 pub source: String,
4451 #[serde(default)]
4453 pub source_quoted: bool,
4454 pub target: Expression,
4456 #[serde(default)]
4458 pub params: Vec<CopyParameter>,
4459}
4460
4461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4463#[cfg_attr(feature = "bindings", derive(TS))]
4464pub struct StageReference {
4465 pub name: String,
4467 #[serde(default)]
4469 pub path: Option<String>,
4470 #[serde(default)]
4472 pub file_format: Option<Expression>,
4473 #[serde(default)]
4475 pub pattern: Option<String>,
4476 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4478 pub quoted: bool,
4479}
4480
4481#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4483#[cfg_attr(feature = "bindings", derive(TS))]
4484pub struct HistoricalData {
4485 pub this: Box<Expression>,
4487 pub kind: String,
4489 pub expression: Box<Expression>,
4491}
4492
4493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4498#[cfg_attr(feature = "bindings", derive(TS))]
4499pub struct Alias {
4500 pub this: Expression,
4502 pub alias: Identifier,
4504 #[serde(default)]
4506 pub column_aliases: Vec<Identifier>,
4507 #[serde(default)]
4509 pub alias_explicit_as: bool,
4510 #[serde(skip_serializing_if = "Option::is_none", default)]
4512 pub alias_keyword: Option<String>,
4513 #[serde(default)]
4515 pub pre_alias_comments: Vec<String>,
4516 #[serde(default)]
4518 pub trailing_comments: Vec<String>,
4519 #[serde(default, skip_serializing_if = "Option::is_none")]
4521 pub inferred_type: Option<DataType>,
4522}
4523
4524impl Alias {
4525 pub fn new(this: Expression, alias: Identifier) -> Self {
4527 Self {
4528 this,
4529 alias,
4530 column_aliases: Vec::new(),
4531 alias_explicit_as: false,
4532 alias_keyword: None,
4533 pre_alias_comments: Vec::new(),
4534 trailing_comments: Vec::new(),
4535 inferred_type: None,
4536 }
4537 }
4538
4539 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4541 Self {
4542 this,
4543 alias: Identifier::empty(),
4544 column_aliases,
4545 alias_explicit_as: false,
4546 alias_keyword: None,
4547 pre_alias_comments: Vec::new(),
4548 trailing_comments: Vec::new(),
4549 inferred_type: None,
4550 }
4551 }
4552}
4553
4554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4561#[cfg_attr(feature = "bindings", derive(TS))]
4562pub struct Cast {
4563 pub this: Expression,
4565 pub to: DataType,
4567 #[serde(default)]
4568 pub trailing_comments: Vec<String>,
4569 #[serde(default)]
4571 pub double_colon_syntax: bool,
4572 #[serde(skip_serializing_if = "Option::is_none", default)]
4574 pub format: Option<Box<Expression>>,
4575 #[serde(skip_serializing_if = "Option::is_none", default)]
4577 pub default: Option<Box<Expression>>,
4578 #[serde(default, skip_serializing_if = "Option::is_none")]
4580 pub inferred_type: Option<DataType>,
4581}
4582
4583#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4585#[cfg_attr(feature = "bindings", derive(TS))]
4586pub struct CollationExpr {
4587 pub this: Expression,
4588 pub collation: String,
4589 #[serde(default)]
4591 pub quoted: bool,
4592 #[serde(default)]
4594 pub double_quoted: bool,
4595}
4596
4597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4603#[cfg_attr(feature = "bindings", derive(TS))]
4604pub struct Case {
4605 pub operand: Option<Expression>,
4607 pub whens: Vec<(Expression, Expression)>,
4609 pub else_: Option<Expression>,
4611 #[serde(default)]
4613 #[serde(skip_serializing_if = "Vec::is_empty")]
4614 pub comments: Vec<String>,
4615 #[serde(default, skip_serializing_if = "Option::is_none")]
4617 pub inferred_type: Option<DataType>,
4618}
4619
4620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4628#[cfg_attr(feature = "bindings", derive(TS))]
4629pub struct BinaryOp {
4630 pub left: Expression,
4631 pub right: Expression,
4632 #[serde(default)]
4634 pub left_comments: Vec<String>,
4635 #[serde(default)]
4637 pub operator_comments: Vec<String>,
4638 #[serde(default)]
4640 pub trailing_comments: Vec<String>,
4641 #[serde(default, skip_serializing_if = "Option::is_none")]
4643 pub inferred_type: Option<DataType>,
4644}
4645
4646impl BinaryOp {
4647 pub fn new(left: Expression, right: Expression) -> Self {
4648 Self {
4649 left,
4650 right,
4651 left_comments: Vec::new(),
4652 operator_comments: Vec::new(),
4653 trailing_comments: Vec::new(),
4654 inferred_type: None,
4655 }
4656 }
4657}
4658
4659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4661#[cfg_attr(feature = "bindings", derive(TS))]
4662pub struct LikeOp {
4663 pub left: Expression,
4664 pub right: Expression,
4665 #[serde(default)]
4667 pub escape: Option<Expression>,
4668 #[serde(default)]
4670 pub quantifier: Option<String>,
4671 #[serde(default, skip_serializing_if = "Option::is_none")]
4673 pub inferred_type: Option<DataType>,
4674}
4675
4676impl LikeOp {
4677 pub fn new(left: Expression, right: Expression) -> Self {
4678 Self {
4679 left,
4680 right,
4681 escape: None,
4682 quantifier: None,
4683 inferred_type: None,
4684 }
4685 }
4686
4687 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4688 Self {
4689 left,
4690 right,
4691 escape: Some(escape),
4692 quantifier: None,
4693 inferred_type: None,
4694 }
4695 }
4696}
4697
4698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4702#[cfg_attr(feature = "bindings", derive(TS))]
4703pub struct UnaryOp {
4704 pub this: Expression,
4706 #[serde(default, skip_serializing_if = "Option::is_none")]
4708 pub inferred_type: Option<DataType>,
4709}
4710
4711impl UnaryOp {
4712 pub fn new(this: Expression) -> Self {
4713 Self {
4714 this,
4715 inferred_type: None,
4716 }
4717 }
4718}
4719
4720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4725#[cfg_attr(feature = "bindings", derive(TS))]
4726pub struct In {
4727 pub this: Expression,
4729 pub expressions: Vec<Expression>,
4731 pub query: Option<Expression>,
4733 pub not: bool,
4735 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4736 pub global: bool,
4737 #[serde(default, skip_serializing_if = "Option::is_none")]
4739 pub unnest: Option<Box<Expression>>,
4740 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4744 pub is_field: bool,
4745}
4746
4747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4749#[cfg_attr(feature = "bindings", derive(TS))]
4750pub struct Between {
4751 pub this: Expression,
4753 pub low: Expression,
4755 pub high: Expression,
4757 pub not: bool,
4759 #[serde(default)]
4761 pub symmetric: Option<bool>,
4762}
4763
4764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4766#[cfg_attr(feature = "bindings", derive(TS))]
4767pub struct IsNull {
4768 pub this: Expression,
4769 pub not: bool,
4770 #[serde(default)]
4772 pub postfix_form: bool,
4773}
4774
4775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4777#[cfg_attr(feature = "bindings", derive(TS))]
4778pub struct IsTrueFalse {
4779 pub this: Expression,
4780 pub not: bool,
4781}
4782
4783#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4786#[cfg_attr(feature = "bindings", derive(TS))]
4787pub struct IsJson {
4788 pub this: Expression,
4789 pub json_type: Option<String>,
4791 pub unique_keys: Option<JsonUniqueKeys>,
4793 pub negated: bool,
4795}
4796
4797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4799#[cfg_attr(feature = "bindings", derive(TS))]
4800pub enum JsonUniqueKeys {
4801 With,
4803 Without,
4805 Shorthand,
4807}
4808
4809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4811#[cfg_attr(feature = "bindings", derive(TS))]
4812pub struct Exists {
4813 pub this: Expression,
4815 pub not: bool,
4817}
4818
4819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4826#[cfg_attr(feature = "bindings", derive(TS))]
4827pub struct Function {
4828 pub name: String,
4830 pub args: Vec<Expression>,
4832 pub distinct: bool,
4834 #[serde(default)]
4835 pub trailing_comments: Vec<String>,
4836 #[serde(default)]
4838 pub use_bracket_syntax: bool,
4839 #[serde(default)]
4841 pub no_parens: bool,
4842 #[serde(default)]
4844 pub quoted: bool,
4845 #[serde(default, skip_serializing_if = "Option::is_none")]
4847 pub span: Option<Span>,
4848 #[serde(default, skip_serializing_if = "Option::is_none")]
4850 pub inferred_type: Option<DataType>,
4851}
4852
4853impl Default for Function {
4854 fn default() -> Self {
4855 Self {
4856 name: String::new(),
4857 args: Vec::new(),
4858 distinct: false,
4859 trailing_comments: Vec::new(),
4860 use_bracket_syntax: false,
4861 no_parens: false,
4862 quoted: false,
4863 span: None,
4864 inferred_type: None,
4865 }
4866 }
4867}
4868
4869impl Function {
4870 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4871 Self {
4872 name: name.into(),
4873 args,
4874 distinct: false,
4875 trailing_comments: Vec::new(),
4876 use_bracket_syntax: false,
4877 no_parens: false,
4878 quoted: false,
4879 span: None,
4880 inferred_type: None,
4881 }
4882 }
4883}
4884
4885#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4892#[cfg_attr(feature = "bindings", derive(TS))]
4893pub struct AggregateFunction {
4894 pub name: String,
4896 pub args: Vec<Expression>,
4898 pub distinct: bool,
4900 pub filter: Option<Expression>,
4902 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4904 pub order_by: Vec<Ordered>,
4905 #[serde(default, skip_serializing_if = "Option::is_none")]
4907 pub limit: Option<Box<Expression>>,
4908 #[serde(default, skip_serializing_if = "Option::is_none")]
4910 pub ignore_nulls: Option<bool>,
4911 #[serde(default, skip_serializing_if = "Option::is_none")]
4913 pub inferred_type: Option<DataType>,
4914}
4915
4916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4923#[cfg_attr(feature = "bindings", derive(TS))]
4924pub struct WindowFunction {
4925 pub this: Expression,
4927 pub over: Over,
4929 #[serde(default, skip_serializing_if = "Option::is_none")]
4931 pub keep: Option<Keep>,
4932 #[serde(default, skip_serializing_if = "Option::is_none")]
4934 pub inferred_type: Option<DataType>,
4935}
4936
4937#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4940#[cfg_attr(feature = "bindings", derive(TS))]
4941pub struct Keep {
4942 pub first: bool,
4944 pub order_by: Vec<Ordered>,
4946}
4947
4948#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4950#[cfg_attr(feature = "bindings", derive(TS))]
4951pub struct WithinGroup {
4952 pub this: Expression,
4954 pub order_by: Vec<Ordered>,
4956}
4957
4958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4963#[cfg_attr(feature = "bindings", derive(TS))]
4964pub struct From {
4965 pub expressions: Vec<Expression>,
4967}
4968
4969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4975#[cfg_attr(feature = "bindings", derive(TS))]
4976pub struct Join {
4977 pub this: Expression,
4979 pub on: Option<Expression>,
4981 pub using: Vec<Identifier>,
4983 pub kind: JoinKind,
4985 pub use_inner_keyword: bool,
4987 pub use_outer_keyword: bool,
4989 pub deferred_condition: bool,
4991 #[serde(default, skip_serializing_if = "Option::is_none")]
4993 pub join_hint: Option<String>,
4994 #[serde(default, skip_serializing_if = "Option::is_none")]
4996 pub match_condition: Option<Expression>,
4997 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4999 pub pivots: Vec<Expression>,
5000 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5002 pub comments: Vec<String>,
5003 #[serde(default)]
5007 pub nesting_group: usize,
5008 #[serde(default)]
5010 pub directed: bool,
5011}
5012
5013#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5020#[cfg_attr(feature = "bindings", derive(TS))]
5021pub enum JoinKind {
5022 Inner,
5023 Left,
5024 Right,
5025 Full,
5026 Outer, Cross,
5028 Natural,
5029 NaturalLeft,
5030 NaturalRight,
5031 NaturalFull,
5032 Semi,
5033 Anti,
5034 LeftSemi,
5036 LeftAnti,
5037 RightSemi,
5038 RightAnti,
5039 CrossApply,
5041 OuterApply,
5042 AsOf,
5044 AsOfLeft,
5045 AsOfRight,
5046 Lateral,
5048 LeftLateral,
5049 Straight,
5051 Implicit,
5053 Array,
5055 LeftArray,
5056 Paste,
5058 Positional,
5060}
5061
5062impl Default for JoinKind {
5063 fn default() -> Self {
5064 JoinKind::Inner
5065 }
5066}
5067
5068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5071#[cfg_attr(feature = "bindings", derive(TS))]
5072pub struct JoinedTable {
5073 pub left: Expression,
5075 pub joins: Vec<Join>,
5077 pub lateral_views: Vec<LateralView>,
5079 pub alias: Option<Identifier>,
5081}
5082
5083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5085#[cfg_attr(feature = "bindings", derive(TS))]
5086pub struct Where {
5087 pub this: Expression,
5089}
5090
5091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5096#[cfg_attr(feature = "bindings", derive(TS))]
5097pub struct GroupBy {
5098 pub expressions: Vec<Expression>,
5100 #[serde(default)]
5102 pub all: Option<bool>,
5103 #[serde(default)]
5105 pub totals: bool,
5106 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5108 pub comments: Vec<String>,
5109}
5110
5111#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5113#[cfg_attr(feature = "bindings", derive(TS))]
5114pub struct Having {
5115 pub this: Expression,
5117 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5119 pub comments: Vec<String>,
5120}
5121
5122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5124#[cfg_attr(feature = "bindings", derive(TS))]
5125pub struct OrderBy {
5126 pub expressions: Vec<Ordered>,
5128 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5130 pub siblings: bool,
5131 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5133 pub comments: Vec<String>,
5134}
5135
5136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5143#[cfg_attr(feature = "bindings", derive(TS))]
5144pub struct Ordered {
5145 pub this: Expression,
5147 pub desc: bool,
5149 pub nulls_first: Option<bool>,
5151 #[serde(default)]
5153 pub explicit_asc: bool,
5154 #[serde(default, skip_serializing_if = "Option::is_none")]
5156 pub with_fill: Option<Box<WithFill>>,
5157}
5158
5159impl Ordered {
5160 pub fn asc(expr: Expression) -> Self {
5161 Self {
5162 this: expr,
5163 desc: false,
5164 nulls_first: None,
5165 explicit_asc: false,
5166 with_fill: None,
5167 }
5168 }
5169
5170 pub fn desc(expr: Expression) -> Self {
5171 Self {
5172 this: expr,
5173 desc: true,
5174 nulls_first: None,
5175 explicit_asc: false,
5176 with_fill: None,
5177 }
5178 }
5179}
5180
5181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5184#[cfg_attr(feature = "bindings", derive(TS))]
5185#[cfg_attr(feature = "bindings", ts(export))]
5186pub struct DistributeBy {
5187 pub expressions: Vec<Expression>,
5188}
5189
5190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5193#[cfg_attr(feature = "bindings", derive(TS))]
5194#[cfg_attr(feature = "bindings", ts(export))]
5195pub struct ClusterBy {
5196 pub expressions: Vec<Ordered>,
5197}
5198
5199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5202#[cfg_attr(feature = "bindings", derive(TS))]
5203#[cfg_attr(feature = "bindings", ts(export))]
5204pub struct SortBy {
5205 pub expressions: Vec<Ordered>,
5206}
5207
5208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5211#[cfg_attr(feature = "bindings", derive(TS))]
5212#[cfg_attr(feature = "bindings", ts(export))]
5213pub struct LateralView {
5214 pub this: Expression,
5216 pub table_alias: Option<Identifier>,
5218 pub column_aliases: Vec<Identifier>,
5220 pub outer: bool,
5222}
5223
5224#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5226#[cfg_attr(feature = "bindings", derive(TS))]
5227#[cfg_attr(feature = "bindings", ts(export))]
5228pub struct Hint {
5229 pub expressions: Vec<HintExpression>,
5230}
5231
5232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5234#[cfg_attr(feature = "bindings", derive(TS))]
5235#[cfg_attr(feature = "bindings", ts(export))]
5236pub enum HintExpression {
5237 Function { name: String, args: Vec<Expression> },
5239 Identifier(String),
5241 Raw(String),
5243}
5244
5245#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5247#[cfg_attr(feature = "bindings", derive(TS))]
5248#[cfg_attr(feature = "bindings", ts(export))]
5249pub enum PseudocolumnType {
5250 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5257
5258impl PseudocolumnType {
5259 pub fn as_str(&self) -> &'static str {
5260 match self {
5261 PseudocolumnType::Rownum => "ROWNUM",
5262 PseudocolumnType::Rowid => "ROWID",
5263 PseudocolumnType::Level => "LEVEL",
5264 PseudocolumnType::Sysdate => "SYSDATE",
5265 PseudocolumnType::ObjectId => "OBJECT_ID",
5266 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5267 }
5268 }
5269
5270 pub fn from_str(s: &str) -> Option<Self> {
5271 match s.to_uppercase().as_str() {
5272 "ROWNUM" => Some(PseudocolumnType::Rownum),
5273 "ROWID" => Some(PseudocolumnType::Rowid),
5274 "LEVEL" => Some(PseudocolumnType::Level),
5275 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5276 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5277 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5278 _ => None,
5279 }
5280 }
5281}
5282
5283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5286#[cfg_attr(feature = "bindings", derive(TS))]
5287#[cfg_attr(feature = "bindings", ts(export))]
5288pub struct Pseudocolumn {
5289 pub kind: PseudocolumnType,
5290}
5291
5292impl Pseudocolumn {
5293 pub fn rownum() -> Self {
5294 Self {
5295 kind: PseudocolumnType::Rownum,
5296 }
5297 }
5298
5299 pub fn rowid() -> Self {
5300 Self {
5301 kind: PseudocolumnType::Rowid,
5302 }
5303 }
5304
5305 pub fn level() -> Self {
5306 Self {
5307 kind: PseudocolumnType::Level,
5308 }
5309 }
5310}
5311
5312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5314#[cfg_attr(feature = "bindings", derive(TS))]
5315#[cfg_attr(feature = "bindings", ts(export))]
5316pub struct Connect {
5317 pub start: Option<Expression>,
5319 pub connect: Expression,
5321 pub nocycle: bool,
5323}
5324
5325#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5327#[cfg_attr(feature = "bindings", derive(TS))]
5328#[cfg_attr(feature = "bindings", ts(export))]
5329pub struct Prior {
5330 pub this: Expression,
5331}
5332
5333#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5335#[cfg_attr(feature = "bindings", derive(TS))]
5336#[cfg_attr(feature = "bindings", ts(export))]
5337pub struct ConnectByRoot {
5338 pub this: Expression,
5339}
5340
5341#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5343#[cfg_attr(feature = "bindings", derive(TS))]
5344#[cfg_attr(feature = "bindings", ts(export))]
5345pub struct MatchRecognize {
5346 pub this: Option<Box<Expression>>,
5348 pub partition_by: Option<Vec<Expression>>,
5350 pub order_by: Option<Vec<Ordered>>,
5352 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5354 pub rows: Option<MatchRecognizeRows>,
5356 pub after: Option<MatchRecognizeAfter>,
5358 pub pattern: Option<String>,
5360 pub define: Option<Vec<(Identifier, Expression)>>,
5362 pub alias: Option<Identifier>,
5364 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5366 pub alias_explicit_as: bool,
5367}
5368
5369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5371#[cfg_attr(feature = "bindings", derive(TS))]
5372#[cfg_attr(feature = "bindings", ts(export))]
5373pub struct MatchRecognizeMeasure {
5374 pub this: Expression,
5376 pub window_frame: Option<MatchRecognizeSemantics>,
5378}
5379
5380#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5382#[cfg_attr(feature = "bindings", derive(TS))]
5383#[cfg_attr(feature = "bindings", ts(export))]
5384pub enum MatchRecognizeSemantics {
5385 Running,
5386 Final,
5387}
5388
5389#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5391#[cfg_attr(feature = "bindings", derive(TS))]
5392#[cfg_attr(feature = "bindings", ts(export))]
5393pub enum MatchRecognizeRows {
5394 OneRowPerMatch,
5395 AllRowsPerMatch,
5396 AllRowsPerMatchShowEmptyMatches,
5397 AllRowsPerMatchOmitEmptyMatches,
5398 AllRowsPerMatchWithUnmatchedRows,
5399}
5400
5401#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5403#[cfg_attr(feature = "bindings", derive(TS))]
5404#[cfg_attr(feature = "bindings", ts(export))]
5405pub enum MatchRecognizeAfter {
5406 PastLastRow,
5407 ToNextRow,
5408 ToFirst(Identifier),
5409 ToLast(Identifier),
5410}
5411
5412#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5414#[cfg_attr(feature = "bindings", derive(TS))]
5415pub struct Limit {
5416 pub this: Expression,
5418 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5420 pub percent: bool,
5421 #[serde(default)]
5423 #[serde(skip_serializing_if = "Vec::is_empty")]
5424 pub comments: Vec<String>,
5425}
5426
5427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5429#[cfg_attr(feature = "bindings", derive(TS))]
5430pub struct Offset {
5431 pub this: Expression,
5432 #[serde(skip_serializing_if = "Option::is_none", default)]
5434 pub rows: Option<bool>,
5435}
5436
5437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5439#[cfg_attr(feature = "bindings", derive(TS))]
5440pub struct Top {
5441 pub this: Expression,
5442 pub percent: bool,
5443 pub with_ties: bool,
5444 #[serde(default)]
5446 pub parenthesized: bool,
5447}
5448
5449#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5451#[cfg_attr(feature = "bindings", derive(TS))]
5452pub struct Fetch {
5453 pub direction: String,
5455 pub count: Option<Expression>,
5457 pub percent: bool,
5459 pub rows: bool,
5461 pub with_ties: bool,
5463}
5464
5465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5471#[cfg_attr(feature = "bindings", derive(TS))]
5472pub struct Qualify {
5473 pub this: Expression,
5475}
5476
5477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5479#[cfg_attr(feature = "bindings", derive(TS))]
5480pub struct Sample {
5481 pub method: SampleMethod,
5482 pub size: Expression,
5483 pub seed: Option<Expression>,
5484 #[serde(default)]
5486 pub offset: Option<Expression>,
5487 pub unit_after_size: bool,
5489 #[serde(default)]
5491 pub use_sample_keyword: bool,
5492 #[serde(default)]
5494 pub explicit_method: bool,
5495 #[serde(default)]
5497 pub method_before_size: bool,
5498 #[serde(default)]
5500 pub use_seed_keyword: bool,
5501 pub bucket_numerator: Option<Box<Expression>>,
5503 pub bucket_denominator: Option<Box<Expression>>,
5505 pub bucket_field: Option<Box<Expression>>,
5507 #[serde(default)]
5509 pub is_using_sample: bool,
5510 #[serde(default)]
5512 pub is_percent: bool,
5513 #[serde(default)]
5515 pub suppress_method_output: bool,
5516}
5517
5518#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5520#[cfg_attr(feature = "bindings", derive(TS))]
5521pub enum SampleMethod {
5522 Bernoulli,
5523 System,
5524 Block,
5525 Row,
5526 Percent,
5527 Bucket,
5529 Reservoir,
5531}
5532
5533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5535#[cfg_attr(feature = "bindings", derive(TS))]
5536pub struct NamedWindow {
5537 pub name: Identifier,
5538 pub spec: Over,
5539}
5540
5541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5547#[cfg_attr(feature = "bindings", derive(TS))]
5548pub struct With {
5549 pub ctes: Vec<Cte>,
5551 pub recursive: bool,
5553 #[serde(default)]
5555 pub leading_comments: Vec<String>,
5556 #[serde(default, skip_serializing_if = "Option::is_none")]
5558 pub search: Option<Box<Expression>>,
5559}
5560
5561#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5568#[cfg_attr(feature = "bindings", derive(TS))]
5569pub struct Cte {
5570 pub alias: Identifier,
5572 pub this: Expression,
5574 pub columns: Vec<Identifier>,
5576 pub materialized: Option<bool>,
5578 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5580 pub key_expressions: Vec<Identifier>,
5581 #[serde(default)]
5583 pub alias_first: bool,
5584 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5586 pub comments: Vec<String>,
5587}
5588
5589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5591#[cfg_attr(feature = "bindings", derive(TS))]
5592pub struct WindowSpec {
5593 pub partition_by: Vec<Expression>,
5594 pub order_by: Vec<Ordered>,
5595 pub frame: Option<WindowFrame>,
5596}
5597
5598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5600#[cfg_attr(feature = "bindings", derive(TS))]
5601pub struct Over {
5602 pub window_name: Option<Identifier>,
5604 pub partition_by: Vec<Expression>,
5605 pub order_by: Vec<Ordered>,
5606 pub frame: Option<WindowFrame>,
5607 pub alias: Option<Identifier>,
5608}
5609
5610#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5612#[cfg_attr(feature = "bindings", derive(TS))]
5613pub struct WindowFrame {
5614 pub kind: WindowFrameKind,
5615 pub start: WindowFrameBound,
5616 pub end: Option<WindowFrameBound>,
5617 pub exclude: Option<WindowFrameExclude>,
5618 #[serde(default, skip_serializing_if = "Option::is_none")]
5620 pub kind_text: Option<String>,
5621 #[serde(default, skip_serializing_if = "Option::is_none")]
5623 pub start_side_text: Option<String>,
5624 #[serde(default, skip_serializing_if = "Option::is_none")]
5626 pub end_side_text: Option<String>,
5627}
5628
5629#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5630#[cfg_attr(feature = "bindings", derive(TS))]
5631pub enum WindowFrameKind {
5632 Rows,
5633 Range,
5634 Groups,
5635}
5636
5637#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5639#[cfg_attr(feature = "bindings", derive(TS))]
5640pub enum WindowFrameExclude {
5641 CurrentRow,
5642 Group,
5643 Ties,
5644 NoOthers,
5645}
5646
5647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5648#[cfg_attr(feature = "bindings", derive(TS))]
5649pub enum WindowFrameBound {
5650 CurrentRow,
5651 UnboundedPreceding,
5652 UnboundedFollowing,
5653 Preceding(Box<Expression>),
5654 Following(Box<Expression>),
5655 BarePreceding,
5657 BareFollowing,
5659 Value(Box<Expression>),
5661}
5662
5663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5665#[cfg_attr(feature = "bindings", derive(TS))]
5666pub struct StructField {
5667 pub name: String,
5668 pub data_type: DataType,
5669 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5670 pub options: Vec<Expression>,
5671 #[serde(default, skip_serializing_if = "Option::is_none")]
5672 pub comment: Option<String>,
5673}
5674
5675impl StructField {
5676 pub fn new(name: String, data_type: DataType) -> Self {
5678 Self {
5679 name,
5680 data_type,
5681 options: Vec::new(),
5682 comment: None,
5683 }
5684 }
5685
5686 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5688 Self {
5689 name,
5690 data_type,
5691 options,
5692 comment: None,
5693 }
5694 }
5695
5696 pub fn with_options_and_comment(
5698 name: String,
5699 data_type: DataType,
5700 options: Vec<Expression>,
5701 comment: Option<String>,
5702 ) -> Self {
5703 Self {
5704 name,
5705 data_type,
5706 options,
5707 comment,
5708 }
5709 }
5710}
5711
5712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5724#[cfg_attr(feature = "bindings", derive(TS))]
5725#[serde(tag = "data_type", rename_all = "snake_case")]
5726pub enum DataType {
5727 Boolean,
5729 TinyInt {
5730 length: Option<u32>,
5731 },
5732 SmallInt {
5733 length: Option<u32>,
5734 },
5735 Int {
5739 length: Option<u32>,
5740 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5741 integer_spelling: bool,
5742 },
5743 BigInt {
5744 length: Option<u32>,
5745 },
5746 Float {
5750 precision: Option<u32>,
5751 scale: Option<u32>,
5752 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5753 real_spelling: bool,
5754 },
5755 Double {
5756 precision: Option<u32>,
5757 scale: Option<u32>,
5758 },
5759 Decimal {
5760 precision: Option<u32>,
5761 scale: Option<u32>,
5762 },
5763
5764 Char {
5766 length: Option<u32>,
5767 },
5768 VarChar {
5771 length: Option<u32>,
5772 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5773 parenthesized_length: bool,
5774 },
5775 String {
5777 length: Option<u32>,
5778 },
5779 Text,
5780 TextWithLength {
5782 length: u32,
5783 },
5784
5785 Binary {
5787 length: Option<u32>,
5788 },
5789 VarBinary {
5790 length: Option<u32>,
5791 },
5792 Blob,
5793
5794 Bit {
5796 length: Option<u32>,
5797 },
5798 VarBit {
5799 length: Option<u32>,
5800 },
5801
5802 Date,
5804 Time {
5805 precision: Option<u32>,
5806 #[serde(default)]
5807 timezone: bool,
5808 },
5809 Timestamp {
5810 precision: Option<u32>,
5811 timezone: bool,
5812 },
5813 Interval {
5814 unit: Option<String>,
5815 #[serde(default, skip_serializing_if = "Option::is_none")]
5817 to: Option<String>,
5818 },
5819
5820 Json,
5822 JsonB,
5823
5824 Uuid,
5826
5827 Array {
5829 element_type: Box<DataType>,
5830 #[serde(default, skip_serializing_if = "Option::is_none")]
5832 dimension: Option<u32>,
5833 },
5834
5835 List {
5838 element_type: Box<DataType>,
5839 },
5840
5841 Struct {
5845 fields: Vec<StructField>,
5846 nested: bool,
5847 },
5848 Map {
5849 key_type: Box<DataType>,
5850 value_type: Box<DataType>,
5851 },
5852
5853 Enum {
5855 values: Vec<String>,
5856 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5857 assignments: Vec<Option<String>>,
5858 },
5859
5860 Set {
5862 values: Vec<String>,
5863 },
5864
5865 Union {
5867 fields: Vec<(String, DataType)>,
5868 },
5869
5870 Vector {
5872 #[serde(default)]
5873 element_type: Option<Box<DataType>>,
5874 dimension: Option<u32>,
5875 },
5876
5877 Object {
5880 fields: Vec<(String, DataType, bool)>,
5881 modifier: Option<String>,
5882 },
5883
5884 Nullable {
5886 inner: Box<DataType>,
5887 },
5888
5889 Custom {
5891 name: String,
5892 },
5893
5894 Geometry {
5896 subtype: Option<String>,
5897 srid: Option<u32>,
5898 },
5899 Geography {
5900 subtype: Option<String>,
5901 srid: Option<u32>,
5902 },
5903
5904 CharacterSet {
5907 name: String,
5908 },
5909
5910 Unknown,
5912}
5913
5914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5916#[cfg_attr(feature = "bindings", derive(TS))]
5917#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5918pub struct Array {
5919 pub expressions: Vec<Expression>,
5920}
5921
5922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5924#[cfg_attr(feature = "bindings", derive(TS))]
5925pub struct Struct {
5926 pub fields: Vec<(Option<String>, Expression)>,
5927}
5928
5929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5931#[cfg_attr(feature = "bindings", derive(TS))]
5932pub struct Tuple {
5933 pub expressions: Vec<Expression>,
5934}
5935
5936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5938#[cfg_attr(feature = "bindings", derive(TS))]
5939pub struct Interval {
5940 pub this: Option<Expression>,
5942 pub unit: Option<IntervalUnitSpec>,
5944}
5945
5946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5948#[cfg_attr(feature = "bindings", derive(TS))]
5949#[serde(tag = "type", rename_all = "snake_case")]
5950pub enum IntervalUnitSpec {
5951 Simple {
5953 unit: IntervalUnit,
5954 use_plural: bool,
5956 },
5957 Span(IntervalSpan),
5959 ExprSpan(IntervalSpanExpr),
5962 Expr(Box<Expression>),
5964}
5965
5966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5968#[cfg_attr(feature = "bindings", derive(TS))]
5969pub struct IntervalSpan {
5970 pub this: IntervalUnit,
5972 pub expression: IntervalUnit,
5974}
5975
5976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5979#[cfg_attr(feature = "bindings", derive(TS))]
5980pub struct IntervalSpanExpr {
5981 pub this: Box<Expression>,
5983 pub expression: Box<Expression>,
5985}
5986
5987#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5988#[cfg_attr(feature = "bindings", derive(TS))]
5989pub enum IntervalUnit {
5990 Year,
5991 Quarter,
5992 Month,
5993 Week,
5994 Day,
5995 Hour,
5996 Minute,
5997 Second,
5998 Millisecond,
5999 Microsecond,
6000 Nanosecond,
6001}
6002
6003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6005#[cfg_attr(feature = "bindings", derive(TS))]
6006pub struct Command {
6007 pub this: String,
6009}
6010
6011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6013#[cfg_attr(feature = "bindings", derive(TS))]
6014pub struct TryCatch {
6015 #[serde(default)]
6017 pub try_body: Vec<Expression>,
6018 #[serde(default, skip_serializing_if = "Option::is_none")]
6020 pub catch_body: Option<Vec<Expression>>,
6021}
6022
6023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6026#[cfg_attr(feature = "bindings", derive(TS))]
6027pub struct ExecuteStatement {
6028 pub this: Expression,
6030 #[serde(default)]
6032 pub parameters: Vec<ExecuteParameter>,
6033 #[serde(default, skip_serializing_if = "Option::is_none")]
6035 pub suffix: Option<String>,
6036}
6037
6038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6040#[cfg_attr(feature = "bindings", derive(TS))]
6041pub struct ExecuteParameter {
6042 pub name: String,
6044 pub value: Expression,
6046 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6048 pub positional: bool,
6049 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6051 pub output: bool,
6052}
6053
6054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6057#[cfg_attr(feature = "bindings", derive(TS))]
6058pub struct Kill {
6059 pub this: Expression,
6061 pub kind: Option<String>,
6063}
6064
6065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6067#[cfg_attr(feature = "bindings", derive(TS))]
6068pub struct CreateTask {
6069 pub or_replace: bool,
6070 pub if_not_exists: bool,
6071 pub name: String,
6073 pub properties: String,
6075 pub body: Expression,
6077}
6078
6079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6081#[cfg_attr(feature = "bindings", derive(TS))]
6082pub struct Raw {
6083 pub sql: String,
6084}
6085
6086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6092#[cfg_attr(feature = "bindings", derive(TS))]
6093pub struct UnaryFunc {
6094 pub this: Expression,
6095 #[serde(skip_serializing_if = "Option::is_none", default)]
6097 pub original_name: Option<String>,
6098 #[serde(default, skip_serializing_if = "Option::is_none")]
6100 pub inferred_type: Option<DataType>,
6101}
6102
6103impl UnaryFunc {
6104 pub fn new(this: Expression) -> Self {
6106 Self {
6107 this,
6108 original_name: None,
6109 inferred_type: None,
6110 }
6111 }
6112
6113 pub fn with_name(this: Expression, name: String) -> Self {
6115 Self {
6116 this,
6117 original_name: Some(name),
6118 inferred_type: None,
6119 }
6120 }
6121}
6122
6123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6127#[cfg_attr(feature = "bindings", derive(TS))]
6128pub struct CharFunc {
6129 pub args: Vec<Expression>,
6130 #[serde(skip_serializing_if = "Option::is_none", default)]
6131 pub charset: Option<String>,
6132 #[serde(skip_serializing_if = "Option::is_none", default)]
6134 pub name: Option<String>,
6135}
6136
6137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6139#[cfg_attr(feature = "bindings", derive(TS))]
6140pub struct BinaryFunc {
6141 pub this: Expression,
6142 pub expression: Expression,
6143 #[serde(skip_serializing_if = "Option::is_none", default)]
6145 pub original_name: Option<String>,
6146 #[serde(default, skip_serializing_if = "Option::is_none")]
6148 pub inferred_type: Option<DataType>,
6149}
6150
6151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6153#[cfg_attr(feature = "bindings", derive(TS))]
6154pub struct VarArgFunc {
6155 pub expressions: Vec<Expression>,
6156 #[serde(skip_serializing_if = "Option::is_none", default)]
6158 pub original_name: Option<String>,
6159 #[serde(default, skip_serializing_if = "Option::is_none")]
6161 pub inferred_type: Option<DataType>,
6162}
6163
6164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6166#[cfg_attr(feature = "bindings", derive(TS))]
6167pub struct ConcatWs {
6168 pub separator: Expression,
6169 pub expressions: Vec<Expression>,
6170}
6171
6172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6174#[cfg_attr(feature = "bindings", derive(TS))]
6175pub struct SubstringFunc {
6176 pub this: Expression,
6177 pub start: Expression,
6178 pub length: Option<Expression>,
6179 #[serde(default)]
6181 pub from_for_syntax: bool,
6182}
6183
6184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6186#[cfg_attr(feature = "bindings", derive(TS))]
6187pub struct OverlayFunc {
6188 pub this: Expression,
6189 pub replacement: Expression,
6190 pub from: Expression,
6191 pub length: Option<Expression>,
6192}
6193
6194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6196#[cfg_attr(feature = "bindings", derive(TS))]
6197pub struct TrimFunc {
6198 pub this: Expression,
6199 pub characters: Option<Expression>,
6200 pub position: TrimPosition,
6201 #[serde(default)]
6203 pub sql_standard_syntax: bool,
6204 #[serde(default)]
6206 pub position_explicit: bool,
6207}
6208
6209#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6210#[cfg_attr(feature = "bindings", derive(TS))]
6211pub enum TrimPosition {
6212 Both,
6213 Leading,
6214 Trailing,
6215}
6216
6217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6219#[cfg_attr(feature = "bindings", derive(TS))]
6220pub struct ReplaceFunc {
6221 pub this: Expression,
6222 pub old: Expression,
6223 pub new: Expression,
6224}
6225
6226#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6228#[cfg_attr(feature = "bindings", derive(TS))]
6229pub struct LeftRightFunc {
6230 pub this: Expression,
6231 pub length: Expression,
6232}
6233
6234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6236#[cfg_attr(feature = "bindings", derive(TS))]
6237pub struct RepeatFunc {
6238 pub this: Expression,
6239 pub times: Expression,
6240}
6241
6242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6244#[cfg_attr(feature = "bindings", derive(TS))]
6245pub struct PadFunc {
6246 pub this: Expression,
6247 pub length: Expression,
6248 pub fill: Option<Expression>,
6249}
6250
6251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6253#[cfg_attr(feature = "bindings", derive(TS))]
6254pub struct SplitFunc {
6255 pub this: Expression,
6256 pub delimiter: Expression,
6257}
6258
6259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6261#[cfg_attr(feature = "bindings", derive(TS))]
6262pub struct RegexpFunc {
6263 pub this: Expression,
6264 pub pattern: Expression,
6265 pub flags: Option<Expression>,
6266}
6267
6268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6270#[cfg_attr(feature = "bindings", derive(TS))]
6271pub struct RegexpReplaceFunc {
6272 pub this: Expression,
6273 pub pattern: Expression,
6274 pub replacement: Expression,
6275 pub flags: Option<Expression>,
6276}
6277
6278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6280#[cfg_attr(feature = "bindings", derive(TS))]
6281pub struct RegexpExtractFunc {
6282 pub this: Expression,
6283 pub pattern: Expression,
6284 pub group: Option<Expression>,
6285}
6286
6287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6289#[cfg_attr(feature = "bindings", derive(TS))]
6290pub struct RoundFunc {
6291 pub this: Expression,
6292 pub decimals: Option<Expression>,
6293}
6294
6295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6297#[cfg_attr(feature = "bindings", derive(TS))]
6298pub struct FloorFunc {
6299 pub this: Expression,
6300 pub scale: Option<Expression>,
6301 #[serde(skip_serializing_if = "Option::is_none", default)]
6303 pub to: Option<Expression>,
6304}
6305
6306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6308#[cfg_attr(feature = "bindings", derive(TS))]
6309pub struct CeilFunc {
6310 pub this: Expression,
6311 #[serde(skip_serializing_if = "Option::is_none", default)]
6312 pub decimals: Option<Expression>,
6313 #[serde(skip_serializing_if = "Option::is_none", default)]
6315 pub to: Option<Expression>,
6316}
6317
6318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6320#[cfg_attr(feature = "bindings", derive(TS))]
6321pub struct LogFunc {
6322 pub this: Expression,
6323 pub base: Option<Expression>,
6324}
6325
6326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6328#[cfg_attr(feature = "bindings", derive(TS))]
6329pub struct CurrentDate;
6330
6331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6333#[cfg_attr(feature = "bindings", derive(TS))]
6334pub struct CurrentTime {
6335 pub precision: Option<u32>,
6336}
6337
6338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6340#[cfg_attr(feature = "bindings", derive(TS))]
6341pub struct CurrentTimestamp {
6342 pub precision: Option<u32>,
6343 #[serde(default)]
6345 pub sysdate: bool,
6346}
6347
6348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6350#[cfg_attr(feature = "bindings", derive(TS))]
6351pub struct CurrentTimestampLTZ {
6352 pub precision: Option<u32>,
6353}
6354
6355#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6357#[cfg_attr(feature = "bindings", derive(TS))]
6358pub struct AtTimeZone {
6359 pub this: Expression,
6361 pub zone: Expression,
6363}
6364
6365#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6367#[cfg_attr(feature = "bindings", derive(TS))]
6368pub struct DateAddFunc {
6369 pub this: Expression,
6370 pub interval: Expression,
6371 pub unit: IntervalUnit,
6372}
6373
6374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6376#[cfg_attr(feature = "bindings", derive(TS))]
6377pub struct DateDiffFunc {
6378 pub this: Expression,
6379 pub expression: Expression,
6380 pub unit: Option<IntervalUnit>,
6381}
6382
6383#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6385#[cfg_attr(feature = "bindings", derive(TS))]
6386pub struct DateTruncFunc {
6387 pub this: Expression,
6388 pub unit: DateTimeField,
6389}
6390
6391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6393#[cfg_attr(feature = "bindings", derive(TS))]
6394pub struct ExtractFunc {
6395 pub this: Expression,
6396 pub field: DateTimeField,
6397}
6398
6399#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6400#[cfg_attr(feature = "bindings", derive(TS))]
6401pub enum DateTimeField {
6402 Year,
6403 Month,
6404 Day,
6405 Hour,
6406 Minute,
6407 Second,
6408 Millisecond,
6409 Microsecond,
6410 DayOfWeek,
6411 DayOfYear,
6412 Week,
6413 WeekWithModifier(String),
6415 Quarter,
6416 Epoch,
6417 Timezone,
6418 TimezoneHour,
6419 TimezoneMinute,
6420 Date,
6421 Time,
6422 Custom(String),
6424}
6425
6426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6428#[cfg_attr(feature = "bindings", derive(TS))]
6429pub struct ToDateFunc {
6430 pub this: Expression,
6431 pub format: Option<Expression>,
6432}
6433
6434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6436#[cfg_attr(feature = "bindings", derive(TS))]
6437pub struct ToTimestampFunc {
6438 pub this: Expression,
6439 pub format: Option<Expression>,
6440}
6441
6442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6444#[cfg_attr(feature = "bindings", derive(TS))]
6445pub struct IfFunc {
6446 pub condition: Expression,
6447 pub true_value: Expression,
6448 pub false_value: Option<Expression>,
6449 #[serde(skip_serializing_if = "Option::is_none", default)]
6451 pub original_name: Option<String>,
6452 #[serde(default, skip_serializing_if = "Option::is_none")]
6454 pub inferred_type: Option<DataType>,
6455}
6456
6457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6459#[cfg_attr(feature = "bindings", derive(TS))]
6460pub struct Nvl2Func {
6461 pub this: Expression,
6462 pub true_value: Expression,
6463 pub false_value: Expression,
6464 #[serde(default, skip_serializing_if = "Option::is_none")]
6466 pub inferred_type: Option<DataType>,
6467}
6468
6469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6475#[cfg_attr(feature = "bindings", derive(TS))]
6476pub struct AggFunc {
6477 pub this: Expression,
6478 pub distinct: bool,
6479 pub filter: Option<Expression>,
6480 pub order_by: Vec<Ordered>,
6481 #[serde(skip_serializing_if = "Option::is_none", default)]
6483 pub name: Option<String>,
6484 #[serde(skip_serializing_if = "Option::is_none", default)]
6486 pub ignore_nulls: Option<bool>,
6487 #[serde(skip_serializing_if = "Option::is_none", default)]
6490 pub having_max: Option<(Box<Expression>, bool)>,
6491 #[serde(skip_serializing_if = "Option::is_none", default)]
6493 pub limit: Option<Box<Expression>>,
6494 #[serde(default, skip_serializing_if = "Option::is_none")]
6496 pub inferred_type: Option<DataType>,
6497}
6498
6499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6501#[cfg_attr(feature = "bindings", derive(TS))]
6502pub struct CountFunc {
6503 pub this: Option<Expression>,
6504 pub star: bool,
6505 pub distinct: bool,
6506 pub filter: Option<Expression>,
6507 #[serde(default, skip_serializing_if = "Option::is_none")]
6509 pub ignore_nulls: Option<bool>,
6510 #[serde(default, skip_serializing_if = "Option::is_none")]
6512 pub original_name: Option<String>,
6513 #[serde(default, skip_serializing_if = "Option::is_none")]
6515 pub inferred_type: Option<DataType>,
6516}
6517
6518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6520#[cfg_attr(feature = "bindings", derive(TS))]
6521pub struct GroupConcatFunc {
6522 pub this: Expression,
6523 pub separator: Option<Expression>,
6524 pub order_by: Option<Vec<Ordered>>,
6525 pub distinct: bool,
6526 pub filter: Option<Expression>,
6527 #[serde(default, skip_serializing_if = "Option::is_none")]
6529 pub limit: Option<Box<Expression>>,
6530 #[serde(default, skip_serializing_if = "Option::is_none")]
6532 pub inferred_type: Option<DataType>,
6533}
6534
6535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6537#[cfg_attr(feature = "bindings", derive(TS))]
6538pub struct StringAggFunc {
6539 pub this: Expression,
6540 #[serde(default)]
6541 pub separator: Option<Expression>,
6542 #[serde(default)]
6543 pub order_by: Option<Vec<Ordered>>,
6544 #[serde(default)]
6545 pub distinct: bool,
6546 #[serde(default)]
6547 pub filter: Option<Expression>,
6548 #[serde(default, skip_serializing_if = "Option::is_none")]
6550 pub limit: Option<Box<Expression>>,
6551 #[serde(default, skip_serializing_if = "Option::is_none")]
6553 pub inferred_type: Option<DataType>,
6554}
6555
6556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6558#[cfg_attr(feature = "bindings", derive(TS))]
6559pub struct ListAggFunc {
6560 pub this: Expression,
6561 pub separator: Option<Expression>,
6562 pub on_overflow: Option<ListAggOverflow>,
6563 pub order_by: Option<Vec<Ordered>>,
6564 pub distinct: bool,
6565 pub filter: Option<Expression>,
6566 #[serde(default, skip_serializing_if = "Option::is_none")]
6568 pub inferred_type: Option<DataType>,
6569}
6570
6571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6573#[cfg_attr(feature = "bindings", derive(TS))]
6574pub enum ListAggOverflow {
6575 Error,
6576 Truncate {
6577 filler: Option<Expression>,
6578 with_count: bool,
6579 },
6580}
6581
6582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6584#[cfg_attr(feature = "bindings", derive(TS))]
6585pub struct SumIfFunc {
6586 pub this: Expression,
6587 pub condition: Expression,
6588 pub filter: Option<Expression>,
6589 #[serde(default, skip_serializing_if = "Option::is_none")]
6591 pub inferred_type: Option<DataType>,
6592}
6593
6594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6596#[cfg_attr(feature = "bindings", derive(TS))]
6597pub struct ApproxPercentileFunc {
6598 pub this: Expression,
6599 pub percentile: Expression,
6600 pub accuracy: Option<Expression>,
6601 pub filter: Option<Expression>,
6602}
6603
6604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6606#[cfg_attr(feature = "bindings", derive(TS))]
6607pub struct PercentileFunc {
6608 pub this: Expression,
6609 pub percentile: Expression,
6610 pub order_by: Option<Vec<Ordered>>,
6611 pub filter: Option<Expression>,
6612}
6613
6614#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6620#[cfg_attr(feature = "bindings", derive(TS))]
6621pub struct RowNumber;
6622
6623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6625#[cfg_attr(feature = "bindings", derive(TS))]
6626pub struct Rank {
6627 #[serde(default, skip_serializing_if = "Option::is_none")]
6629 pub order_by: Option<Vec<Ordered>>,
6630 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6632 pub args: Vec<Expression>,
6633}
6634
6635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6637#[cfg_attr(feature = "bindings", derive(TS))]
6638pub struct DenseRank {
6639 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6641 pub args: Vec<Expression>,
6642}
6643
6644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6646#[cfg_attr(feature = "bindings", derive(TS))]
6647pub struct NTileFunc {
6648 #[serde(default, skip_serializing_if = "Option::is_none")]
6650 pub num_buckets: Option<Expression>,
6651 #[serde(default, skip_serializing_if = "Option::is_none")]
6653 pub order_by: Option<Vec<Ordered>>,
6654}
6655
6656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6658#[cfg_attr(feature = "bindings", derive(TS))]
6659pub struct LeadLagFunc {
6660 pub this: Expression,
6661 pub offset: Option<Expression>,
6662 pub default: Option<Expression>,
6663 #[serde(default, skip_serializing_if = "Option::is_none")]
6665 pub ignore_nulls: Option<bool>,
6666}
6667
6668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6670#[cfg_attr(feature = "bindings", derive(TS))]
6671pub struct ValueFunc {
6672 pub this: Expression,
6673 #[serde(default, skip_serializing_if = "Option::is_none")]
6675 pub ignore_nulls: Option<bool>,
6676 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6678 pub order_by: Vec<Ordered>,
6679}
6680
6681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6683#[cfg_attr(feature = "bindings", derive(TS))]
6684pub struct NthValueFunc {
6685 pub this: Expression,
6686 pub offset: Expression,
6687 #[serde(default, skip_serializing_if = "Option::is_none")]
6689 pub ignore_nulls: Option<bool>,
6690 #[serde(default, skip_serializing_if = "Option::is_none")]
6693 pub from_first: Option<bool>,
6694}
6695
6696#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6698#[cfg_attr(feature = "bindings", derive(TS))]
6699pub struct PercentRank {
6700 #[serde(default, skip_serializing_if = "Option::is_none")]
6702 pub order_by: Option<Vec<Ordered>>,
6703 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6705 pub args: Vec<Expression>,
6706}
6707
6708#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6710#[cfg_attr(feature = "bindings", derive(TS))]
6711pub struct CumeDist {
6712 #[serde(default, skip_serializing_if = "Option::is_none")]
6714 pub order_by: Option<Vec<Ordered>>,
6715 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6717 pub args: Vec<Expression>,
6718}
6719
6720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6726#[cfg_attr(feature = "bindings", derive(TS))]
6727pub struct PositionFunc {
6728 pub substring: Expression,
6729 pub string: Expression,
6730 pub start: Option<Expression>,
6731}
6732
6733#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6739#[cfg_attr(feature = "bindings", derive(TS))]
6740pub struct Random;
6741
6742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6744#[cfg_attr(feature = "bindings", derive(TS))]
6745pub struct Rand {
6746 pub seed: Option<Box<Expression>>,
6747 #[serde(default)]
6749 pub lower: Option<Box<Expression>>,
6750 #[serde(default)]
6752 pub upper: Option<Box<Expression>>,
6753}
6754
6755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6757#[cfg_attr(feature = "bindings", derive(TS))]
6758pub struct TruncateFunc {
6759 pub this: Expression,
6760 pub decimals: Option<Expression>,
6761}
6762
6763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6765#[cfg_attr(feature = "bindings", derive(TS))]
6766pub struct Pi;
6767
6768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6774#[cfg_attr(feature = "bindings", derive(TS))]
6775pub struct DecodeFunc {
6776 pub this: Expression,
6777 pub search_results: Vec<(Expression, Expression)>,
6778 pub default: Option<Expression>,
6779}
6780
6781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6787#[cfg_attr(feature = "bindings", derive(TS))]
6788pub struct DateFormatFunc {
6789 pub this: Expression,
6790 pub format: Expression,
6791}
6792
6793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6795#[cfg_attr(feature = "bindings", derive(TS))]
6796pub struct FromUnixtimeFunc {
6797 pub this: Expression,
6798 pub format: Option<Expression>,
6799}
6800
6801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6803#[cfg_attr(feature = "bindings", derive(TS))]
6804pub struct UnixTimestampFunc {
6805 pub this: Option<Expression>,
6806 pub format: Option<Expression>,
6807}
6808
6809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6811#[cfg_attr(feature = "bindings", derive(TS))]
6812pub struct MakeDateFunc {
6813 pub year: Expression,
6814 pub month: Expression,
6815 pub day: Expression,
6816}
6817
6818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6820#[cfg_attr(feature = "bindings", derive(TS))]
6821pub struct MakeTimestampFunc {
6822 pub year: Expression,
6823 pub month: Expression,
6824 pub day: Expression,
6825 pub hour: Expression,
6826 pub minute: Expression,
6827 pub second: Expression,
6828 pub timezone: Option<Expression>,
6829}
6830
6831#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6833#[cfg_attr(feature = "bindings", derive(TS))]
6834pub struct LastDayFunc {
6835 pub this: Expression,
6836 #[serde(skip_serializing_if = "Option::is_none", default)]
6838 pub unit: Option<DateTimeField>,
6839}
6840
6841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6847#[cfg_attr(feature = "bindings", derive(TS))]
6848pub struct ArrayConstructor {
6849 pub expressions: Vec<Expression>,
6850 pub bracket_notation: bool,
6851 pub use_list_keyword: bool,
6853}
6854
6855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6857#[cfg_attr(feature = "bindings", derive(TS))]
6858pub struct ArraySortFunc {
6859 pub this: Expression,
6860 pub comparator: Option<Expression>,
6861 pub desc: bool,
6862 pub nulls_first: Option<bool>,
6863}
6864
6865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6867#[cfg_attr(feature = "bindings", derive(TS))]
6868pub struct ArrayJoinFunc {
6869 pub this: Expression,
6870 pub separator: Expression,
6871 pub null_replacement: Option<Expression>,
6872}
6873
6874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6876#[cfg_attr(feature = "bindings", derive(TS))]
6877pub struct UnnestFunc {
6878 pub this: Expression,
6879 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6881 pub expressions: Vec<Expression>,
6882 pub with_ordinality: bool,
6883 pub alias: Option<Identifier>,
6884 #[serde(default, skip_serializing_if = "Option::is_none")]
6886 pub offset_alias: Option<Identifier>,
6887}
6888
6889#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6891#[cfg_attr(feature = "bindings", derive(TS))]
6892pub struct ArrayFilterFunc {
6893 pub this: Expression,
6894 pub filter: Expression,
6895}
6896
6897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6899#[cfg_attr(feature = "bindings", derive(TS))]
6900pub struct ArrayTransformFunc {
6901 pub this: Expression,
6902 pub transform: Expression,
6903}
6904
6905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6907#[cfg_attr(feature = "bindings", derive(TS))]
6908pub struct SequenceFunc {
6909 pub start: Expression,
6910 pub stop: Expression,
6911 pub step: Option<Expression>,
6912}
6913
6914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6920#[cfg_attr(feature = "bindings", derive(TS))]
6921pub struct StructConstructor {
6922 pub fields: Vec<(Option<Identifier>, Expression)>,
6923}
6924
6925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6927#[cfg_attr(feature = "bindings", derive(TS))]
6928pub struct StructExtractFunc {
6929 pub this: Expression,
6930 pub field: Identifier,
6931}
6932
6933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6935#[cfg_attr(feature = "bindings", derive(TS))]
6936pub struct NamedStructFunc {
6937 pub pairs: Vec<(Expression, Expression)>,
6938}
6939
6940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6946#[cfg_attr(feature = "bindings", derive(TS))]
6947pub struct MapConstructor {
6948 pub keys: Vec<Expression>,
6949 pub values: Vec<Expression>,
6950 #[serde(default)]
6952 pub curly_brace_syntax: bool,
6953 #[serde(default)]
6955 pub with_map_keyword: bool,
6956}
6957
6958#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6960#[cfg_attr(feature = "bindings", derive(TS))]
6961pub struct TransformFunc {
6962 pub this: Expression,
6963 pub transform: Expression,
6964}
6965
6966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6969#[cfg_attr(feature = "bindings", derive(TS))]
6970pub struct FunctionEmits {
6971 pub this: Expression,
6973 pub emits: Expression,
6975}
6976
6977#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6983#[cfg_attr(feature = "bindings", derive(TS))]
6984pub struct JsonExtractFunc {
6985 pub this: Expression,
6986 pub path: Expression,
6987 pub returning: Option<DataType>,
6988 #[serde(default)]
6990 pub arrow_syntax: bool,
6991 #[serde(default)]
6993 pub hash_arrow_syntax: bool,
6994 #[serde(default)]
6996 pub wrapper_option: Option<String>,
6997 #[serde(default)]
6999 pub quotes_option: Option<String>,
7000 #[serde(default)]
7002 pub on_scalar_string: bool,
7003 #[serde(default)]
7005 pub on_error: Option<String>,
7006}
7007
7008#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7010#[cfg_attr(feature = "bindings", derive(TS))]
7011pub struct JsonPathFunc {
7012 pub this: Expression,
7013 pub paths: Vec<Expression>,
7014}
7015
7016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7018#[cfg_attr(feature = "bindings", derive(TS))]
7019pub struct JsonObjectFunc {
7020 pub pairs: Vec<(Expression, Expression)>,
7021 pub null_handling: Option<JsonNullHandling>,
7022 #[serde(default)]
7023 pub with_unique_keys: bool,
7024 #[serde(default)]
7025 pub returning_type: Option<DataType>,
7026 #[serde(default)]
7027 pub format_json: bool,
7028 #[serde(default)]
7029 pub encoding: Option<String>,
7030 #[serde(default)]
7032 pub star: bool,
7033}
7034
7035#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7037#[cfg_attr(feature = "bindings", derive(TS))]
7038pub enum JsonNullHandling {
7039 NullOnNull,
7040 AbsentOnNull,
7041}
7042
7043#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7045#[cfg_attr(feature = "bindings", derive(TS))]
7046pub struct JsonModifyFunc {
7047 pub this: Expression,
7048 pub path_values: Vec<(Expression, Expression)>,
7049}
7050
7051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7053#[cfg_attr(feature = "bindings", derive(TS))]
7054pub struct JsonArrayAggFunc {
7055 pub this: Expression,
7056 pub order_by: Option<Vec<Ordered>>,
7057 pub null_handling: Option<JsonNullHandling>,
7058 pub filter: Option<Expression>,
7059}
7060
7061#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7063#[cfg_attr(feature = "bindings", derive(TS))]
7064pub struct JsonObjectAggFunc {
7065 pub key: Expression,
7066 pub value: Expression,
7067 pub null_handling: Option<JsonNullHandling>,
7068 pub filter: Option<Expression>,
7069}
7070
7071#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7077#[cfg_attr(feature = "bindings", derive(TS))]
7078pub struct ConvertFunc {
7079 pub this: Expression,
7080 pub to: DataType,
7081 pub style: Option<Expression>,
7082}
7083
7084#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7090#[cfg_attr(feature = "bindings", derive(TS))]
7091pub struct LambdaExpr {
7092 pub parameters: Vec<Identifier>,
7093 pub body: Expression,
7094 #[serde(default)]
7096 pub colon: bool,
7097 #[serde(default)]
7100 pub parameter_types: Vec<Option<DataType>>,
7101}
7102
7103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7105#[cfg_attr(feature = "bindings", derive(TS))]
7106pub struct Parameter {
7107 pub name: Option<String>,
7108 pub index: Option<u32>,
7109 pub style: ParameterStyle,
7110 #[serde(default)]
7112 pub quoted: bool,
7113 #[serde(default)]
7115 pub string_quoted: bool,
7116 #[serde(default)]
7118 pub expression: Option<String>,
7119}
7120
7121#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7123#[cfg_attr(feature = "bindings", derive(TS))]
7124pub enum ParameterStyle {
7125 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7135
7136#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7138#[cfg_attr(feature = "bindings", derive(TS))]
7139pub struct Placeholder {
7140 pub index: Option<u32>,
7141}
7142
7143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7145#[cfg_attr(feature = "bindings", derive(TS))]
7146pub struct NamedArgument {
7147 pub name: Identifier,
7148 pub value: Expression,
7149 pub separator: NamedArgSeparator,
7151}
7152
7153#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7155#[cfg_attr(feature = "bindings", derive(TS))]
7156pub enum NamedArgSeparator {
7157 DArrow,
7159 ColonEq,
7161 Eq,
7163}
7164
7165#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7168#[cfg_attr(feature = "bindings", derive(TS))]
7169pub struct TableArgument {
7170 pub prefix: String,
7172 pub this: Expression,
7174}
7175
7176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7178#[cfg_attr(feature = "bindings", derive(TS))]
7179pub struct SqlComment {
7180 pub text: String,
7181 pub is_block: bool,
7182}
7183
7184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7190#[cfg_attr(feature = "bindings", derive(TS))]
7191pub struct SimilarToExpr {
7192 pub this: Expression,
7193 pub pattern: Expression,
7194 pub escape: Option<Expression>,
7195 pub not: bool,
7196}
7197
7198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7200#[cfg_attr(feature = "bindings", derive(TS))]
7201pub struct QuantifiedExpr {
7202 pub this: Expression,
7203 pub subquery: Expression,
7204 pub op: Option<QuantifiedOp>,
7205}
7206
7207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7209#[cfg_attr(feature = "bindings", derive(TS))]
7210pub enum QuantifiedOp {
7211 Eq,
7212 Neq,
7213 Lt,
7214 Lte,
7215 Gt,
7216 Gte,
7217}
7218
7219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7224#[cfg_attr(feature = "bindings", derive(TS))]
7225pub struct OverlapsExpr {
7226 #[serde(skip_serializing_if = "Option::is_none")]
7228 pub this: Option<Expression>,
7229 #[serde(skip_serializing_if = "Option::is_none")]
7231 pub expression: Option<Expression>,
7232 #[serde(skip_serializing_if = "Option::is_none")]
7234 pub left_start: Option<Expression>,
7235 #[serde(skip_serializing_if = "Option::is_none")]
7237 pub left_end: Option<Expression>,
7238 #[serde(skip_serializing_if = "Option::is_none")]
7240 pub right_start: Option<Expression>,
7241 #[serde(skip_serializing_if = "Option::is_none")]
7243 pub right_end: Option<Expression>,
7244}
7245
7246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7252#[cfg_attr(feature = "bindings", derive(TS))]
7253pub struct Subscript {
7254 pub this: Expression,
7255 pub index: Expression,
7256}
7257
7258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7260#[cfg_attr(feature = "bindings", derive(TS))]
7261pub struct DotAccess {
7262 pub this: Expression,
7263 pub field: Identifier,
7264}
7265
7266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7268#[cfg_attr(feature = "bindings", derive(TS))]
7269pub struct MethodCall {
7270 pub this: Expression,
7271 pub method: Identifier,
7272 pub args: Vec<Expression>,
7273}
7274
7275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7277#[cfg_attr(feature = "bindings", derive(TS))]
7278pub struct ArraySlice {
7279 pub this: Expression,
7280 pub start: Option<Expression>,
7281 pub end: Option<Expression>,
7282}
7283
7284#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7290#[cfg_attr(feature = "bindings", derive(TS))]
7291pub enum OnCommit {
7292 PreserveRows,
7294 DeleteRows,
7296}
7297
7298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7300#[cfg_attr(feature = "bindings", derive(TS))]
7301pub struct CreateTable {
7302 pub name: TableRef,
7303 #[serde(default, skip_serializing_if = "Option::is_none")]
7305 pub on_cluster: Option<OnCluster>,
7306 pub columns: Vec<ColumnDef>,
7307 pub constraints: Vec<TableConstraint>,
7308 pub if_not_exists: bool,
7309 pub temporary: bool,
7310 pub or_replace: bool,
7311 #[serde(default, skip_serializing_if = "Option::is_none")]
7313 pub table_modifier: Option<String>,
7314 pub as_select: Option<Expression>,
7315 #[serde(default)]
7317 pub as_select_parenthesized: bool,
7318 #[serde(default)]
7320 pub on_commit: Option<OnCommit>,
7321 #[serde(default)]
7323 pub clone_source: Option<TableRef>,
7324 #[serde(default, skip_serializing_if = "Option::is_none")]
7326 pub clone_at_clause: Option<Expression>,
7327 #[serde(default)]
7329 pub is_copy: bool,
7330 #[serde(default)]
7332 pub shallow_clone: bool,
7333 #[serde(default)]
7335 pub deep_clone: bool,
7336 #[serde(default)]
7338 pub leading_comments: Vec<String>,
7339 #[serde(default)]
7341 pub with_properties: Vec<(String, String)>,
7342 #[serde(default)]
7344 pub teradata_post_name_options: Vec<String>,
7345 #[serde(default)]
7347 pub with_data: Option<bool>,
7348 #[serde(default)]
7350 pub with_statistics: Option<bool>,
7351 #[serde(default)]
7353 pub teradata_indexes: Vec<TeradataIndex>,
7354 #[serde(default)]
7356 pub with_cte: Option<With>,
7357 #[serde(default)]
7359 pub properties: Vec<Expression>,
7360 #[serde(default, skip_serializing_if = "Option::is_none")]
7362 pub partition_of: Option<Expression>,
7363 #[serde(default)]
7365 pub post_table_properties: Vec<Expression>,
7366 #[serde(default)]
7368 pub mysql_table_options: Vec<(String, String)>,
7369 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7371 pub inherits: Vec<TableRef>,
7372 #[serde(default, skip_serializing_if = "Option::is_none")]
7374 pub on_property: Option<OnProperty>,
7375 #[serde(default)]
7377 pub copy_grants: bool,
7378 #[serde(default, skip_serializing_if = "Option::is_none")]
7380 pub using_template: Option<Box<Expression>>,
7381 #[serde(default, skip_serializing_if = "Option::is_none")]
7383 pub rollup: Option<RollupProperty>,
7384 #[serde(default, skip_serializing_if = "Option::is_none")]
7386 pub uuid: Option<String>,
7387 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7391 pub with_partition_columns: Vec<ColumnDef>,
7392 #[serde(default, skip_serializing_if = "Option::is_none")]
7395 pub with_connection: Option<TableRef>,
7396}
7397
7398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7400#[cfg_attr(feature = "bindings", derive(TS))]
7401pub struct TeradataIndex {
7402 pub kind: TeradataIndexKind,
7404 pub name: Option<String>,
7406 pub columns: Vec<String>,
7408}
7409
7410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7412#[cfg_attr(feature = "bindings", derive(TS))]
7413pub enum TeradataIndexKind {
7414 NoPrimary,
7416 Primary,
7418 PrimaryAmp,
7420 Unique,
7422 UniquePrimary,
7424 Secondary,
7426}
7427
7428impl CreateTable {
7429 pub fn new(name: impl Into<String>) -> Self {
7430 Self {
7431 name: TableRef::new(name),
7432 on_cluster: None,
7433 columns: Vec::new(),
7434 constraints: Vec::new(),
7435 if_not_exists: false,
7436 temporary: false,
7437 or_replace: false,
7438 table_modifier: None,
7439 as_select: None,
7440 as_select_parenthesized: false,
7441 on_commit: None,
7442 clone_source: None,
7443 clone_at_clause: None,
7444 shallow_clone: false,
7445 deep_clone: false,
7446 is_copy: false,
7447 leading_comments: Vec::new(),
7448 with_properties: Vec::new(),
7449 teradata_post_name_options: Vec::new(),
7450 with_data: None,
7451 with_statistics: None,
7452 teradata_indexes: Vec::new(),
7453 with_cte: None,
7454 properties: Vec::new(),
7455 partition_of: None,
7456 post_table_properties: Vec::new(),
7457 mysql_table_options: Vec::new(),
7458 inherits: Vec::new(),
7459 on_property: None,
7460 copy_grants: false,
7461 using_template: None,
7462 rollup: None,
7463 uuid: None,
7464 with_partition_columns: Vec::new(),
7465 with_connection: None,
7466 }
7467 }
7468}
7469
7470#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7472#[cfg_attr(feature = "bindings", derive(TS))]
7473pub enum SortOrder {
7474 Asc,
7475 Desc,
7476}
7477
7478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7480#[cfg_attr(feature = "bindings", derive(TS))]
7481pub enum ConstraintType {
7482 NotNull,
7483 Null,
7484 PrimaryKey,
7485 Unique,
7486 Default,
7487 AutoIncrement,
7488 Collate,
7489 Comment,
7490 References,
7491 Check,
7492 GeneratedAsIdentity,
7493 Tags,
7495 ComputedColumn,
7497 GeneratedAsRow,
7499 OnUpdate,
7501 Path,
7503 Encode,
7505}
7506
7507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7509#[cfg_attr(feature = "bindings", derive(TS))]
7510pub struct ColumnDef {
7511 pub name: Identifier,
7512 pub data_type: DataType,
7513 pub nullable: Option<bool>,
7514 pub default: Option<Expression>,
7515 pub primary_key: bool,
7516 #[serde(default)]
7518 pub primary_key_order: Option<SortOrder>,
7519 pub unique: bool,
7520 #[serde(default)]
7522 pub unique_nulls_not_distinct: bool,
7523 pub auto_increment: bool,
7524 pub comment: Option<String>,
7525 pub constraints: Vec<ColumnConstraint>,
7526 #[serde(default)]
7528 pub constraint_order: Vec<ConstraintType>,
7529 #[serde(default)]
7531 pub format: Option<String>,
7532 #[serde(default)]
7534 pub title: Option<String>,
7535 #[serde(default)]
7537 pub inline_length: Option<u64>,
7538 #[serde(default)]
7540 pub compress: Option<Vec<Expression>>,
7541 #[serde(default)]
7543 pub character_set: Option<String>,
7544 #[serde(default)]
7546 pub uppercase: bool,
7547 #[serde(default)]
7549 pub casespecific: Option<bool>,
7550 #[serde(default)]
7552 pub auto_increment_start: Option<Box<Expression>>,
7553 #[serde(default)]
7555 pub auto_increment_increment: Option<Box<Expression>>,
7556 #[serde(default)]
7558 pub auto_increment_order: Option<bool>,
7559 #[serde(default)]
7561 pub unsigned: bool,
7562 #[serde(default)]
7564 pub zerofill: bool,
7565 #[serde(default, skip_serializing_if = "Option::is_none")]
7567 pub on_update: Option<Expression>,
7568 #[serde(default, skip_serializing_if = "Option::is_none")]
7570 pub visible: Option<bool>,
7571 #[serde(default, skip_serializing_if = "Option::is_none")]
7573 pub unique_constraint_name: Option<String>,
7574 #[serde(default, skip_serializing_if = "Option::is_none")]
7576 pub not_null_constraint_name: Option<String>,
7577 #[serde(default, skip_serializing_if = "Option::is_none")]
7579 pub primary_key_constraint_name: Option<String>,
7580 #[serde(default, skip_serializing_if = "Option::is_none")]
7582 pub check_constraint_name: Option<String>,
7583 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7585 pub options: Vec<Expression>,
7586 #[serde(default)]
7588 pub no_type: bool,
7589 #[serde(default, skip_serializing_if = "Option::is_none")]
7591 pub encoding: Option<String>,
7592 #[serde(default, skip_serializing_if = "Option::is_none")]
7594 pub codec: Option<String>,
7595 #[serde(default, skip_serializing_if = "Option::is_none")]
7597 pub ephemeral: Option<Option<Box<Expression>>>,
7598 #[serde(default, skip_serializing_if = "Option::is_none")]
7600 pub materialized_expr: Option<Box<Expression>>,
7601 #[serde(default, skip_serializing_if = "Option::is_none")]
7603 pub alias_expr: Option<Box<Expression>>,
7604 #[serde(default, skip_serializing_if = "Option::is_none")]
7606 pub ttl_expr: Option<Box<Expression>>,
7607 #[serde(default)]
7609 pub not_for_replication: bool,
7610}
7611
7612impl ColumnDef {
7613 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7614 Self {
7615 name: Identifier::new(name),
7616 data_type,
7617 nullable: None,
7618 default: None,
7619 primary_key: false,
7620 primary_key_order: None,
7621 unique: false,
7622 unique_nulls_not_distinct: false,
7623 auto_increment: false,
7624 comment: None,
7625 constraints: Vec::new(),
7626 constraint_order: Vec::new(),
7627 format: None,
7628 title: None,
7629 inline_length: None,
7630 compress: None,
7631 character_set: None,
7632 uppercase: false,
7633 casespecific: None,
7634 auto_increment_start: None,
7635 auto_increment_increment: None,
7636 auto_increment_order: None,
7637 unsigned: false,
7638 zerofill: false,
7639 on_update: None,
7640 visible: None,
7641 unique_constraint_name: None,
7642 not_null_constraint_name: None,
7643 primary_key_constraint_name: None,
7644 check_constraint_name: None,
7645 options: Vec::new(),
7646 no_type: false,
7647 encoding: None,
7648 codec: None,
7649 ephemeral: None,
7650 materialized_expr: None,
7651 alias_expr: None,
7652 ttl_expr: None,
7653 not_for_replication: false,
7654 }
7655 }
7656}
7657
7658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7660#[cfg_attr(feature = "bindings", derive(TS))]
7661pub enum ColumnConstraint {
7662 NotNull,
7663 Null,
7664 Unique,
7665 PrimaryKey,
7666 Default(Expression),
7667 Check(Expression),
7668 References(ForeignKeyRef),
7669 GeneratedAsIdentity(GeneratedAsIdentity),
7670 Collate(Identifier),
7671 Comment(String),
7672 Tags(Tags),
7674 ComputedColumn(ComputedColumn),
7677 GeneratedAsRow(GeneratedAsRow),
7679 Path(Expression),
7681}
7682
7683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7685#[cfg_attr(feature = "bindings", derive(TS))]
7686pub struct ComputedColumn {
7687 pub expression: Box<Expression>,
7689 #[serde(default)]
7691 pub persisted: bool,
7692 #[serde(default)]
7694 pub not_null: bool,
7695 #[serde(default)]
7698 pub persistence_kind: Option<String>,
7699 #[serde(default, skip_serializing_if = "Option::is_none")]
7701 pub data_type: Option<DataType>,
7702}
7703
7704#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7706#[cfg_attr(feature = "bindings", derive(TS))]
7707pub struct GeneratedAsRow {
7708 pub start: bool,
7710 #[serde(default)]
7712 pub hidden: bool,
7713}
7714
7715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7717#[cfg_attr(feature = "bindings", derive(TS))]
7718pub struct GeneratedAsIdentity {
7719 pub always: bool,
7721 pub on_null: bool,
7723 pub start: Option<Box<Expression>>,
7725 pub increment: Option<Box<Expression>>,
7727 pub minvalue: Option<Box<Expression>>,
7729 pub maxvalue: Option<Box<Expression>>,
7731 pub cycle: Option<bool>,
7733}
7734
7735#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7737#[cfg_attr(feature = "bindings", derive(TS))]
7738pub struct ConstraintModifiers {
7739 pub enforced: Option<bool>,
7741 pub deferrable: Option<bool>,
7743 pub initially_deferred: Option<bool>,
7745 pub norely: bool,
7747 pub rely: bool,
7749 #[serde(default)]
7751 pub using: Option<String>,
7752 #[serde(default)]
7754 pub using_before_columns: bool,
7755 #[serde(default, skip_serializing_if = "Option::is_none")]
7757 pub comment: Option<String>,
7758 #[serde(default, skip_serializing_if = "Option::is_none")]
7760 pub visible: Option<bool>,
7761 #[serde(default, skip_serializing_if = "Option::is_none")]
7763 pub engine_attribute: Option<String>,
7764 #[serde(default, skip_serializing_if = "Option::is_none")]
7766 pub with_parser: Option<String>,
7767 #[serde(default)]
7769 pub not_valid: bool,
7770 #[serde(default, skip_serializing_if = "Option::is_none")]
7772 pub clustered: Option<String>,
7773 #[serde(default, skip_serializing_if = "Option::is_none")]
7775 pub on_conflict: Option<String>,
7776 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7778 pub with_options: Vec<(String, String)>,
7779 #[serde(default, skip_serializing_if = "Option::is_none")]
7781 pub on_filegroup: Option<Identifier>,
7782}
7783
7784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7786#[cfg_attr(feature = "bindings", derive(TS))]
7787pub enum TableConstraint {
7788 PrimaryKey {
7789 name: Option<Identifier>,
7790 columns: Vec<Identifier>,
7791 #[serde(default)]
7793 include_columns: Vec<Identifier>,
7794 #[serde(default)]
7795 modifiers: ConstraintModifiers,
7796 #[serde(default)]
7798 has_constraint_keyword: bool,
7799 },
7800 Unique {
7801 name: Option<Identifier>,
7802 columns: Vec<Identifier>,
7803 #[serde(default)]
7805 columns_parenthesized: bool,
7806 #[serde(default)]
7807 modifiers: ConstraintModifiers,
7808 #[serde(default)]
7810 has_constraint_keyword: bool,
7811 #[serde(default)]
7813 nulls_not_distinct: bool,
7814 },
7815 ForeignKey {
7816 name: Option<Identifier>,
7817 columns: Vec<Identifier>,
7818 #[serde(default)]
7819 references: Option<ForeignKeyRef>,
7820 #[serde(default)]
7822 on_delete: Option<ReferentialAction>,
7823 #[serde(default)]
7825 on_update: Option<ReferentialAction>,
7826 #[serde(default)]
7827 modifiers: ConstraintModifiers,
7828 },
7829 Check {
7830 name: Option<Identifier>,
7831 expression: Expression,
7832 #[serde(default)]
7833 modifiers: ConstraintModifiers,
7834 },
7835 Assume {
7837 name: Option<Identifier>,
7838 expression: Expression,
7839 },
7840 Default {
7842 name: Option<Identifier>,
7843 expression: Expression,
7844 column: Identifier,
7845 },
7846 Index {
7848 name: Option<Identifier>,
7849 columns: Vec<Identifier>,
7850 #[serde(default)]
7852 kind: Option<String>,
7853 #[serde(default)]
7854 modifiers: ConstraintModifiers,
7855 #[serde(default)]
7857 use_key_keyword: bool,
7858 #[serde(default, skip_serializing_if = "Option::is_none")]
7860 expression: Option<Box<Expression>>,
7861 #[serde(default, skip_serializing_if = "Option::is_none")]
7863 index_type: Option<Box<Expression>>,
7864 #[serde(default, skip_serializing_if = "Option::is_none")]
7866 granularity: Option<Box<Expression>>,
7867 },
7868 Projection {
7870 name: Identifier,
7871 expression: Expression,
7872 },
7873 Like {
7875 source: TableRef,
7876 options: Vec<(LikeOptionAction, String)>,
7878 },
7879 PeriodForSystemTime {
7881 start_col: Identifier,
7882 end_col: Identifier,
7883 },
7884 Exclude {
7887 name: Option<Identifier>,
7888 #[serde(default)]
7890 using: Option<String>,
7891 elements: Vec<ExcludeElement>,
7893 #[serde(default)]
7895 include_columns: Vec<Identifier>,
7896 #[serde(default)]
7898 where_clause: Option<Box<Expression>>,
7899 #[serde(default)]
7901 with_params: Vec<(String, String)>,
7902 #[serde(default)]
7904 using_index_tablespace: Option<String>,
7905 #[serde(default)]
7906 modifiers: ConstraintModifiers,
7907 },
7908 Tags(Tags),
7910 InitiallyDeferred {
7914 deferred: bool,
7916 },
7917}
7918
7919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7921#[cfg_attr(feature = "bindings", derive(TS))]
7922pub struct ExcludeElement {
7923 pub expression: String,
7925 pub operator: String,
7927}
7928
7929#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7931#[cfg_attr(feature = "bindings", derive(TS))]
7932pub enum LikeOptionAction {
7933 Including,
7934 Excluding,
7935}
7936
7937#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7939#[cfg_attr(feature = "bindings", derive(TS))]
7940pub enum MatchType {
7941 Full,
7942 Partial,
7943 Simple,
7944}
7945
7946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7948#[cfg_attr(feature = "bindings", derive(TS))]
7949pub struct ForeignKeyRef {
7950 pub table: TableRef,
7951 pub columns: Vec<Identifier>,
7952 pub on_delete: Option<ReferentialAction>,
7953 pub on_update: Option<ReferentialAction>,
7954 #[serde(default)]
7956 pub on_update_first: bool,
7957 #[serde(default)]
7959 pub match_type: Option<MatchType>,
7960 #[serde(default)]
7962 pub match_after_actions: bool,
7963 #[serde(default)]
7965 pub constraint_name: Option<String>,
7966 #[serde(default)]
7968 pub deferrable: Option<bool>,
7969 #[serde(default)]
7971 pub has_foreign_key_keywords: bool,
7972}
7973
7974#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7976#[cfg_attr(feature = "bindings", derive(TS))]
7977pub enum ReferentialAction {
7978 Cascade,
7979 SetNull,
7980 SetDefault,
7981 Restrict,
7982 NoAction,
7983}
7984
7985#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7987#[cfg_attr(feature = "bindings", derive(TS))]
7988pub struct DropTable {
7989 pub names: Vec<TableRef>,
7990 pub if_exists: bool,
7991 pub cascade: bool,
7992 #[serde(default)]
7994 pub cascade_constraints: bool,
7995 #[serde(default)]
7997 pub purge: bool,
7998 #[serde(default)]
8000 pub leading_comments: Vec<String>,
8001 #[serde(default, skip_serializing_if = "Option::is_none")]
8004 pub object_id_args: Option<String>,
8005 #[serde(default)]
8007 pub sync: bool,
8008 #[serde(default)]
8010 pub iceberg: bool,
8011 #[serde(default)]
8013 pub restrict: bool,
8014}
8015
8016impl DropTable {
8017 pub fn new(name: impl Into<String>) -> Self {
8018 Self {
8019 names: vec![TableRef::new(name)],
8020 if_exists: false,
8021 cascade: false,
8022 cascade_constraints: false,
8023 purge: false,
8024 leading_comments: Vec::new(),
8025 object_id_args: None,
8026 sync: false,
8027 iceberg: false,
8028 restrict: false,
8029 }
8030 }
8031}
8032
8033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8035#[cfg_attr(feature = "bindings", derive(TS))]
8036pub struct Undrop {
8037 pub kind: String,
8039 pub name: TableRef,
8041 #[serde(default)]
8043 pub if_exists: bool,
8044}
8045
8046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8048#[cfg_attr(feature = "bindings", derive(TS))]
8049pub struct AlterTable {
8050 pub name: TableRef,
8051 pub actions: Vec<AlterTableAction>,
8052 #[serde(default)]
8054 pub if_exists: bool,
8055 #[serde(default, skip_serializing_if = "Option::is_none")]
8057 pub algorithm: Option<String>,
8058 #[serde(default, skip_serializing_if = "Option::is_none")]
8060 pub lock: Option<String>,
8061 #[serde(default, skip_serializing_if = "Option::is_none")]
8063 pub with_check: Option<String>,
8064 #[serde(default, skip_serializing_if = "Option::is_none")]
8066 pub partition: Option<Vec<(Identifier, Expression)>>,
8067 #[serde(default, skip_serializing_if = "Option::is_none")]
8069 pub on_cluster: Option<OnCluster>,
8070 #[serde(default, skip_serializing_if = "Option::is_none")]
8072 pub table_modifier: Option<String>,
8073}
8074
8075impl AlterTable {
8076 pub fn new(name: impl Into<String>) -> Self {
8077 Self {
8078 name: TableRef::new(name),
8079 actions: Vec::new(),
8080 if_exists: false,
8081 algorithm: None,
8082 lock: None,
8083 with_check: None,
8084 partition: None,
8085 on_cluster: None,
8086 table_modifier: None,
8087 }
8088 }
8089}
8090
8091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8093#[cfg_attr(feature = "bindings", derive(TS))]
8094pub enum ColumnPosition {
8095 First,
8096 After(Identifier),
8097}
8098
8099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8101#[cfg_attr(feature = "bindings", derive(TS))]
8102pub enum AlterTableAction {
8103 AddColumn {
8104 column: ColumnDef,
8105 if_not_exists: bool,
8106 position: Option<ColumnPosition>,
8107 },
8108 DropColumn {
8109 name: Identifier,
8110 if_exists: bool,
8111 cascade: bool,
8112 },
8113 RenameColumn {
8114 old_name: Identifier,
8115 new_name: Identifier,
8116 if_exists: bool,
8117 },
8118 AlterColumn {
8119 name: Identifier,
8120 action: AlterColumnAction,
8121 #[serde(default)]
8123 use_modify_keyword: bool,
8124 },
8125 RenameTable(TableRef),
8126 AddConstraint(TableConstraint),
8127 DropConstraint {
8128 name: Identifier,
8129 if_exists: bool,
8130 },
8131 DropForeignKey {
8133 name: Identifier,
8134 },
8135 DropPartition {
8137 partitions: Vec<Vec<(Identifier, Expression)>>,
8139 if_exists: bool,
8140 },
8141 AddPartition {
8143 partition: Expression,
8145 if_not_exists: bool,
8146 location: Option<Expression>,
8147 },
8148 Delete {
8150 where_clause: Expression,
8151 },
8152 SwapWith(TableRef),
8154 SetProperty {
8156 properties: Vec<(String, Expression)>,
8157 },
8158 UnsetProperty {
8160 properties: Vec<String>,
8161 },
8162 ClusterBy {
8164 expressions: Vec<Expression>,
8165 },
8166 SetTag {
8168 expressions: Vec<(String, Expression)>,
8169 },
8170 UnsetTag {
8172 names: Vec<String>,
8173 },
8174 SetOptions {
8176 expressions: Vec<Expression>,
8177 },
8178 AlterIndex {
8180 name: Identifier,
8181 visible: bool,
8182 },
8183 SetAttribute {
8185 attribute: String,
8186 },
8187 SetStageFileFormat {
8189 options: Option<Expression>,
8190 },
8191 SetStageCopyOptions {
8193 options: Option<Expression>,
8194 },
8195 AddColumns {
8197 columns: Vec<ColumnDef>,
8198 cascade: bool,
8199 },
8200 DropColumns {
8202 names: Vec<Identifier>,
8203 },
8204 ChangeColumn {
8207 old_name: Identifier,
8208 new_name: Identifier,
8209 #[serde(default, skip_serializing_if = "Option::is_none")]
8210 data_type: Option<DataType>,
8211 comment: Option<String>,
8212 #[serde(default)]
8213 cascade: bool,
8214 },
8215 AlterSortKey {
8218 this: Option<String>,
8220 expressions: Vec<Expression>,
8222 compound: bool,
8224 },
8225 AlterDistStyle {
8229 style: String,
8231 distkey: Option<Identifier>,
8233 },
8234 SetTableProperties {
8236 properties: Vec<(Expression, Expression)>,
8237 },
8238 SetLocation {
8240 location: String,
8241 },
8242 SetFileFormat {
8244 format: String,
8245 },
8246 ReplacePartition {
8248 partition: Expression,
8249 source: Option<Box<Expression>>,
8250 },
8251 Raw {
8253 sql: String,
8254 },
8255}
8256
8257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8259#[cfg_attr(feature = "bindings", derive(TS))]
8260pub enum AlterColumnAction {
8261 SetDataType {
8262 data_type: DataType,
8263 using: Option<Expression>,
8265 #[serde(default, skip_serializing_if = "Option::is_none")]
8267 collate: Option<String>,
8268 },
8269 SetDefault(Expression),
8270 DropDefault,
8271 SetNotNull,
8272 DropNotNull,
8273 Comment(String),
8275 SetVisible,
8277 SetInvisible,
8279}
8280
8281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8283#[cfg_attr(feature = "bindings", derive(TS))]
8284pub struct CreateIndex {
8285 pub name: Identifier,
8286 pub table: TableRef,
8287 pub columns: Vec<IndexColumn>,
8288 pub unique: bool,
8289 pub if_not_exists: bool,
8290 pub using: Option<String>,
8291 #[serde(default)]
8293 pub clustered: Option<String>,
8294 #[serde(default)]
8296 pub concurrently: bool,
8297 #[serde(default)]
8299 pub where_clause: Option<Box<Expression>>,
8300 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8302 pub include_columns: Vec<Identifier>,
8303 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8305 pub with_options: Vec<(String, String)>,
8306 #[serde(default)]
8308 pub on_filegroup: Option<String>,
8309}
8310
8311impl CreateIndex {
8312 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8313 Self {
8314 name: Identifier::new(name),
8315 table: TableRef::new(table),
8316 columns: Vec::new(),
8317 unique: false,
8318 if_not_exists: false,
8319 using: None,
8320 clustered: None,
8321 concurrently: false,
8322 where_clause: None,
8323 include_columns: Vec::new(),
8324 with_options: Vec::new(),
8325 on_filegroup: None,
8326 }
8327 }
8328}
8329
8330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8332#[cfg_attr(feature = "bindings", derive(TS))]
8333pub struct IndexColumn {
8334 pub column: Identifier,
8335 pub desc: bool,
8336 #[serde(default)]
8338 pub asc: bool,
8339 pub nulls_first: Option<bool>,
8340 #[serde(default, skip_serializing_if = "Option::is_none")]
8342 pub opclass: Option<String>,
8343}
8344
8345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8347#[cfg_attr(feature = "bindings", derive(TS))]
8348pub struct DropIndex {
8349 pub name: Identifier,
8350 pub table: Option<TableRef>,
8351 pub if_exists: bool,
8352 #[serde(default)]
8354 pub concurrently: bool,
8355}
8356
8357impl DropIndex {
8358 pub fn new(name: impl Into<String>) -> Self {
8359 Self {
8360 name: Identifier::new(name),
8361 table: None,
8362 if_exists: false,
8363 concurrently: false,
8364 }
8365 }
8366}
8367
8368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8370#[cfg_attr(feature = "bindings", derive(TS))]
8371pub struct ViewColumn {
8372 pub name: Identifier,
8373 pub comment: Option<String>,
8374 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8376 pub options: Vec<Expression>,
8377}
8378
8379impl ViewColumn {
8380 pub fn new(name: impl Into<String>) -> Self {
8381 Self {
8382 name: Identifier::new(name),
8383 comment: None,
8384 options: Vec::new(),
8385 }
8386 }
8387
8388 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8389 Self {
8390 name: Identifier::new(name),
8391 comment: Some(comment.into()),
8392 options: Vec::new(),
8393 }
8394 }
8395}
8396
8397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8399#[cfg_attr(feature = "bindings", derive(TS))]
8400pub struct CreateView {
8401 pub name: TableRef,
8402 pub columns: Vec<ViewColumn>,
8403 pub query: Expression,
8404 pub or_replace: bool,
8405 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8407 pub or_alter: bool,
8408 pub if_not_exists: bool,
8409 pub materialized: bool,
8410 pub temporary: bool,
8411 #[serde(default)]
8413 pub secure: bool,
8414 #[serde(skip_serializing_if = "Option::is_none")]
8416 pub algorithm: Option<String>,
8417 #[serde(skip_serializing_if = "Option::is_none")]
8419 pub definer: Option<String>,
8420 #[serde(skip_serializing_if = "Option::is_none")]
8422 pub security: Option<FunctionSecurity>,
8423 #[serde(default = "default_true")]
8425 pub security_sql_style: bool,
8426 #[serde(default)]
8428 pub security_after_name: bool,
8429 #[serde(default)]
8431 pub query_parenthesized: bool,
8432 #[serde(skip_serializing_if = "Option::is_none")]
8434 pub locking_mode: Option<String>,
8435 #[serde(skip_serializing_if = "Option::is_none")]
8437 pub locking_access: Option<String>,
8438 #[serde(default)]
8440 pub copy_grants: bool,
8441 #[serde(skip_serializing_if = "Option::is_none", default)]
8443 pub comment: Option<String>,
8444 #[serde(skip_serializing_if = "Option::is_none", default)]
8446 pub row_access_policy: Option<String>,
8447 #[serde(default)]
8449 pub tags: Vec<(String, String)>,
8450 #[serde(default)]
8452 pub options: Vec<Expression>,
8453 #[serde(skip_serializing_if = "Option::is_none", default)]
8455 pub build: Option<String>,
8456 #[serde(skip_serializing_if = "Option::is_none", default)]
8458 pub refresh: Option<Box<RefreshTriggerProperty>>,
8459 #[serde(skip_serializing_if = "Option::is_none", default)]
8462 pub schema: Option<Box<Schema>>,
8463 #[serde(skip_serializing_if = "Option::is_none", default)]
8465 pub unique_key: Option<Box<UniqueKeyProperty>>,
8466 #[serde(default)]
8468 pub no_schema_binding: bool,
8469 #[serde(skip_serializing_if = "Option::is_none", default)]
8471 pub auto_refresh: Option<bool>,
8472 #[serde(skip_serializing_if = "Option::is_none", default)]
8474 pub clickhouse_population: Option<String>,
8475 #[serde(default, skip_serializing_if = "Option::is_none")]
8477 pub on_cluster: Option<OnCluster>,
8478 #[serde(default, skip_serializing_if = "Option::is_none")]
8480 pub to_table: Option<TableRef>,
8481 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8483 pub table_properties: Vec<Expression>,
8484}
8485
8486impl CreateView {
8487 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8488 Self {
8489 name: TableRef::new(name),
8490 columns: Vec::new(),
8491 query,
8492 or_replace: false,
8493 or_alter: false,
8494 if_not_exists: false,
8495 materialized: false,
8496 temporary: false,
8497 secure: false,
8498 algorithm: None,
8499 definer: None,
8500 security: None,
8501 security_sql_style: true,
8502 security_after_name: false,
8503 query_parenthesized: false,
8504 locking_mode: None,
8505 locking_access: None,
8506 copy_grants: false,
8507 comment: None,
8508 row_access_policy: None,
8509 tags: Vec::new(),
8510 options: Vec::new(),
8511 build: None,
8512 refresh: None,
8513 schema: None,
8514 unique_key: None,
8515 no_schema_binding: false,
8516 auto_refresh: None,
8517 clickhouse_population: None,
8518 on_cluster: None,
8519 to_table: None,
8520 table_properties: Vec::new(),
8521 }
8522 }
8523}
8524
8525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8527#[cfg_attr(feature = "bindings", derive(TS))]
8528pub struct DropView {
8529 pub name: TableRef,
8530 pub if_exists: bool,
8531 pub materialized: bool,
8532}
8533
8534impl DropView {
8535 pub fn new(name: impl Into<String>) -> Self {
8536 Self {
8537 name: TableRef::new(name),
8538 if_exists: false,
8539 materialized: false,
8540 }
8541 }
8542}
8543
8544#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8546#[cfg_attr(feature = "bindings", derive(TS))]
8547pub struct Truncate {
8548 #[serde(default)]
8550 pub target: TruncateTarget,
8551 #[serde(default)]
8553 pub if_exists: bool,
8554 pub table: TableRef,
8555 #[serde(default, skip_serializing_if = "Option::is_none")]
8557 pub on_cluster: Option<OnCluster>,
8558 pub cascade: bool,
8559 #[serde(default)]
8561 pub extra_tables: Vec<TruncateTableEntry>,
8562 #[serde(default)]
8564 pub identity: Option<TruncateIdentity>,
8565 #[serde(default)]
8567 pub restrict: bool,
8568 #[serde(default, skip_serializing_if = "Option::is_none")]
8570 pub partition: Option<Box<Expression>>,
8571}
8572
8573#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8575#[cfg_attr(feature = "bindings", derive(TS))]
8576pub struct TruncateTableEntry {
8577 pub table: TableRef,
8578 #[serde(default)]
8580 pub star: bool,
8581}
8582
8583#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8585#[cfg_attr(feature = "bindings", derive(TS))]
8586pub enum TruncateTarget {
8587 Table,
8588 Database,
8589}
8590
8591impl Default for TruncateTarget {
8592 fn default() -> Self {
8593 TruncateTarget::Table
8594 }
8595}
8596
8597#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8599#[cfg_attr(feature = "bindings", derive(TS))]
8600pub enum TruncateIdentity {
8601 Restart,
8602 Continue,
8603}
8604
8605impl Truncate {
8606 pub fn new(table: impl Into<String>) -> Self {
8607 Self {
8608 target: TruncateTarget::Table,
8609 if_exists: false,
8610 table: TableRef::new(table),
8611 on_cluster: None,
8612 cascade: false,
8613 extra_tables: Vec::new(),
8614 identity: None,
8615 restrict: false,
8616 partition: None,
8617 }
8618 }
8619}
8620
8621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8623#[cfg_attr(feature = "bindings", derive(TS))]
8624pub struct Use {
8625 pub kind: Option<UseKind>,
8627 pub this: Identifier,
8629}
8630
8631#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8633#[cfg_attr(feature = "bindings", derive(TS))]
8634pub enum UseKind {
8635 Database,
8636 Schema,
8637 Role,
8638 Warehouse,
8639 Catalog,
8640 SecondaryRoles,
8642}
8643
8644#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8646#[cfg_attr(feature = "bindings", derive(TS))]
8647pub struct SetStatement {
8648 pub items: Vec<SetItem>,
8650}
8651
8652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8654#[cfg_attr(feature = "bindings", derive(TS))]
8655pub struct SetItem {
8656 pub name: Expression,
8658 pub value: Expression,
8660 pub kind: Option<String>,
8662 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8664 pub no_equals: bool,
8665}
8666
8667#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8669#[cfg_attr(feature = "bindings", derive(TS))]
8670pub struct Cache {
8671 pub table: Identifier,
8673 pub lazy: bool,
8675 pub options: Vec<(Expression, Expression)>,
8677 pub query: Option<Expression>,
8679}
8680
8681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8683#[cfg_attr(feature = "bindings", derive(TS))]
8684pub struct Uncache {
8685 pub table: Identifier,
8687 pub if_exists: bool,
8689}
8690
8691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8693#[cfg_attr(feature = "bindings", derive(TS))]
8694pub struct LoadData {
8695 pub local: bool,
8697 pub inpath: String,
8699 pub overwrite: bool,
8701 pub table: Expression,
8703 pub partition: Vec<(Identifier, Expression)>,
8705 pub input_format: Option<String>,
8707 pub serde: Option<String>,
8709}
8710
8711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8713#[cfg_attr(feature = "bindings", derive(TS))]
8714pub struct Pragma {
8715 pub schema: Option<Identifier>,
8717 pub name: Identifier,
8719 pub value: Option<Expression>,
8721 pub args: Vec<Expression>,
8723 #[serde(default)]
8725 pub use_assignment_syntax: bool,
8726}
8727
8728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8731#[cfg_attr(feature = "bindings", derive(TS))]
8732pub struct Privilege {
8733 pub name: String,
8735 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8737 pub columns: Vec<String>,
8738}
8739
8740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8742#[cfg_attr(feature = "bindings", derive(TS))]
8743pub struct GrantPrincipal {
8744 pub name: Identifier,
8746 pub is_role: bool,
8748 #[serde(default)]
8750 pub is_group: bool,
8751 #[serde(default)]
8753 pub is_share: bool,
8754}
8755
8756#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8758#[cfg_attr(feature = "bindings", derive(TS))]
8759pub struct Grant {
8760 pub privileges: Vec<Privilege>,
8762 pub kind: Option<String>,
8764 pub securable: Identifier,
8766 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8768 pub function_params: Vec<String>,
8769 pub principals: Vec<GrantPrincipal>,
8771 pub grant_option: bool,
8773 #[serde(default, skip_serializing_if = "Option::is_none")]
8775 pub as_principal: Option<Identifier>,
8776}
8777
8778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8780#[cfg_attr(feature = "bindings", derive(TS))]
8781pub struct Revoke {
8782 pub privileges: Vec<Privilege>,
8784 pub kind: Option<String>,
8786 pub securable: Identifier,
8788 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8790 pub function_params: Vec<String>,
8791 pub principals: Vec<GrantPrincipal>,
8793 pub grant_option: bool,
8795 pub cascade: bool,
8797 #[serde(default)]
8799 pub restrict: bool,
8800}
8801
8802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8804#[cfg_attr(feature = "bindings", derive(TS))]
8805pub struct Comment {
8806 pub this: Expression,
8808 pub kind: String,
8810 pub expression: Expression,
8812 pub exists: bool,
8814 pub materialized: bool,
8816}
8817
8818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8824#[cfg_attr(feature = "bindings", derive(TS))]
8825pub struct AlterView {
8826 pub name: TableRef,
8827 pub actions: Vec<AlterViewAction>,
8828 #[serde(default, skip_serializing_if = "Option::is_none")]
8830 pub algorithm: Option<String>,
8831 #[serde(default, skip_serializing_if = "Option::is_none")]
8833 pub definer: Option<String>,
8834 #[serde(default, skip_serializing_if = "Option::is_none")]
8836 pub sql_security: Option<String>,
8837 #[serde(default, skip_serializing_if = "Option::is_none")]
8839 pub with_option: Option<String>,
8840 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8842 pub columns: Vec<ViewColumn>,
8843}
8844
8845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8847#[cfg_attr(feature = "bindings", derive(TS))]
8848pub enum AlterViewAction {
8849 Rename(TableRef),
8851 OwnerTo(Identifier),
8853 SetSchema(Identifier),
8855 SetAuthorization(String),
8857 AlterColumn {
8859 name: Identifier,
8860 action: AlterColumnAction,
8861 },
8862 AsSelect(Box<Expression>),
8864 SetTblproperties(Vec<(String, String)>),
8866 UnsetTblproperties(Vec<String>),
8868}
8869
8870impl AlterView {
8871 pub fn new(name: impl Into<String>) -> Self {
8872 Self {
8873 name: TableRef::new(name),
8874 actions: Vec::new(),
8875 algorithm: None,
8876 definer: None,
8877 sql_security: None,
8878 with_option: None,
8879 columns: Vec::new(),
8880 }
8881 }
8882}
8883
8884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8886#[cfg_attr(feature = "bindings", derive(TS))]
8887pub struct AlterIndex {
8888 pub name: Identifier,
8889 pub table: Option<TableRef>,
8890 pub actions: Vec<AlterIndexAction>,
8891}
8892
8893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8895#[cfg_attr(feature = "bindings", derive(TS))]
8896pub enum AlterIndexAction {
8897 Rename(Identifier),
8899 SetTablespace(Identifier),
8901 Visible(bool),
8903}
8904
8905impl AlterIndex {
8906 pub fn new(name: impl Into<String>) -> Self {
8907 Self {
8908 name: Identifier::new(name),
8909 table: None,
8910 actions: Vec::new(),
8911 }
8912 }
8913}
8914
8915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8917#[cfg_attr(feature = "bindings", derive(TS))]
8918pub struct CreateSchema {
8919 pub name: Vec<Identifier>,
8921 pub if_not_exists: bool,
8922 pub authorization: Option<Identifier>,
8923 #[serde(default)]
8925 pub clone_from: Option<Vec<Identifier>>,
8926 #[serde(default)]
8928 pub at_clause: Option<Expression>,
8929 #[serde(default)]
8931 pub properties: Vec<Expression>,
8932 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8934 pub leading_comments: Vec<String>,
8935}
8936
8937impl CreateSchema {
8938 pub fn new(name: impl Into<String>) -> Self {
8939 Self {
8940 name: vec![Identifier::new(name)],
8941 if_not_exists: false,
8942 authorization: None,
8943 clone_from: None,
8944 at_clause: None,
8945 properties: Vec::new(),
8946 leading_comments: Vec::new(),
8947 }
8948 }
8949}
8950
8951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8953#[cfg_attr(feature = "bindings", derive(TS))]
8954pub struct DropSchema {
8955 pub name: Identifier,
8956 pub if_exists: bool,
8957 pub cascade: bool,
8958}
8959
8960impl DropSchema {
8961 pub fn new(name: impl Into<String>) -> Self {
8962 Self {
8963 name: Identifier::new(name),
8964 if_exists: false,
8965 cascade: false,
8966 }
8967 }
8968}
8969
8970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8972#[cfg_attr(feature = "bindings", derive(TS))]
8973pub struct DropNamespace {
8974 pub name: Identifier,
8975 pub if_exists: bool,
8976 pub cascade: bool,
8977}
8978
8979impl DropNamespace {
8980 pub fn new(name: impl Into<String>) -> Self {
8981 Self {
8982 name: Identifier::new(name),
8983 if_exists: false,
8984 cascade: false,
8985 }
8986 }
8987}
8988
8989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8991#[cfg_attr(feature = "bindings", derive(TS))]
8992pub struct CreateDatabase {
8993 pub name: Identifier,
8994 pub if_not_exists: bool,
8995 pub options: Vec<DatabaseOption>,
8996 #[serde(default)]
8998 pub clone_from: Option<Identifier>,
8999 #[serde(default)]
9001 pub at_clause: Option<Expression>,
9002}
9003
9004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9006#[cfg_attr(feature = "bindings", derive(TS))]
9007pub enum DatabaseOption {
9008 CharacterSet(String),
9009 Collate(String),
9010 Owner(Identifier),
9011 Template(Identifier),
9012 Encoding(String),
9013 Location(String),
9014}
9015
9016impl CreateDatabase {
9017 pub fn new(name: impl Into<String>) -> Self {
9018 Self {
9019 name: Identifier::new(name),
9020 if_not_exists: false,
9021 options: Vec::new(),
9022 clone_from: None,
9023 at_clause: None,
9024 }
9025 }
9026}
9027
9028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9030#[cfg_attr(feature = "bindings", derive(TS))]
9031pub struct DropDatabase {
9032 pub name: Identifier,
9033 pub if_exists: bool,
9034 #[serde(default)]
9036 pub sync: bool,
9037}
9038
9039impl DropDatabase {
9040 pub fn new(name: impl Into<String>) -> Self {
9041 Self {
9042 name: Identifier::new(name),
9043 if_exists: false,
9044 sync: false,
9045 }
9046 }
9047}
9048
9049#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9051#[cfg_attr(feature = "bindings", derive(TS))]
9052pub struct CreateFunction {
9053 pub name: TableRef,
9054 pub parameters: Vec<FunctionParameter>,
9055 pub return_type: Option<DataType>,
9056 pub body: Option<FunctionBody>,
9057 pub or_replace: bool,
9058 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9060 pub or_alter: bool,
9061 pub if_not_exists: bool,
9062 pub temporary: bool,
9063 pub language: Option<String>,
9064 pub deterministic: Option<bool>,
9065 pub returns_null_on_null_input: Option<bool>,
9066 pub security: Option<FunctionSecurity>,
9067 #[serde(default = "default_true")]
9069 pub has_parens: bool,
9070 #[serde(default)]
9072 pub sql_data_access: Option<SqlDataAccess>,
9073 #[serde(default, skip_serializing_if = "Option::is_none")]
9075 pub returns_table_body: Option<String>,
9076 #[serde(default)]
9078 pub language_first: bool,
9079 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9081 pub set_options: Vec<FunctionSetOption>,
9082 #[serde(default)]
9084 pub strict: bool,
9085 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9087 pub options: Vec<Expression>,
9088 #[serde(default)]
9090 pub is_table_function: bool,
9091 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9093 pub property_order: Vec<FunctionPropertyKind>,
9094 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9096 pub using_resources: Vec<FunctionUsingResource>,
9097 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9099 pub environment: Vec<Expression>,
9100 #[serde(default, skip_serializing_if = "Option::is_none")]
9102 pub handler: Option<String>,
9103 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9105 pub handler_uses_eq: bool,
9106 #[serde(default, skip_serializing_if = "Option::is_none")]
9108 pub runtime_version: Option<String>,
9109 #[serde(default, skip_serializing_if = "Option::is_none")]
9111 pub packages: Option<Vec<String>>,
9112 #[serde(default, skip_serializing_if = "Option::is_none")]
9114 pub parameter_style: Option<String>,
9115}
9116
9117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9119#[cfg_attr(feature = "bindings", derive(TS))]
9120pub struct FunctionSetOption {
9121 pub name: String,
9122 pub value: FunctionSetValue,
9123}
9124
9125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9127#[cfg_attr(feature = "bindings", derive(TS))]
9128pub enum FunctionSetValue {
9129 Value { value: String, use_to: bool },
9131 FromCurrent,
9133}
9134
9135#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9137#[cfg_attr(feature = "bindings", derive(TS))]
9138pub enum SqlDataAccess {
9139 NoSql,
9141 ContainsSql,
9143 ReadsSqlData,
9145 ModifiesSqlData,
9147}
9148
9149#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9151#[cfg_attr(feature = "bindings", derive(TS))]
9152pub enum FunctionPropertyKind {
9153 Set,
9155 As,
9157 Using,
9159 Language,
9161 Determinism,
9163 NullInput,
9165 Security,
9167 SqlDataAccess,
9169 Options,
9171 Environment,
9173 Handler,
9175 RuntimeVersion,
9177 Packages,
9179 ParameterStyle,
9181}
9182
9183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9185#[cfg_attr(feature = "bindings", derive(TS))]
9186pub struct FunctionUsingResource {
9187 pub kind: String,
9188 pub uri: String,
9189}
9190
9191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9193#[cfg_attr(feature = "bindings", derive(TS))]
9194pub struct FunctionParameter {
9195 pub name: Option<Identifier>,
9196 pub data_type: DataType,
9197 pub mode: Option<ParameterMode>,
9198 pub default: Option<Expression>,
9199 #[serde(default, skip_serializing_if = "Option::is_none")]
9201 pub mode_text: Option<String>,
9202}
9203
9204#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9206#[cfg_attr(feature = "bindings", derive(TS))]
9207pub enum ParameterMode {
9208 In,
9209 Out,
9210 InOut,
9211 Variadic,
9212}
9213
9214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9216#[cfg_attr(feature = "bindings", derive(TS))]
9217pub enum FunctionBody {
9218 Block(String),
9220 StringLiteral(String),
9222 Expression(Expression),
9224 External(String),
9226 Return(Expression),
9228 Statements(Vec<Expression>),
9230 DollarQuoted {
9233 content: String,
9234 tag: Option<String>,
9235 },
9236 RawBlock(String),
9238}
9239
9240#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9242#[cfg_attr(feature = "bindings", derive(TS))]
9243pub enum FunctionSecurity {
9244 Definer,
9245 Invoker,
9246 None,
9248}
9249
9250impl CreateFunction {
9251 pub fn new(name: impl Into<String>) -> Self {
9252 Self {
9253 name: TableRef::new(name),
9254 parameters: Vec::new(),
9255 return_type: None,
9256 body: None,
9257 or_replace: false,
9258 or_alter: false,
9259 if_not_exists: false,
9260 temporary: false,
9261 language: None,
9262 deterministic: None,
9263 returns_null_on_null_input: None,
9264 security: None,
9265 has_parens: true,
9266 sql_data_access: None,
9267 returns_table_body: None,
9268 language_first: false,
9269 set_options: Vec::new(),
9270 strict: false,
9271 options: Vec::new(),
9272 is_table_function: false,
9273 property_order: Vec::new(),
9274 using_resources: Vec::new(),
9275 environment: Vec::new(),
9276 handler: None,
9277 handler_uses_eq: false,
9278 runtime_version: None,
9279 packages: None,
9280 parameter_style: None,
9281 }
9282 }
9283}
9284
9285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9287#[cfg_attr(feature = "bindings", derive(TS))]
9288pub struct DropFunction {
9289 pub name: TableRef,
9290 pub parameters: Option<Vec<DataType>>,
9291 pub if_exists: bool,
9292 pub cascade: bool,
9293}
9294
9295impl DropFunction {
9296 pub fn new(name: impl Into<String>) -> Self {
9297 Self {
9298 name: TableRef::new(name),
9299 parameters: None,
9300 if_exists: false,
9301 cascade: false,
9302 }
9303 }
9304}
9305
9306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9308#[cfg_attr(feature = "bindings", derive(TS))]
9309pub struct CreateProcedure {
9310 pub name: TableRef,
9311 pub parameters: Vec<FunctionParameter>,
9312 pub body: Option<FunctionBody>,
9313 pub or_replace: bool,
9314 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9316 pub or_alter: bool,
9317 pub if_not_exists: bool,
9318 pub language: Option<String>,
9319 pub security: Option<FunctionSecurity>,
9320 #[serde(default)]
9322 pub return_type: Option<DataType>,
9323 #[serde(default)]
9325 pub execute_as: Option<String>,
9326 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9328 pub with_options: Vec<String>,
9329 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9331 pub has_parens: bool,
9332 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9334 pub use_proc_keyword: bool,
9335}
9336
9337impl CreateProcedure {
9338 pub fn new(name: impl Into<String>) -> Self {
9339 Self {
9340 name: TableRef::new(name),
9341 parameters: Vec::new(),
9342 body: None,
9343 or_replace: false,
9344 or_alter: false,
9345 if_not_exists: false,
9346 language: None,
9347 security: None,
9348 return_type: None,
9349 execute_as: None,
9350 with_options: Vec::new(),
9351 has_parens: true,
9352 use_proc_keyword: false,
9353 }
9354 }
9355}
9356
9357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9359#[cfg_attr(feature = "bindings", derive(TS))]
9360pub struct DropProcedure {
9361 pub name: TableRef,
9362 pub parameters: Option<Vec<DataType>>,
9363 pub if_exists: bool,
9364 pub cascade: bool,
9365}
9366
9367impl DropProcedure {
9368 pub fn new(name: impl Into<String>) -> Self {
9369 Self {
9370 name: TableRef::new(name),
9371 parameters: None,
9372 if_exists: false,
9373 cascade: false,
9374 }
9375 }
9376}
9377
9378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9380#[cfg_attr(feature = "bindings", derive(TS))]
9381pub enum SeqPropKind {
9382 Start,
9383 Increment,
9384 Minvalue,
9385 Maxvalue,
9386 Cache,
9387 NoCache,
9388 Cycle,
9389 NoCycle,
9390 OwnedBy,
9391 Order,
9392 NoOrder,
9393 Comment,
9394 Sharing,
9396 Keep,
9398 NoKeep,
9400 Scale,
9402 NoScale,
9404 Shard,
9406 NoShard,
9408 Session,
9410 Global,
9412 NoCacheWord,
9414 NoCycleWord,
9416 NoMinvalueWord,
9418 NoMaxvalueWord,
9420}
9421
9422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9424#[cfg_attr(feature = "bindings", derive(TS))]
9425pub struct CreateSynonym {
9426 pub name: TableRef,
9428 pub target: TableRef,
9430}
9431
9432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9434#[cfg_attr(feature = "bindings", derive(TS))]
9435pub struct CreateSequence {
9436 pub name: TableRef,
9437 pub if_not_exists: bool,
9438 pub temporary: bool,
9439 #[serde(default)]
9440 pub or_replace: bool,
9441 #[serde(default, skip_serializing_if = "Option::is_none")]
9443 pub as_type: Option<DataType>,
9444 pub increment: Option<i64>,
9445 pub minvalue: Option<SequenceBound>,
9446 pub maxvalue: Option<SequenceBound>,
9447 pub start: Option<i64>,
9448 pub cache: Option<i64>,
9449 pub cycle: bool,
9450 pub owned_by: Option<TableRef>,
9451 #[serde(default)]
9453 pub owned_by_none: bool,
9454 #[serde(default)]
9456 pub order: Option<bool>,
9457 #[serde(default)]
9459 pub comment: Option<String>,
9460 #[serde(default, skip_serializing_if = "Option::is_none")]
9462 pub sharing: Option<String>,
9463 #[serde(default, skip_serializing_if = "Option::is_none")]
9465 pub scale_modifier: Option<String>,
9466 #[serde(default, skip_serializing_if = "Option::is_none")]
9468 pub shard_modifier: Option<String>,
9469 #[serde(default)]
9471 pub property_order: Vec<SeqPropKind>,
9472}
9473
9474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9476#[cfg_attr(feature = "bindings", derive(TS))]
9477pub enum SequenceBound {
9478 Value(i64),
9479 None,
9480}
9481
9482impl CreateSequence {
9483 pub fn new(name: impl Into<String>) -> Self {
9484 Self {
9485 name: TableRef::new(name),
9486 if_not_exists: false,
9487 temporary: false,
9488 or_replace: false,
9489 as_type: None,
9490 increment: None,
9491 minvalue: None,
9492 maxvalue: None,
9493 start: None,
9494 cache: None,
9495 cycle: false,
9496 owned_by: None,
9497 owned_by_none: false,
9498 order: None,
9499 comment: None,
9500 sharing: None,
9501 scale_modifier: None,
9502 shard_modifier: None,
9503 property_order: Vec::new(),
9504 }
9505 }
9506}
9507
9508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9510#[cfg_attr(feature = "bindings", derive(TS))]
9511pub struct DropSequence {
9512 pub name: TableRef,
9513 pub if_exists: bool,
9514 pub cascade: bool,
9515}
9516
9517impl DropSequence {
9518 pub fn new(name: impl Into<String>) -> Self {
9519 Self {
9520 name: TableRef::new(name),
9521 if_exists: false,
9522 cascade: false,
9523 }
9524 }
9525}
9526
9527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9529#[cfg_attr(feature = "bindings", derive(TS))]
9530pub struct AlterSequence {
9531 pub name: TableRef,
9532 pub if_exists: bool,
9533 pub increment: Option<i64>,
9534 pub minvalue: Option<SequenceBound>,
9535 pub maxvalue: Option<SequenceBound>,
9536 pub start: Option<i64>,
9537 pub restart: Option<Option<i64>>,
9538 pub cache: Option<i64>,
9539 pub cycle: Option<bool>,
9540 pub owned_by: Option<Option<TableRef>>,
9541}
9542
9543impl AlterSequence {
9544 pub fn new(name: impl Into<String>) -> Self {
9545 Self {
9546 name: TableRef::new(name),
9547 if_exists: false,
9548 increment: None,
9549 minvalue: None,
9550 maxvalue: None,
9551 start: None,
9552 restart: None,
9553 cache: None,
9554 cycle: None,
9555 owned_by: None,
9556 }
9557 }
9558}
9559
9560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9562#[cfg_attr(feature = "bindings", derive(TS))]
9563pub struct CreateTrigger {
9564 pub name: Identifier,
9565 pub table: TableRef,
9566 pub timing: TriggerTiming,
9567 pub events: Vec<TriggerEvent>,
9568 #[serde(default, skip_serializing_if = "Option::is_none")]
9569 pub for_each: Option<TriggerForEach>,
9570 pub when: Option<Expression>,
9571 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9573 pub when_paren: bool,
9574 pub body: TriggerBody,
9575 pub or_replace: bool,
9576 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9578 pub or_alter: bool,
9579 pub constraint: bool,
9580 pub deferrable: Option<bool>,
9581 pub initially_deferred: Option<bool>,
9582 pub referencing: Option<TriggerReferencing>,
9583}
9584
9585#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9587#[cfg_attr(feature = "bindings", derive(TS))]
9588pub enum TriggerTiming {
9589 Before,
9590 After,
9591 InsteadOf,
9592}
9593
9594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9596#[cfg_attr(feature = "bindings", derive(TS))]
9597pub enum TriggerEvent {
9598 Insert,
9599 Update(Option<Vec<Identifier>>),
9600 Delete,
9601 Truncate,
9602}
9603
9604#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9606#[cfg_attr(feature = "bindings", derive(TS))]
9607pub enum TriggerForEach {
9608 Row,
9609 Statement,
9610}
9611
9612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9614#[cfg_attr(feature = "bindings", derive(TS))]
9615pub enum TriggerBody {
9616 Execute {
9618 function: TableRef,
9619 args: Vec<Expression>,
9620 },
9621 Block(String),
9623}
9624
9625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9627#[cfg_attr(feature = "bindings", derive(TS))]
9628pub struct TriggerReferencing {
9629 pub old_table: Option<Identifier>,
9630 pub new_table: Option<Identifier>,
9631 pub old_row: Option<Identifier>,
9632 pub new_row: Option<Identifier>,
9633}
9634
9635impl CreateTrigger {
9636 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9637 Self {
9638 name: Identifier::new(name),
9639 table: TableRef::new(table),
9640 timing: TriggerTiming::Before,
9641 events: Vec::new(),
9642 for_each: Some(TriggerForEach::Row),
9643 when: None,
9644 when_paren: false,
9645 body: TriggerBody::Execute {
9646 function: TableRef::new(""),
9647 args: Vec::new(),
9648 },
9649 or_replace: false,
9650 or_alter: false,
9651 constraint: false,
9652 deferrable: None,
9653 initially_deferred: None,
9654 referencing: None,
9655 }
9656 }
9657}
9658
9659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9661#[cfg_attr(feature = "bindings", derive(TS))]
9662pub struct DropTrigger {
9663 pub name: Identifier,
9664 pub table: Option<TableRef>,
9665 pub if_exists: bool,
9666 pub cascade: bool,
9667}
9668
9669impl DropTrigger {
9670 pub fn new(name: impl Into<String>) -> Self {
9671 Self {
9672 name: Identifier::new(name),
9673 table: None,
9674 if_exists: false,
9675 cascade: false,
9676 }
9677 }
9678}
9679
9680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9682#[cfg_attr(feature = "bindings", derive(TS))]
9683pub struct CreateType {
9684 pub name: TableRef,
9685 pub definition: TypeDefinition,
9686 pub if_not_exists: bool,
9687}
9688
9689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9691#[cfg_attr(feature = "bindings", derive(TS))]
9692pub enum TypeDefinition {
9693 Enum(Vec<String>),
9695 Composite(Vec<TypeAttribute>),
9697 Range {
9699 subtype: DataType,
9700 subtype_diff: Option<String>,
9701 canonical: Option<String>,
9702 },
9703 Base {
9705 input: String,
9706 output: String,
9707 internallength: Option<i32>,
9708 },
9709 Domain {
9711 base_type: DataType,
9712 default: Option<Expression>,
9713 constraints: Vec<DomainConstraint>,
9714 },
9715}
9716
9717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9719#[cfg_attr(feature = "bindings", derive(TS))]
9720pub struct TypeAttribute {
9721 pub name: Identifier,
9722 pub data_type: DataType,
9723 pub collate: Option<Identifier>,
9724}
9725
9726#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9728#[cfg_attr(feature = "bindings", derive(TS))]
9729pub struct DomainConstraint {
9730 pub name: Option<Identifier>,
9731 pub check: Expression,
9732}
9733
9734impl CreateType {
9735 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9736 Self {
9737 name: TableRef::new(name),
9738 definition: TypeDefinition::Enum(values),
9739 if_not_exists: false,
9740 }
9741 }
9742
9743 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9744 Self {
9745 name: TableRef::new(name),
9746 definition: TypeDefinition::Composite(attributes),
9747 if_not_exists: false,
9748 }
9749 }
9750}
9751
9752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9754#[cfg_attr(feature = "bindings", derive(TS))]
9755pub struct DropType {
9756 pub name: TableRef,
9757 pub if_exists: bool,
9758 pub cascade: bool,
9759}
9760
9761impl DropType {
9762 pub fn new(name: impl Into<String>) -> Self {
9763 Self {
9764 name: TableRef::new(name),
9765 if_exists: false,
9766 cascade: false,
9767 }
9768 }
9769}
9770
9771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9773#[cfg_attr(feature = "bindings", derive(TS))]
9774pub struct Describe {
9775 pub target: Expression,
9777 pub extended: bool,
9779 pub formatted: bool,
9781 #[serde(default)]
9783 pub kind: Option<String>,
9784 #[serde(default)]
9786 pub properties: Vec<(String, String)>,
9787 #[serde(default, skip_serializing_if = "Option::is_none")]
9789 pub style: Option<String>,
9790 #[serde(default)]
9792 pub partition: Option<Box<Expression>>,
9793 #[serde(default)]
9795 pub leading_comments: Vec<String>,
9796 #[serde(default)]
9798 pub as_json: bool,
9799 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9801 pub params: Vec<String>,
9802}
9803
9804impl Describe {
9805 pub fn new(target: Expression) -> Self {
9806 Self {
9807 target,
9808 extended: false,
9809 formatted: false,
9810 kind: None,
9811 properties: Vec::new(),
9812 style: None,
9813 partition: None,
9814 leading_comments: Vec::new(),
9815 as_json: false,
9816 params: Vec::new(),
9817 }
9818 }
9819}
9820
9821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9823#[cfg_attr(feature = "bindings", derive(TS))]
9824pub struct Show {
9825 pub this: String,
9827 #[serde(default)]
9829 pub terse: bool,
9830 #[serde(default)]
9832 pub history: bool,
9833 pub like: Option<Expression>,
9835 pub scope_kind: Option<String>,
9837 pub scope: Option<Expression>,
9839 pub starts_with: Option<Expression>,
9841 pub limit: Option<Box<Limit>>,
9843 pub from: Option<Expression>,
9845 #[serde(default, skip_serializing_if = "Option::is_none")]
9847 pub where_clause: Option<Expression>,
9848 #[serde(default, skip_serializing_if = "Option::is_none")]
9850 pub for_target: Option<Expression>,
9851 #[serde(default, skip_serializing_if = "Option::is_none")]
9853 pub db: Option<Expression>,
9854 #[serde(default, skip_serializing_if = "Option::is_none")]
9856 pub target: Option<Expression>,
9857 #[serde(default, skip_serializing_if = "Option::is_none")]
9859 pub mutex: Option<bool>,
9860 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9862 pub privileges: Vec<String>,
9863}
9864
9865impl Show {
9866 pub fn new(this: impl Into<String>) -> Self {
9867 Self {
9868 this: this.into(),
9869 terse: false,
9870 history: false,
9871 like: None,
9872 scope_kind: None,
9873 scope: None,
9874 starts_with: None,
9875 limit: None,
9876 from: None,
9877 where_clause: None,
9878 for_target: None,
9879 db: None,
9880 target: None,
9881 mutex: None,
9882 privileges: Vec::new(),
9883 }
9884 }
9885}
9886
9887#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9892#[cfg_attr(feature = "bindings", derive(TS))]
9893pub struct Paren {
9894 pub this: Expression,
9896 #[serde(default)]
9897 pub trailing_comments: Vec<String>,
9898}
9899
9900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9902#[cfg_attr(feature = "bindings", derive(TS))]
9903pub struct Annotated {
9904 pub this: Expression,
9905 pub trailing_comments: Vec<String>,
9906}
9907
9908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9913#[cfg_attr(feature = "bindings", derive(TS))]
9914pub struct Refresh {
9915 pub this: Box<Expression>,
9916 pub kind: String,
9917}
9918
9919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9921#[cfg_attr(feature = "bindings", derive(TS))]
9922pub struct LockingStatement {
9923 pub this: Box<Expression>,
9924 pub expression: Box<Expression>,
9925}
9926
9927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9929#[cfg_attr(feature = "bindings", derive(TS))]
9930pub struct SequenceProperties {
9931 #[serde(default)]
9932 pub increment: Option<Box<Expression>>,
9933 #[serde(default)]
9934 pub minvalue: Option<Box<Expression>>,
9935 #[serde(default)]
9936 pub maxvalue: Option<Box<Expression>>,
9937 #[serde(default)]
9938 pub cache: Option<Box<Expression>>,
9939 #[serde(default)]
9940 pub start: Option<Box<Expression>>,
9941 #[serde(default)]
9942 pub owned: Option<Box<Expression>>,
9943 #[serde(default)]
9944 pub options: Vec<Expression>,
9945}
9946
9947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9949#[cfg_attr(feature = "bindings", derive(TS))]
9950pub struct TruncateTable {
9951 #[serde(default)]
9952 pub expressions: Vec<Expression>,
9953 #[serde(default)]
9954 pub is_database: Option<Box<Expression>>,
9955 #[serde(default)]
9956 pub exists: bool,
9957 #[serde(default)]
9958 pub only: Option<Box<Expression>>,
9959 #[serde(default)]
9960 pub cluster: Option<Box<Expression>>,
9961 #[serde(default)]
9962 pub identity: Option<Box<Expression>>,
9963 #[serde(default)]
9964 pub option: Option<Box<Expression>>,
9965 #[serde(default)]
9966 pub partition: Option<Box<Expression>>,
9967}
9968
9969#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9971#[cfg_attr(feature = "bindings", derive(TS))]
9972pub struct Clone {
9973 pub this: Box<Expression>,
9974 #[serde(default)]
9975 pub shallow: Option<Box<Expression>>,
9976 #[serde(default)]
9977 pub copy: Option<Box<Expression>>,
9978}
9979
9980#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9982#[cfg_attr(feature = "bindings", derive(TS))]
9983pub struct Attach {
9984 pub this: Box<Expression>,
9985 #[serde(default)]
9986 pub exists: bool,
9987 #[serde(default)]
9988 pub expressions: Vec<Expression>,
9989}
9990
9991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9993#[cfg_attr(feature = "bindings", derive(TS))]
9994pub struct Detach {
9995 pub this: Box<Expression>,
9996 #[serde(default)]
9997 pub exists: bool,
9998}
9999
10000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10002#[cfg_attr(feature = "bindings", derive(TS))]
10003pub struct Install {
10004 pub this: Box<Expression>,
10005 #[serde(default)]
10006 pub from_: Option<Box<Expression>>,
10007 #[serde(default)]
10008 pub force: Option<Box<Expression>>,
10009}
10010
10011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10013#[cfg_attr(feature = "bindings", derive(TS))]
10014pub struct Summarize {
10015 pub this: Box<Expression>,
10016 #[serde(default)]
10017 pub table: Option<Box<Expression>>,
10018}
10019
10020#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10022#[cfg_attr(feature = "bindings", derive(TS))]
10023pub struct Declare {
10024 #[serde(default)]
10025 pub expressions: Vec<Expression>,
10026 #[serde(default)]
10027 pub replace: bool,
10028}
10029
10030#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10032#[cfg_attr(feature = "bindings", derive(TS))]
10033pub struct DeclareItem {
10034 pub this: Box<Expression>,
10035 #[serde(default)]
10036 pub kind: Option<String>,
10037 #[serde(default)]
10038 pub default: Option<Box<Expression>>,
10039 #[serde(default)]
10040 pub has_as: bool,
10041 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10043 pub additional_names: Vec<Expression>,
10044}
10045
10046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10048#[cfg_attr(feature = "bindings", derive(TS))]
10049pub struct Set {
10050 #[serde(default)]
10051 pub expressions: Vec<Expression>,
10052 #[serde(default)]
10053 pub unset: Option<Box<Expression>>,
10054 #[serde(default)]
10055 pub tag: Option<Box<Expression>>,
10056}
10057
10058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10060#[cfg_attr(feature = "bindings", derive(TS))]
10061pub struct Heredoc {
10062 pub this: Box<Expression>,
10063 #[serde(default)]
10064 pub tag: Option<Box<Expression>>,
10065}
10066
10067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10069#[cfg_attr(feature = "bindings", derive(TS))]
10070pub struct QueryBand {
10071 pub this: Box<Expression>,
10072 #[serde(default)]
10073 pub scope: Option<Box<Expression>>,
10074 #[serde(default)]
10075 pub update: Option<Box<Expression>>,
10076}
10077
10078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10080#[cfg_attr(feature = "bindings", derive(TS))]
10081pub struct UserDefinedFunction {
10082 pub this: Box<Expression>,
10083 #[serde(default)]
10084 pub expressions: Vec<Expression>,
10085 #[serde(default)]
10086 pub wrapped: Option<Box<Expression>>,
10087}
10088
10089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10091#[cfg_attr(feature = "bindings", derive(TS))]
10092pub struct RecursiveWithSearch {
10093 pub kind: String,
10094 pub this: Box<Expression>,
10095 pub expression: Box<Expression>,
10096 #[serde(default)]
10097 pub using: Option<Box<Expression>>,
10098}
10099
10100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10102#[cfg_attr(feature = "bindings", derive(TS))]
10103pub struct ProjectionDef {
10104 pub this: Box<Expression>,
10105 pub expression: Box<Expression>,
10106}
10107
10108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10110#[cfg_attr(feature = "bindings", derive(TS))]
10111pub struct TableAlias {
10112 #[serde(default)]
10113 pub this: Option<Box<Expression>>,
10114 #[serde(default)]
10115 pub columns: Vec<Expression>,
10116}
10117
10118#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10120#[cfg_attr(feature = "bindings", derive(TS))]
10121pub struct ByteString {
10122 pub this: Box<Expression>,
10123 #[serde(default)]
10124 pub is_bytes: Option<Box<Expression>>,
10125}
10126
10127#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10130#[cfg_attr(feature = "bindings", derive(TS))]
10131pub struct HexStringExpr {
10132 pub this: Box<Expression>,
10133 #[serde(default)]
10134 pub is_integer: Option<bool>,
10135}
10136
10137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10139#[cfg_attr(feature = "bindings", derive(TS))]
10140pub struct UnicodeString {
10141 pub this: Box<Expression>,
10142 #[serde(default)]
10143 pub escape: Option<Box<Expression>>,
10144}
10145
10146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10148#[cfg_attr(feature = "bindings", derive(TS))]
10149pub struct AlterColumn {
10150 pub this: Box<Expression>,
10151 #[serde(default)]
10152 pub dtype: Option<Box<Expression>>,
10153 #[serde(default)]
10154 pub collate: Option<Box<Expression>>,
10155 #[serde(default)]
10156 pub using: Option<Box<Expression>>,
10157 #[serde(default)]
10158 pub default: Option<Box<Expression>>,
10159 #[serde(default)]
10160 pub drop: Option<Box<Expression>>,
10161 #[serde(default)]
10162 pub comment: Option<Box<Expression>>,
10163 #[serde(default)]
10164 pub allow_null: Option<Box<Expression>>,
10165 #[serde(default)]
10166 pub visible: Option<Box<Expression>>,
10167 #[serde(default)]
10168 pub rename_to: Option<Box<Expression>>,
10169}
10170
10171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10173#[cfg_attr(feature = "bindings", derive(TS))]
10174pub struct AlterSortKey {
10175 #[serde(default)]
10176 pub this: Option<Box<Expression>>,
10177 #[serde(default)]
10178 pub expressions: Vec<Expression>,
10179 #[serde(default)]
10180 pub compound: Option<Box<Expression>>,
10181}
10182
10183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10185#[cfg_attr(feature = "bindings", derive(TS))]
10186pub struct AlterSet {
10187 #[serde(default)]
10188 pub expressions: Vec<Expression>,
10189 #[serde(default)]
10190 pub option: Option<Box<Expression>>,
10191 #[serde(default)]
10192 pub tablespace: Option<Box<Expression>>,
10193 #[serde(default)]
10194 pub access_method: Option<Box<Expression>>,
10195 #[serde(default)]
10196 pub file_format: Option<Box<Expression>>,
10197 #[serde(default)]
10198 pub copy_options: Option<Box<Expression>>,
10199 #[serde(default)]
10200 pub tag: Option<Box<Expression>>,
10201 #[serde(default)]
10202 pub location: Option<Box<Expression>>,
10203 #[serde(default)]
10204 pub serde: Option<Box<Expression>>,
10205}
10206
10207#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10209#[cfg_attr(feature = "bindings", derive(TS))]
10210pub struct RenameColumn {
10211 pub this: Box<Expression>,
10212 #[serde(default)]
10213 pub to: Option<Box<Expression>>,
10214 #[serde(default)]
10215 pub exists: bool,
10216}
10217
10218#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10220#[cfg_attr(feature = "bindings", derive(TS))]
10221pub struct Comprehension {
10222 pub this: Box<Expression>,
10223 pub expression: Box<Expression>,
10224 #[serde(default)]
10225 pub position: Option<Box<Expression>>,
10226 #[serde(default)]
10227 pub iterator: Option<Box<Expression>>,
10228 #[serde(default)]
10229 pub condition: Option<Box<Expression>>,
10230}
10231
10232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10234#[cfg_attr(feature = "bindings", derive(TS))]
10235pub struct MergeTreeTTLAction {
10236 pub this: Box<Expression>,
10237 #[serde(default)]
10238 pub delete: Option<Box<Expression>>,
10239 #[serde(default)]
10240 pub recompress: Option<Box<Expression>>,
10241 #[serde(default)]
10242 pub to_disk: Option<Box<Expression>>,
10243 #[serde(default)]
10244 pub to_volume: Option<Box<Expression>>,
10245}
10246
10247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10249#[cfg_attr(feature = "bindings", derive(TS))]
10250pub struct MergeTreeTTL {
10251 #[serde(default)]
10252 pub expressions: Vec<Expression>,
10253 #[serde(default)]
10254 pub where_: Option<Box<Expression>>,
10255 #[serde(default)]
10256 pub group: Option<Box<Expression>>,
10257 #[serde(default)]
10258 pub aggregates: Option<Box<Expression>>,
10259}
10260
10261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10263#[cfg_attr(feature = "bindings", derive(TS))]
10264pub struct IndexConstraintOption {
10265 #[serde(default)]
10266 pub key_block_size: Option<Box<Expression>>,
10267 #[serde(default)]
10268 pub using: Option<Box<Expression>>,
10269 #[serde(default)]
10270 pub parser: Option<Box<Expression>>,
10271 #[serde(default)]
10272 pub comment: Option<Box<Expression>>,
10273 #[serde(default)]
10274 pub visible: Option<Box<Expression>>,
10275 #[serde(default)]
10276 pub engine_attr: Option<Box<Expression>>,
10277 #[serde(default)]
10278 pub secondary_engine_attr: Option<Box<Expression>>,
10279}
10280
10281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10283#[cfg_attr(feature = "bindings", derive(TS))]
10284pub struct PeriodForSystemTimeConstraint {
10285 pub this: Box<Expression>,
10286 pub expression: Box<Expression>,
10287}
10288
10289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10291#[cfg_attr(feature = "bindings", derive(TS))]
10292pub struct CaseSpecificColumnConstraint {
10293 #[serde(default)]
10294 pub not_: Option<Box<Expression>>,
10295}
10296
10297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10299#[cfg_attr(feature = "bindings", derive(TS))]
10300pub struct CharacterSetColumnConstraint {
10301 pub this: Box<Expression>,
10302}
10303
10304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10306#[cfg_attr(feature = "bindings", derive(TS))]
10307pub struct CheckColumnConstraint {
10308 pub this: Box<Expression>,
10309 #[serde(default)]
10310 pub enforced: Option<Box<Expression>>,
10311}
10312
10313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10315#[cfg_attr(feature = "bindings", derive(TS))]
10316pub struct AssumeColumnConstraint {
10317 pub this: Box<Expression>,
10318}
10319
10320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10322#[cfg_attr(feature = "bindings", derive(TS))]
10323pub struct CompressColumnConstraint {
10324 #[serde(default)]
10325 pub this: Option<Box<Expression>>,
10326}
10327
10328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10330#[cfg_attr(feature = "bindings", derive(TS))]
10331pub struct DateFormatColumnConstraint {
10332 pub this: Box<Expression>,
10333}
10334
10335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10337#[cfg_attr(feature = "bindings", derive(TS))]
10338pub struct EphemeralColumnConstraint {
10339 #[serde(default)]
10340 pub this: Option<Box<Expression>>,
10341}
10342
10343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10345#[cfg_attr(feature = "bindings", derive(TS))]
10346pub struct WithOperator {
10347 pub this: Box<Expression>,
10348 pub op: String,
10349}
10350
10351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10353#[cfg_attr(feature = "bindings", derive(TS))]
10354pub struct GeneratedAsIdentityColumnConstraint {
10355 #[serde(default)]
10356 pub this: Option<Box<Expression>>,
10357 #[serde(default)]
10358 pub expression: Option<Box<Expression>>,
10359 #[serde(default)]
10360 pub on_null: Option<Box<Expression>>,
10361 #[serde(default)]
10362 pub start: Option<Box<Expression>>,
10363 #[serde(default)]
10364 pub increment: Option<Box<Expression>>,
10365 #[serde(default)]
10366 pub minvalue: Option<Box<Expression>>,
10367 #[serde(default)]
10368 pub maxvalue: Option<Box<Expression>>,
10369 #[serde(default)]
10370 pub cycle: Option<Box<Expression>>,
10371 #[serde(default)]
10372 pub order: Option<Box<Expression>>,
10373}
10374
10375#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10378#[cfg_attr(feature = "bindings", derive(TS))]
10379pub struct AutoIncrementColumnConstraint;
10380
10381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10383#[cfg_attr(feature = "bindings", derive(TS))]
10384pub struct CommentColumnConstraint;
10385
10386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10388#[cfg_attr(feature = "bindings", derive(TS))]
10389pub struct GeneratedAsRowColumnConstraint {
10390 #[serde(default)]
10391 pub start: Option<Box<Expression>>,
10392 #[serde(default)]
10393 pub hidden: Option<Box<Expression>>,
10394}
10395
10396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10398#[cfg_attr(feature = "bindings", derive(TS))]
10399pub struct IndexColumnConstraint {
10400 #[serde(default)]
10401 pub this: Option<Box<Expression>>,
10402 #[serde(default)]
10403 pub expressions: Vec<Expression>,
10404 #[serde(default)]
10405 pub kind: Option<String>,
10406 #[serde(default)]
10407 pub index_type: Option<Box<Expression>>,
10408 #[serde(default)]
10409 pub options: Vec<Expression>,
10410 #[serde(default)]
10411 pub expression: Option<Box<Expression>>,
10412 #[serde(default)]
10413 pub granularity: Option<Box<Expression>>,
10414}
10415
10416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10418#[cfg_attr(feature = "bindings", derive(TS))]
10419pub struct MaskingPolicyColumnConstraint {
10420 pub this: Box<Expression>,
10421 #[serde(default)]
10422 pub expressions: Vec<Expression>,
10423}
10424
10425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10427#[cfg_attr(feature = "bindings", derive(TS))]
10428pub struct NotNullColumnConstraint {
10429 #[serde(default)]
10430 pub allow_null: Option<Box<Expression>>,
10431}
10432
10433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10435#[cfg_attr(feature = "bindings", derive(TS))]
10436pub struct DefaultColumnConstraint {
10437 pub this: Box<Expression>,
10438 #[serde(default, skip_serializing_if = "Option::is_none")]
10440 pub for_column: Option<Identifier>,
10441}
10442
10443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10445#[cfg_attr(feature = "bindings", derive(TS))]
10446pub struct PrimaryKeyColumnConstraint {
10447 #[serde(default)]
10448 pub desc: Option<Box<Expression>>,
10449 #[serde(default)]
10450 pub options: Vec<Expression>,
10451}
10452
10453#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10455#[cfg_attr(feature = "bindings", derive(TS))]
10456pub struct UniqueColumnConstraint {
10457 #[serde(default)]
10458 pub this: Option<Box<Expression>>,
10459 #[serde(default)]
10460 pub index_type: Option<Box<Expression>>,
10461 #[serde(default)]
10462 pub on_conflict: Option<Box<Expression>>,
10463 #[serde(default)]
10464 pub nulls: Option<Box<Expression>>,
10465 #[serde(default)]
10466 pub options: Vec<Expression>,
10467}
10468
10469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10471#[cfg_attr(feature = "bindings", derive(TS))]
10472pub struct WatermarkColumnConstraint {
10473 pub this: Box<Expression>,
10474 pub expression: Box<Expression>,
10475}
10476
10477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10479#[cfg_attr(feature = "bindings", derive(TS))]
10480pub struct ComputedColumnConstraint {
10481 pub this: Box<Expression>,
10482 #[serde(default)]
10483 pub persisted: Option<Box<Expression>>,
10484 #[serde(default)]
10485 pub not_null: Option<Box<Expression>>,
10486 #[serde(default)]
10487 pub data_type: Option<Box<Expression>>,
10488}
10489
10490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10492#[cfg_attr(feature = "bindings", derive(TS))]
10493pub struct InOutColumnConstraint {
10494 #[serde(default)]
10495 pub input_: Option<Box<Expression>>,
10496 #[serde(default)]
10497 pub output: Option<Box<Expression>>,
10498}
10499
10500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10502#[cfg_attr(feature = "bindings", derive(TS))]
10503pub struct PathColumnConstraint {
10504 pub this: Box<Expression>,
10505}
10506
10507#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10509#[cfg_attr(feature = "bindings", derive(TS))]
10510pub struct Constraint {
10511 pub this: Box<Expression>,
10512 #[serde(default)]
10513 pub expressions: Vec<Expression>,
10514}
10515
10516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10518#[cfg_attr(feature = "bindings", derive(TS))]
10519pub struct Export {
10520 pub this: Box<Expression>,
10521 #[serde(default)]
10522 pub connection: Option<Box<Expression>>,
10523 #[serde(default)]
10524 pub options: Vec<Expression>,
10525}
10526
10527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10529#[cfg_attr(feature = "bindings", derive(TS))]
10530pub struct Filter {
10531 pub this: Box<Expression>,
10532 pub expression: Box<Expression>,
10533}
10534
10535#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10537#[cfg_attr(feature = "bindings", derive(TS))]
10538pub struct Changes {
10539 #[serde(default)]
10540 pub information: Option<Box<Expression>>,
10541 #[serde(default)]
10542 pub at_before: Option<Box<Expression>>,
10543 #[serde(default)]
10544 pub end: Option<Box<Expression>>,
10545}
10546
10547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10549#[cfg_attr(feature = "bindings", derive(TS))]
10550pub struct Directory {
10551 pub this: Box<Expression>,
10552 #[serde(default)]
10553 pub local: Option<Box<Expression>>,
10554 #[serde(default)]
10555 pub row_format: Option<Box<Expression>>,
10556}
10557
10558#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10560#[cfg_attr(feature = "bindings", derive(TS))]
10561pub struct ForeignKey {
10562 #[serde(default)]
10563 pub expressions: Vec<Expression>,
10564 #[serde(default)]
10565 pub reference: Option<Box<Expression>>,
10566 #[serde(default)]
10567 pub delete: Option<Box<Expression>>,
10568 #[serde(default)]
10569 pub update: Option<Box<Expression>>,
10570 #[serde(default)]
10571 pub options: Vec<Expression>,
10572}
10573
10574#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10576#[cfg_attr(feature = "bindings", derive(TS))]
10577pub struct ColumnPrefix {
10578 pub this: Box<Expression>,
10579 pub expression: Box<Expression>,
10580}
10581
10582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10584#[cfg_attr(feature = "bindings", derive(TS))]
10585pub struct PrimaryKey {
10586 #[serde(default)]
10587 pub this: Option<Box<Expression>>,
10588 #[serde(default)]
10589 pub expressions: Vec<Expression>,
10590 #[serde(default)]
10591 pub options: Vec<Expression>,
10592 #[serde(default)]
10593 pub include: Option<Box<Expression>>,
10594}
10595
10596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10598#[cfg_attr(feature = "bindings", derive(TS))]
10599pub struct IntoClause {
10600 #[serde(default)]
10601 pub this: Option<Box<Expression>>,
10602 #[serde(default)]
10603 pub temporary: bool,
10604 #[serde(default)]
10605 pub unlogged: Option<Box<Expression>>,
10606 #[serde(default)]
10607 pub bulk_collect: Option<Box<Expression>>,
10608 #[serde(default)]
10609 pub expressions: Vec<Expression>,
10610}
10611
10612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10614#[cfg_attr(feature = "bindings", derive(TS))]
10615pub struct JoinHint {
10616 pub this: Box<Expression>,
10617 #[serde(default)]
10618 pub expressions: Vec<Expression>,
10619}
10620
10621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10623#[cfg_attr(feature = "bindings", derive(TS))]
10624pub struct Opclass {
10625 pub this: Box<Expression>,
10626 pub expression: Box<Expression>,
10627}
10628
10629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10631#[cfg_attr(feature = "bindings", derive(TS))]
10632pub struct Index {
10633 #[serde(default)]
10634 pub this: Option<Box<Expression>>,
10635 #[serde(default)]
10636 pub table: Option<Box<Expression>>,
10637 #[serde(default)]
10638 pub unique: bool,
10639 #[serde(default)]
10640 pub primary: Option<Box<Expression>>,
10641 #[serde(default)]
10642 pub amp: Option<Box<Expression>>,
10643 #[serde(default)]
10644 pub params: Vec<Expression>,
10645}
10646
10647#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10649#[cfg_attr(feature = "bindings", derive(TS))]
10650pub struct IndexParameters {
10651 #[serde(default)]
10652 pub using: Option<Box<Expression>>,
10653 #[serde(default)]
10654 pub include: Option<Box<Expression>>,
10655 #[serde(default)]
10656 pub columns: Vec<Expression>,
10657 #[serde(default)]
10658 pub with_storage: Option<Box<Expression>>,
10659 #[serde(default)]
10660 pub partition_by: Option<Box<Expression>>,
10661 #[serde(default)]
10662 pub tablespace: Option<Box<Expression>>,
10663 #[serde(default)]
10664 pub where_: Option<Box<Expression>>,
10665 #[serde(default)]
10666 pub on: Option<Box<Expression>>,
10667}
10668
10669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10671#[cfg_attr(feature = "bindings", derive(TS))]
10672pub struct ConditionalInsert {
10673 pub this: Box<Expression>,
10674 #[serde(default)]
10675 pub expression: Option<Box<Expression>>,
10676 #[serde(default)]
10677 pub else_: Option<Box<Expression>>,
10678}
10679
10680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10682#[cfg_attr(feature = "bindings", derive(TS))]
10683pub struct MultitableInserts {
10684 #[serde(default)]
10685 pub expressions: Vec<Expression>,
10686 pub kind: String,
10687 #[serde(default)]
10688 pub source: Option<Box<Expression>>,
10689 #[serde(default)]
10691 pub leading_comments: Vec<String>,
10692 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10694 pub overwrite: bool,
10695}
10696
10697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10699#[cfg_attr(feature = "bindings", derive(TS))]
10700pub struct OnConflict {
10701 #[serde(default)]
10702 pub duplicate: Option<Box<Expression>>,
10703 #[serde(default)]
10704 pub expressions: Vec<Expression>,
10705 #[serde(default)]
10706 pub action: Option<Box<Expression>>,
10707 #[serde(default)]
10708 pub conflict_keys: Option<Box<Expression>>,
10709 #[serde(default)]
10710 pub index_predicate: Option<Box<Expression>>,
10711 #[serde(default)]
10712 pub constraint: Option<Box<Expression>>,
10713 #[serde(default)]
10714 pub where_: Option<Box<Expression>>,
10715}
10716
10717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10719#[cfg_attr(feature = "bindings", derive(TS))]
10720pub struct OnCondition {
10721 #[serde(default)]
10722 pub error: Option<Box<Expression>>,
10723 #[serde(default)]
10724 pub empty: Option<Box<Expression>>,
10725 #[serde(default)]
10726 pub null: Option<Box<Expression>>,
10727}
10728
10729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10731#[cfg_attr(feature = "bindings", derive(TS))]
10732pub struct Returning {
10733 #[serde(default)]
10734 pub expressions: Vec<Expression>,
10735 #[serde(default)]
10736 pub into: Option<Box<Expression>>,
10737}
10738
10739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10741#[cfg_attr(feature = "bindings", derive(TS))]
10742pub struct Introducer {
10743 pub this: Box<Expression>,
10744 pub expression: Box<Expression>,
10745}
10746
10747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10749#[cfg_attr(feature = "bindings", derive(TS))]
10750pub struct PartitionRange {
10751 pub this: Box<Expression>,
10752 #[serde(default)]
10753 pub expression: Option<Box<Expression>>,
10754 #[serde(default)]
10755 pub expressions: Vec<Expression>,
10756}
10757
10758#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10760#[cfg_attr(feature = "bindings", derive(TS))]
10761pub struct Group {
10762 #[serde(default)]
10763 pub expressions: Vec<Expression>,
10764 #[serde(default)]
10765 pub grouping_sets: Option<Box<Expression>>,
10766 #[serde(default)]
10767 pub cube: Option<Box<Expression>>,
10768 #[serde(default)]
10769 pub rollup: Option<Box<Expression>>,
10770 #[serde(default)]
10771 pub totals: Option<Box<Expression>>,
10772 #[serde(default)]
10774 pub all: Option<bool>,
10775}
10776
10777#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10779#[cfg_attr(feature = "bindings", derive(TS))]
10780pub struct Cube {
10781 #[serde(default)]
10782 pub expressions: Vec<Expression>,
10783}
10784
10785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10787#[cfg_attr(feature = "bindings", derive(TS))]
10788pub struct Rollup {
10789 #[serde(default)]
10790 pub expressions: Vec<Expression>,
10791}
10792
10793#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10795#[cfg_attr(feature = "bindings", derive(TS))]
10796pub struct GroupingSets {
10797 #[serde(default)]
10798 pub expressions: Vec<Expression>,
10799}
10800
10801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10803#[cfg_attr(feature = "bindings", derive(TS))]
10804pub struct LimitOptions {
10805 #[serde(default)]
10806 pub percent: Option<Box<Expression>>,
10807 #[serde(default)]
10808 pub rows: Option<Box<Expression>>,
10809 #[serde(default)]
10810 pub with_ties: Option<Box<Expression>>,
10811}
10812
10813#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10815#[cfg_attr(feature = "bindings", derive(TS))]
10816pub struct Lateral {
10817 pub this: Box<Expression>,
10818 #[serde(default)]
10819 pub view: Option<Box<Expression>>,
10820 #[serde(default)]
10821 pub outer: Option<Box<Expression>>,
10822 #[serde(default)]
10823 pub alias: Option<String>,
10824 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10826 pub alias_quoted: bool,
10827 #[serde(default)]
10828 pub cross_apply: Option<Box<Expression>>,
10829 #[serde(default)]
10830 pub ordinality: Option<Box<Expression>>,
10831 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10833 pub column_aliases: Vec<String>,
10834}
10835
10836#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10838#[cfg_attr(feature = "bindings", derive(TS))]
10839pub struct TableFromRows {
10840 pub this: Box<Expression>,
10841 #[serde(default)]
10842 pub alias: Option<String>,
10843 #[serde(default)]
10844 pub joins: Vec<Expression>,
10845 #[serde(default)]
10846 pub pivots: Option<Box<Expression>>,
10847 #[serde(default)]
10848 pub sample: Option<Box<Expression>>,
10849}
10850
10851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10854#[cfg_attr(feature = "bindings", derive(TS))]
10855pub struct RowsFrom {
10856 pub expressions: Vec<Expression>,
10858 #[serde(default)]
10860 pub ordinality: bool,
10861 #[serde(default)]
10863 pub alias: Option<Box<Expression>>,
10864}
10865
10866#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10868#[cfg_attr(feature = "bindings", derive(TS))]
10869pub struct WithFill {
10870 #[serde(default)]
10871 pub from_: Option<Box<Expression>>,
10872 #[serde(default)]
10873 pub to: Option<Box<Expression>>,
10874 #[serde(default)]
10875 pub step: Option<Box<Expression>>,
10876 #[serde(default)]
10877 pub staleness: Option<Box<Expression>>,
10878 #[serde(default)]
10879 pub interpolate: Option<Box<Expression>>,
10880}
10881
10882#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10884#[cfg_attr(feature = "bindings", derive(TS))]
10885pub struct Property {
10886 pub this: Box<Expression>,
10887 #[serde(default)]
10888 pub value: Option<Box<Expression>>,
10889}
10890
10891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10893#[cfg_attr(feature = "bindings", derive(TS))]
10894pub struct GrantPrivilege {
10895 pub this: Box<Expression>,
10896 #[serde(default)]
10897 pub expressions: Vec<Expression>,
10898}
10899
10900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10902#[cfg_attr(feature = "bindings", derive(TS))]
10903pub struct AllowedValuesProperty {
10904 #[serde(default)]
10905 pub expressions: Vec<Expression>,
10906}
10907
10908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10910#[cfg_attr(feature = "bindings", derive(TS))]
10911pub struct AlgorithmProperty {
10912 pub this: Box<Expression>,
10913}
10914
10915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10917#[cfg_attr(feature = "bindings", derive(TS))]
10918pub struct AutoIncrementProperty {
10919 pub this: Box<Expression>,
10920}
10921
10922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10924#[cfg_attr(feature = "bindings", derive(TS))]
10925pub struct AutoRefreshProperty {
10926 pub this: Box<Expression>,
10927}
10928
10929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10931#[cfg_attr(feature = "bindings", derive(TS))]
10932pub struct BackupProperty {
10933 pub this: Box<Expression>,
10934}
10935
10936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10938#[cfg_attr(feature = "bindings", derive(TS))]
10939pub struct BuildProperty {
10940 pub this: Box<Expression>,
10941}
10942
10943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10945#[cfg_attr(feature = "bindings", derive(TS))]
10946pub struct BlockCompressionProperty {
10947 #[serde(default)]
10948 pub autotemp: Option<Box<Expression>>,
10949 #[serde(default)]
10950 pub always: Option<Box<Expression>>,
10951 #[serde(default)]
10952 pub default: Option<Box<Expression>>,
10953 #[serde(default)]
10954 pub manual: Option<Box<Expression>>,
10955 #[serde(default)]
10956 pub never: Option<Box<Expression>>,
10957}
10958
10959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10961#[cfg_attr(feature = "bindings", derive(TS))]
10962pub struct CharacterSetProperty {
10963 pub this: Box<Expression>,
10964 #[serde(default)]
10965 pub default: Option<Box<Expression>>,
10966}
10967
10968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10970#[cfg_attr(feature = "bindings", derive(TS))]
10971pub struct ChecksumProperty {
10972 #[serde(default)]
10973 pub on: Option<Box<Expression>>,
10974 #[serde(default)]
10975 pub default: Option<Box<Expression>>,
10976}
10977
10978#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10980#[cfg_attr(feature = "bindings", derive(TS))]
10981pub struct CollateProperty {
10982 pub this: Box<Expression>,
10983 #[serde(default)]
10984 pub default: Option<Box<Expression>>,
10985}
10986
10987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10989#[cfg_attr(feature = "bindings", derive(TS))]
10990pub struct DataBlocksizeProperty {
10991 #[serde(default)]
10992 pub size: Option<i64>,
10993 #[serde(default)]
10994 pub units: Option<Box<Expression>>,
10995 #[serde(default)]
10996 pub minimum: Option<Box<Expression>>,
10997 #[serde(default)]
10998 pub maximum: Option<Box<Expression>>,
10999 #[serde(default)]
11000 pub default: Option<Box<Expression>>,
11001}
11002
11003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11005#[cfg_attr(feature = "bindings", derive(TS))]
11006pub struct DataDeletionProperty {
11007 pub on: Box<Expression>,
11008 #[serde(default)]
11009 pub filter_column: Option<Box<Expression>>,
11010 #[serde(default)]
11011 pub retention_period: Option<Box<Expression>>,
11012}
11013
11014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11016#[cfg_attr(feature = "bindings", derive(TS))]
11017pub struct DefinerProperty {
11018 pub this: Box<Expression>,
11019}
11020
11021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11023#[cfg_attr(feature = "bindings", derive(TS))]
11024pub struct DistKeyProperty {
11025 pub this: Box<Expression>,
11026}
11027
11028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11030#[cfg_attr(feature = "bindings", derive(TS))]
11031pub struct DistributedByProperty {
11032 #[serde(default)]
11033 pub expressions: Vec<Expression>,
11034 pub kind: String,
11035 #[serde(default)]
11036 pub buckets: Option<Box<Expression>>,
11037 #[serde(default)]
11038 pub order: Option<Box<Expression>>,
11039}
11040
11041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11043#[cfg_attr(feature = "bindings", derive(TS))]
11044pub struct DistStyleProperty {
11045 pub this: Box<Expression>,
11046}
11047
11048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11050#[cfg_attr(feature = "bindings", derive(TS))]
11051pub struct DuplicateKeyProperty {
11052 #[serde(default)]
11053 pub expressions: Vec<Expression>,
11054}
11055
11056#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11058#[cfg_attr(feature = "bindings", derive(TS))]
11059pub struct EngineProperty {
11060 pub this: Box<Expression>,
11061}
11062
11063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11065#[cfg_attr(feature = "bindings", derive(TS))]
11066pub struct ToTableProperty {
11067 pub this: Box<Expression>,
11068}
11069
11070#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11072#[cfg_attr(feature = "bindings", derive(TS))]
11073pub struct ExecuteAsProperty {
11074 pub this: Box<Expression>,
11075}
11076
11077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11079#[cfg_attr(feature = "bindings", derive(TS))]
11080pub struct ExternalProperty {
11081 #[serde(default)]
11082 pub this: Option<Box<Expression>>,
11083}
11084
11085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11087#[cfg_attr(feature = "bindings", derive(TS))]
11088pub struct FallbackProperty {
11089 #[serde(default)]
11090 pub no: Option<Box<Expression>>,
11091 #[serde(default)]
11092 pub protection: Option<Box<Expression>>,
11093}
11094
11095#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11097#[cfg_attr(feature = "bindings", derive(TS))]
11098pub struct FileFormatProperty {
11099 #[serde(default)]
11100 pub this: Option<Box<Expression>>,
11101 #[serde(default)]
11102 pub expressions: Vec<Expression>,
11103 #[serde(default)]
11104 pub hive_format: Option<Box<Expression>>,
11105}
11106
11107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11109#[cfg_attr(feature = "bindings", derive(TS))]
11110pub struct CredentialsProperty {
11111 #[serde(default)]
11112 pub expressions: Vec<Expression>,
11113}
11114
11115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11117#[cfg_attr(feature = "bindings", derive(TS))]
11118pub struct FreespaceProperty {
11119 pub this: Box<Expression>,
11120 #[serde(default)]
11121 pub percent: Option<Box<Expression>>,
11122}
11123
11124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11126#[cfg_attr(feature = "bindings", derive(TS))]
11127pub struct InheritsProperty {
11128 #[serde(default)]
11129 pub expressions: Vec<Expression>,
11130}
11131
11132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11134#[cfg_attr(feature = "bindings", derive(TS))]
11135pub struct InputModelProperty {
11136 pub this: Box<Expression>,
11137}
11138
11139#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11141#[cfg_attr(feature = "bindings", derive(TS))]
11142pub struct OutputModelProperty {
11143 pub this: Box<Expression>,
11144}
11145
11146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11148#[cfg_attr(feature = "bindings", derive(TS))]
11149pub struct IsolatedLoadingProperty {
11150 #[serde(default)]
11151 pub no: Option<Box<Expression>>,
11152 #[serde(default)]
11153 pub concurrent: Option<Box<Expression>>,
11154 #[serde(default)]
11155 pub target: Option<Box<Expression>>,
11156}
11157
11158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11160#[cfg_attr(feature = "bindings", derive(TS))]
11161pub struct JournalProperty {
11162 #[serde(default)]
11163 pub no: Option<Box<Expression>>,
11164 #[serde(default)]
11165 pub dual: Option<Box<Expression>>,
11166 #[serde(default)]
11167 pub before: Option<Box<Expression>>,
11168 #[serde(default)]
11169 pub local: Option<Box<Expression>>,
11170 #[serde(default)]
11171 pub after: Option<Box<Expression>>,
11172}
11173
11174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11176#[cfg_attr(feature = "bindings", derive(TS))]
11177pub struct LanguageProperty {
11178 pub this: Box<Expression>,
11179}
11180
11181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11183#[cfg_attr(feature = "bindings", derive(TS))]
11184pub struct EnviromentProperty {
11185 #[serde(default)]
11186 pub expressions: Vec<Expression>,
11187}
11188
11189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11191#[cfg_attr(feature = "bindings", derive(TS))]
11192pub struct ClusteredByProperty {
11193 #[serde(default)]
11194 pub expressions: Vec<Expression>,
11195 #[serde(default)]
11196 pub sorted_by: Option<Box<Expression>>,
11197 #[serde(default)]
11198 pub buckets: Option<Box<Expression>>,
11199}
11200
11201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11203#[cfg_attr(feature = "bindings", derive(TS))]
11204pub struct DictProperty {
11205 pub this: Box<Expression>,
11206 pub kind: String,
11207 #[serde(default)]
11208 pub settings: Option<Box<Expression>>,
11209}
11210
11211#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11213#[cfg_attr(feature = "bindings", derive(TS))]
11214pub struct DictRange {
11215 pub this: Box<Expression>,
11216 #[serde(default)]
11217 pub min: Option<Box<Expression>>,
11218 #[serde(default)]
11219 pub max: Option<Box<Expression>>,
11220}
11221
11222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11224#[cfg_attr(feature = "bindings", derive(TS))]
11225pub struct OnCluster {
11226 pub this: Box<Expression>,
11227}
11228
11229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11231#[cfg_attr(feature = "bindings", derive(TS))]
11232pub struct LikeProperty {
11233 pub this: Box<Expression>,
11234 #[serde(default)]
11235 pub expressions: Vec<Expression>,
11236}
11237
11238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11240#[cfg_attr(feature = "bindings", derive(TS))]
11241pub struct LocationProperty {
11242 pub this: Box<Expression>,
11243}
11244
11245#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11247#[cfg_attr(feature = "bindings", derive(TS))]
11248pub struct LockProperty {
11249 pub this: Box<Expression>,
11250}
11251
11252#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11254#[cfg_attr(feature = "bindings", derive(TS))]
11255pub struct LockingProperty {
11256 #[serde(default)]
11257 pub this: Option<Box<Expression>>,
11258 pub kind: String,
11259 #[serde(default)]
11260 pub for_or_in: Option<Box<Expression>>,
11261 #[serde(default)]
11262 pub lock_type: Option<Box<Expression>>,
11263 #[serde(default)]
11264 pub override_: Option<Box<Expression>>,
11265}
11266
11267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11269#[cfg_attr(feature = "bindings", derive(TS))]
11270pub struct LogProperty {
11271 #[serde(default)]
11272 pub no: Option<Box<Expression>>,
11273}
11274
11275#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11277#[cfg_attr(feature = "bindings", derive(TS))]
11278pub struct MaterializedProperty {
11279 #[serde(default)]
11280 pub this: Option<Box<Expression>>,
11281}
11282
11283#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11285#[cfg_attr(feature = "bindings", derive(TS))]
11286pub struct MergeBlockRatioProperty {
11287 #[serde(default)]
11288 pub this: Option<Box<Expression>>,
11289 #[serde(default)]
11290 pub no: Option<Box<Expression>>,
11291 #[serde(default)]
11292 pub default: Option<Box<Expression>>,
11293 #[serde(default)]
11294 pub percent: Option<Box<Expression>>,
11295}
11296
11297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11299#[cfg_attr(feature = "bindings", derive(TS))]
11300pub struct OnProperty {
11301 pub this: Box<Expression>,
11302}
11303
11304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11306#[cfg_attr(feature = "bindings", derive(TS))]
11307pub struct OnCommitProperty {
11308 #[serde(default)]
11309 pub delete: Option<Box<Expression>>,
11310}
11311
11312#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11314#[cfg_attr(feature = "bindings", derive(TS))]
11315pub struct PartitionedByProperty {
11316 pub this: Box<Expression>,
11317}
11318
11319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11321#[cfg_attr(feature = "bindings", derive(TS))]
11322pub struct PartitionByProperty {
11323 #[serde(default)]
11324 pub expressions: Vec<Expression>,
11325}
11326
11327#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11329#[cfg_attr(feature = "bindings", derive(TS))]
11330pub struct PartitionedByBucket {
11331 pub this: Box<Expression>,
11332 pub expression: Box<Expression>,
11333}
11334
11335#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11337#[cfg_attr(feature = "bindings", derive(TS))]
11338pub struct ClusterByColumnsProperty {
11339 #[serde(default)]
11340 pub columns: Vec<Identifier>,
11341}
11342
11343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11345#[cfg_attr(feature = "bindings", derive(TS))]
11346pub struct PartitionByTruncate {
11347 pub this: Box<Expression>,
11348 pub expression: Box<Expression>,
11349}
11350
11351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11353#[cfg_attr(feature = "bindings", derive(TS))]
11354pub struct PartitionByRangeProperty {
11355 #[serde(default)]
11356 pub partition_expressions: Option<Box<Expression>>,
11357 #[serde(default)]
11358 pub create_expressions: Option<Box<Expression>>,
11359}
11360
11361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11363#[cfg_attr(feature = "bindings", derive(TS))]
11364pub struct PartitionByRangePropertyDynamic {
11365 #[serde(default)]
11366 pub this: Option<Box<Expression>>,
11367 #[serde(default)]
11368 pub start: Option<Box<Expression>>,
11369 #[serde(default)]
11371 pub use_start_end: bool,
11372 #[serde(default)]
11373 pub end: Option<Box<Expression>>,
11374 #[serde(default)]
11375 pub every: Option<Box<Expression>>,
11376}
11377
11378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11380#[cfg_attr(feature = "bindings", derive(TS))]
11381pub struct PartitionByListProperty {
11382 #[serde(default)]
11383 pub partition_expressions: Option<Box<Expression>>,
11384 #[serde(default)]
11385 pub create_expressions: Option<Box<Expression>>,
11386}
11387
11388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11390#[cfg_attr(feature = "bindings", derive(TS))]
11391pub struct PartitionList {
11392 pub this: Box<Expression>,
11393 #[serde(default)]
11394 pub expressions: Vec<Expression>,
11395}
11396
11397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11399#[cfg_attr(feature = "bindings", derive(TS))]
11400pub struct Partition {
11401 pub expressions: Vec<Expression>,
11402 #[serde(default)]
11403 pub subpartition: bool,
11404}
11405
11406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11409#[cfg_attr(feature = "bindings", derive(TS))]
11410pub struct RefreshTriggerProperty {
11411 pub method: String,
11413 #[serde(default)]
11415 pub kind: Option<String>,
11416 #[serde(default)]
11418 pub every: Option<Box<Expression>>,
11419 #[serde(default)]
11421 pub unit: Option<String>,
11422 #[serde(default)]
11424 pub starts: Option<Box<Expression>>,
11425}
11426
11427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11429#[cfg_attr(feature = "bindings", derive(TS))]
11430pub struct UniqueKeyProperty {
11431 #[serde(default)]
11432 pub expressions: Vec<Expression>,
11433}
11434
11435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11437#[cfg_attr(feature = "bindings", derive(TS))]
11438pub struct RollupProperty {
11439 pub expressions: Vec<RollupIndex>,
11440}
11441
11442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11444#[cfg_attr(feature = "bindings", derive(TS))]
11445pub struct RollupIndex {
11446 pub name: Identifier,
11447 pub expressions: Vec<Identifier>,
11448}
11449
11450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11452#[cfg_attr(feature = "bindings", derive(TS))]
11453pub struct PartitionBoundSpec {
11454 #[serde(default)]
11455 pub this: Option<Box<Expression>>,
11456 #[serde(default)]
11457 pub expression: Option<Box<Expression>>,
11458 #[serde(default)]
11459 pub from_expressions: Option<Box<Expression>>,
11460 #[serde(default)]
11461 pub to_expressions: Option<Box<Expression>>,
11462}
11463
11464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11466#[cfg_attr(feature = "bindings", derive(TS))]
11467pub struct PartitionedOfProperty {
11468 pub this: Box<Expression>,
11469 pub expression: Box<Expression>,
11470}
11471
11472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11474#[cfg_attr(feature = "bindings", derive(TS))]
11475pub struct RemoteWithConnectionModelProperty {
11476 pub this: Box<Expression>,
11477}
11478
11479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11481#[cfg_attr(feature = "bindings", derive(TS))]
11482pub struct ReturnsProperty {
11483 #[serde(default)]
11484 pub this: Option<Box<Expression>>,
11485 #[serde(default)]
11486 pub is_table: Option<Box<Expression>>,
11487 #[serde(default)]
11488 pub table: Option<Box<Expression>>,
11489 #[serde(default)]
11490 pub null: Option<Box<Expression>>,
11491}
11492
11493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11495#[cfg_attr(feature = "bindings", derive(TS))]
11496pub struct RowFormatProperty {
11497 pub this: Box<Expression>,
11498}
11499
11500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11502#[cfg_attr(feature = "bindings", derive(TS))]
11503pub struct RowFormatDelimitedProperty {
11504 #[serde(default)]
11505 pub fields: Option<Box<Expression>>,
11506 #[serde(default)]
11507 pub escaped: Option<Box<Expression>>,
11508 #[serde(default)]
11509 pub collection_items: Option<Box<Expression>>,
11510 #[serde(default)]
11511 pub map_keys: Option<Box<Expression>>,
11512 #[serde(default)]
11513 pub lines: Option<Box<Expression>>,
11514 #[serde(default)]
11515 pub null: Option<Box<Expression>>,
11516 #[serde(default)]
11517 pub serde: Option<Box<Expression>>,
11518}
11519
11520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11522#[cfg_attr(feature = "bindings", derive(TS))]
11523pub struct RowFormatSerdeProperty {
11524 pub this: Box<Expression>,
11525 #[serde(default)]
11526 pub serde_properties: Option<Box<Expression>>,
11527}
11528
11529#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11531#[cfg_attr(feature = "bindings", derive(TS))]
11532pub struct QueryTransform {
11533 #[serde(default)]
11534 pub expressions: Vec<Expression>,
11535 #[serde(default)]
11536 pub command_script: Option<Box<Expression>>,
11537 #[serde(default)]
11538 pub schema: Option<Box<Expression>>,
11539 #[serde(default)]
11540 pub row_format_before: Option<Box<Expression>>,
11541 #[serde(default)]
11542 pub record_writer: Option<Box<Expression>>,
11543 #[serde(default)]
11544 pub row_format_after: Option<Box<Expression>>,
11545 #[serde(default)]
11546 pub record_reader: Option<Box<Expression>>,
11547}
11548
11549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11551#[cfg_attr(feature = "bindings", derive(TS))]
11552pub struct SampleProperty {
11553 pub this: Box<Expression>,
11554}
11555
11556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11558#[cfg_attr(feature = "bindings", derive(TS))]
11559pub struct SecurityProperty {
11560 pub this: Box<Expression>,
11561}
11562
11563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11565#[cfg_attr(feature = "bindings", derive(TS))]
11566pub struct SchemaCommentProperty {
11567 pub this: Box<Expression>,
11568}
11569
11570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11572#[cfg_attr(feature = "bindings", derive(TS))]
11573pub struct SemanticView {
11574 pub this: Box<Expression>,
11575 #[serde(default)]
11576 pub metrics: Option<Box<Expression>>,
11577 #[serde(default)]
11578 pub dimensions: Option<Box<Expression>>,
11579 #[serde(default)]
11580 pub facts: Option<Box<Expression>>,
11581 #[serde(default)]
11582 pub where_: Option<Box<Expression>>,
11583}
11584
11585#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11587#[cfg_attr(feature = "bindings", derive(TS))]
11588pub struct SerdeProperties {
11589 #[serde(default)]
11590 pub expressions: Vec<Expression>,
11591 #[serde(default)]
11592 pub with_: Option<Box<Expression>>,
11593}
11594
11595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11597#[cfg_attr(feature = "bindings", derive(TS))]
11598pub struct SetProperty {
11599 #[serde(default)]
11600 pub multi: Option<Box<Expression>>,
11601}
11602
11603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11605#[cfg_attr(feature = "bindings", derive(TS))]
11606pub struct SharingProperty {
11607 #[serde(default)]
11608 pub this: Option<Box<Expression>>,
11609}
11610
11611#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11613#[cfg_attr(feature = "bindings", derive(TS))]
11614pub struct SetConfigProperty {
11615 pub this: Box<Expression>,
11616}
11617
11618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11620#[cfg_attr(feature = "bindings", derive(TS))]
11621pub struct SettingsProperty {
11622 #[serde(default)]
11623 pub expressions: Vec<Expression>,
11624}
11625
11626#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11628#[cfg_attr(feature = "bindings", derive(TS))]
11629pub struct SortKeyProperty {
11630 pub this: Box<Expression>,
11631 #[serde(default)]
11632 pub compound: Option<Box<Expression>>,
11633}
11634
11635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11637#[cfg_attr(feature = "bindings", derive(TS))]
11638pub struct SqlReadWriteProperty {
11639 pub this: Box<Expression>,
11640}
11641
11642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11644#[cfg_attr(feature = "bindings", derive(TS))]
11645pub struct SqlSecurityProperty {
11646 pub this: Box<Expression>,
11647}
11648
11649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11651#[cfg_attr(feature = "bindings", derive(TS))]
11652pub struct StabilityProperty {
11653 pub this: Box<Expression>,
11654}
11655
11656#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11658#[cfg_attr(feature = "bindings", derive(TS))]
11659pub struct StorageHandlerProperty {
11660 pub this: Box<Expression>,
11661}
11662
11663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11665#[cfg_attr(feature = "bindings", derive(TS))]
11666pub struct TemporaryProperty {
11667 #[serde(default)]
11668 pub this: Option<Box<Expression>>,
11669}
11670
11671#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11673#[cfg_attr(feature = "bindings", derive(TS))]
11674pub struct Tags {
11675 #[serde(default)]
11676 pub expressions: Vec<Expression>,
11677}
11678
11679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11681#[cfg_attr(feature = "bindings", derive(TS))]
11682pub struct TransformModelProperty {
11683 #[serde(default)]
11684 pub expressions: Vec<Expression>,
11685}
11686
11687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11689#[cfg_attr(feature = "bindings", derive(TS))]
11690pub struct TransientProperty {
11691 #[serde(default)]
11692 pub this: Option<Box<Expression>>,
11693}
11694
11695#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11697#[cfg_attr(feature = "bindings", derive(TS))]
11698pub struct UsingTemplateProperty {
11699 pub this: Box<Expression>,
11700}
11701
11702#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11704#[cfg_attr(feature = "bindings", derive(TS))]
11705pub struct ViewAttributeProperty {
11706 pub this: Box<Expression>,
11707}
11708
11709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11711#[cfg_attr(feature = "bindings", derive(TS))]
11712pub struct VolatileProperty {
11713 #[serde(default)]
11714 pub this: Option<Box<Expression>>,
11715}
11716
11717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11719#[cfg_attr(feature = "bindings", derive(TS))]
11720pub struct WithDataProperty {
11721 #[serde(default)]
11722 pub no: Option<Box<Expression>>,
11723 #[serde(default)]
11724 pub statistics: Option<Box<Expression>>,
11725}
11726
11727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11729#[cfg_attr(feature = "bindings", derive(TS))]
11730pub struct WithJournalTableProperty {
11731 pub this: Box<Expression>,
11732}
11733
11734#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11736#[cfg_attr(feature = "bindings", derive(TS))]
11737pub struct WithSchemaBindingProperty {
11738 pub this: Box<Expression>,
11739}
11740
11741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11743#[cfg_attr(feature = "bindings", derive(TS))]
11744pub struct WithSystemVersioningProperty {
11745 #[serde(default)]
11746 pub on: Option<Box<Expression>>,
11747 #[serde(default)]
11748 pub this: Option<Box<Expression>>,
11749 #[serde(default)]
11750 pub data_consistency: Option<Box<Expression>>,
11751 #[serde(default)]
11752 pub retention_period: Option<Box<Expression>>,
11753 #[serde(default)]
11754 pub with_: Option<Box<Expression>>,
11755}
11756
11757#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11759#[cfg_attr(feature = "bindings", derive(TS))]
11760pub struct WithProcedureOptions {
11761 #[serde(default)]
11762 pub expressions: Vec<Expression>,
11763}
11764
11765#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11767#[cfg_attr(feature = "bindings", derive(TS))]
11768pub struct EncodeProperty {
11769 pub this: Box<Expression>,
11770 #[serde(default)]
11771 pub properties: Vec<Expression>,
11772 #[serde(default)]
11773 pub key: Option<Box<Expression>>,
11774}
11775
11776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11778#[cfg_attr(feature = "bindings", derive(TS))]
11779pub struct IncludeProperty {
11780 pub this: Box<Expression>,
11781 #[serde(default)]
11782 pub alias: Option<String>,
11783 #[serde(default)]
11784 pub column_def: Option<Box<Expression>>,
11785}
11786
11787#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11789#[cfg_attr(feature = "bindings", derive(TS))]
11790pub struct Properties {
11791 #[serde(default)]
11792 pub expressions: Vec<Expression>,
11793}
11794
11795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct OptionEntry {
11799 pub key: Identifier,
11800 pub value: Expression,
11801}
11802
11803#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11805#[cfg_attr(feature = "bindings", derive(TS))]
11806pub struct OptionsProperty {
11807 #[serde(default)]
11808 pub entries: Vec<OptionEntry>,
11809}
11810
11811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11813#[cfg_attr(feature = "bindings", derive(TS))]
11814pub struct InputOutputFormat {
11815 #[serde(default)]
11816 pub input_format: Option<Box<Expression>>,
11817 #[serde(default)]
11818 pub output_format: Option<Box<Expression>>,
11819}
11820
11821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11823#[cfg_attr(feature = "bindings", derive(TS))]
11824pub struct Reference {
11825 pub this: Box<Expression>,
11826 #[serde(default)]
11827 pub expressions: Vec<Expression>,
11828 #[serde(default)]
11829 pub options: Vec<Expression>,
11830}
11831
11832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11834#[cfg_attr(feature = "bindings", derive(TS))]
11835pub struct QueryOption {
11836 pub this: Box<Expression>,
11837 #[serde(default)]
11838 pub expression: Option<Box<Expression>>,
11839}
11840
11841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11843#[cfg_attr(feature = "bindings", derive(TS))]
11844pub struct WithTableHint {
11845 #[serde(default)]
11846 pub expressions: Vec<Expression>,
11847}
11848
11849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11851#[cfg_attr(feature = "bindings", derive(TS))]
11852pub struct IndexTableHint {
11853 pub this: Box<Expression>,
11854 #[serde(default)]
11855 pub expressions: Vec<Expression>,
11856 #[serde(default)]
11857 pub target: Option<Box<Expression>>,
11858}
11859
11860#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11862#[cfg_attr(feature = "bindings", derive(TS))]
11863pub struct Get {
11864 pub this: Box<Expression>,
11865 #[serde(default)]
11866 pub target: Option<Box<Expression>>,
11867 #[serde(default)]
11868 pub properties: Vec<Expression>,
11869}
11870
11871#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11873#[cfg_attr(feature = "bindings", derive(TS))]
11874pub struct SetOperation {
11875 #[serde(default)]
11876 pub with_: Option<Box<Expression>>,
11877 pub this: Box<Expression>,
11878 pub expression: Box<Expression>,
11879 #[serde(default)]
11880 pub distinct: bool,
11881 #[serde(default)]
11882 pub by_name: Option<Box<Expression>>,
11883 #[serde(default)]
11884 pub side: Option<Box<Expression>>,
11885 #[serde(default)]
11886 pub kind: Option<String>,
11887 #[serde(default)]
11888 pub on: Option<Box<Expression>>,
11889}
11890
11891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11893#[cfg_attr(feature = "bindings", derive(TS))]
11894pub struct Var {
11895 pub this: String,
11896}
11897
11898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11900#[cfg_attr(feature = "bindings", derive(TS))]
11901pub struct Variadic {
11902 pub this: Box<Expression>,
11903}
11904
11905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11907#[cfg_attr(feature = "bindings", derive(TS))]
11908pub struct Version {
11909 pub this: Box<Expression>,
11910 pub kind: String,
11911 #[serde(default)]
11912 pub expression: Option<Box<Expression>>,
11913}
11914
11915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11917#[cfg_attr(feature = "bindings", derive(TS))]
11918pub struct Schema {
11919 #[serde(default)]
11920 pub this: Option<Box<Expression>>,
11921 #[serde(default)]
11922 pub expressions: Vec<Expression>,
11923}
11924
11925#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11927#[cfg_attr(feature = "bindings", derive(TS))]
11928pub struct Lock {
11929 #[serde(default)]
11930 pub update: Option<Box<Expression>>,
11931 #[serde(default)]
11932 pub expressions: Vec<Expression>,
11933 #[serde(default)]
11934 pub wait: Option<Box<Expression>>,
11935 #[serde(default)]
11936 pub key: Option<Box<Expression>>,
11937}
11938
11939#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11942#[cfg_attr(feature = "bindings", derive(TS))]
11943pub struct TableSample {
11944 #[serde(default, skip_serializing_if = "Option::is_none")]
11946 pub this: Option<Box<Expression>>,
11947 #[serde(default, skip_serializing_if = "Option::is_none")]
11949 pub sample: Option<Box<Sample>>,
11950 #[serde(default)]
11951 pub expressions: Vec<Expression>,
11952 #[serde(default)]
11953 pub method: Option<String>,
11954 #[serde(default)]
11955 pub bucket_numerator: Option<Box<Expression>>,
11956 #[serde(default)]
11957 pub bucket_denominator: Option<Box<Expression>>,
11958 #[serde(default)]
11959 pub bucket_field: Option<Box<Expression>>,
11960 #[serde(default)]
11961 pub percent: Option<Box<Expression>>,
11962 #[serde(default)]
11963 pub rows: Option<Box<Expression>>,
11964 #[serde(default)]
11965 pub size: Option<i64>,
11966 #[serde(default)]
11967 pub seed: Option<Box<Expression>>,
11968}
11969
11970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11972#[cfg_attr(feature = "bindings", derive(TS))]
11973pub struct Tag {
11974 #[serde(default)]
11975 pub this: Option<Box<Expression>>,
11976 #[serde(default)]
11977 pub prefix: Option<Box<Expression>>,
11978 #[serde(default)]
11979 pub postfix: Option<Box<Expression>>,
11980}
11981
11982#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11984#[cfg_attr(feature = "bindings", derive(TS))]
11985pub struct UnpivotColumns {
11986 pub this: Box<Expression>,
11987 #[serde(default)]
11988 pub expressions: Vec<Expression>,
11989}
11990
11991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11993#[cfg_attr(feature = "bindings", derive(TS))]
11994pub struct SessionParameter {
11995 pub this: Box<Expression>,
11996 #[serde(default)]
11997 pub kind: Option<String>,
11998}
11999
12000#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12002#[cfg_attr(feature = "bindings", derive(TS))]
12003pub struct PseudoType {
12004 pub this: Box<Expression>,
12005}
12006
12007#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12009#[cfg_attr(feature = "bindings", derive(TS))]
12010pub struct ObjectIdentifier {
12011 pub this: Box<Expression>,
12012}
12013
12014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12016#[cfg_attr(feature = "bindings", derive(TS))]
12017pub struct Transaction {
12018 #[serde(default)]
12019 pub this: Option<Box<Expression>>,
12020 #[serde(default)]
12021 pub modes: Option<Box<Expression>>,
12022 #[serde(default)]
12023 pub mark: Option<Box<Expression>>,
12024}
12025
12026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12028#[cfg_attr(feature = "bindings", derive(TS))]
12029pub struct Commit {
12030 #[serde(default)]
12031 pub chain: Option<Box<Expression>>,
12032 #[serde(default)]
12033 pub this: Option<Box<Expression>>,
12034 #[serde(default)]
12035 pub durability: Option<Box<Expression>>,
12036}
12037
12038#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12040#[cfg_attr(feature = "bindings", derive(TS))]
12041pub struct Rollback {
12042 #[serde(default)]
12043 pub savepoint: Option<Box<Expression>>,
12044 #[serde(default)]
12045 pub this: Option<Box<Expression>>,
12046}
12047
12048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12050#[cfg_attr(feature = "bindings", derive(TS))]
12051pub struct AlterSession {
12052 #[serde(default)]
12053 pub expressions: Vec<Expression>,
12054 #[serde(default)]
12055 pub unset: Option<Box<Expression>>,
12056}
12057
12058#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12060#[cfg_attr(feature = "bindings", derive(TS))]
12061pub struct Analyze {
12062 #[serde(default)]
12063 pub kind: Option<String>,
12064 #[serde(default)]
12065 pub this: Option<Box<Expression>>,
12066 #[serde(default)]
12067 pub options: Vec<Expression>,
12068 #[serde(default)]
12069 pub mode: Option<Box<Expression>>,
12070 #[serde(default)]
12071 pub partition: Option<Box<Expression>>,
12072 #[serde(default)]
12073 pub expression: Option<Box<Expression>>,
12074 #[serde(default)]
12075 pub properties: Vec<Expression>,
12076 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12078 pub columns: Vec<String>,
12079}
12080
12081#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12083#[cfg_attr(feature = "bindings", derive(TS))]
12084pub struct AnalyzeStatistics {
12085 pub kind: String,
12086 #[serde(default)]
12087 pub option: Option<Box<Expression>>,
12088 #[serde(default)]
12089 pub this: Option<Box<Expression>>,
12090 #[serde(default)]
12091 pub expressions: Vec<Expression>,
12092}
12093
12094#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12096#[cfg_attr(feature = "bindings", derive(TS))]
12097pub struct AnalyzeHistogram {
12098 pub this: Box<Expression>,
12099 #[serde(default)]
12100 pub expressions: Vec<Expression>,
12101 #[serde(default)]
12102 pub expression: Option<Box<Expression>>,
12103 #[serde(default)]
12104 pub update_options: Option<Box<Expression>>,
12105}
12106
12107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12109#[cfg_attr(feature = "bindings", derive(TS))]
12110pub struct AnalyzeSample {
12111 pub kind: String,
12112 #[serde(default)]
12113 pub sample: Option<Box<Expression>>,
12114}
12115
12116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12118#[cfg_attr(feature = "bindings", derive(TS))]
12119pub struct AnalyzeListChainedRows {
12120 #[serde(default)]
12121 pub expression: Option<Box<Expression>>,
12122}
12123
12124#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12126#[cfg_attr(feature = "bindings", derive(TS))]
12127pub struct AnalyzeDelete {
12128 #[serde(default)]
12129 pub kind: Option<String>,
12130}
12131
12132#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12134#[cfg_attr(feature = "bindings", derive(TS))]
12135pub struct AnalyzeWith {
12136 #[serde(default)]
12137 pub expressions: Vec<Expression>,
12138}
12139
12140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12142#[cfg_attr(feature = "bindings", derive(TS))]
12143pub struct AnalyzeValidate {
12144 pub kind: String,
12145 #[serde(default)]
12146 pub this: Option<Box<Expression>>,
12147 #[serde(default)]
12148 pub expression: Option<Box<Expression>>,
12149}
12150
12151#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12153#[cfg_attr(feature = "bindings", derive(TS))]
12154pub struct AddPartition {
12155 pub this: Box<Expression>,
12156 #[serde(default)]
12157 pub exists: bool,
12158 #[serde(default)]
12159 pub location: Option<Box<Expression>>,
12160}
12161
12162#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12164#[cfg_attr(feature = "bindings", derive(TS))]
12165pub struct AttachOption {
12166 pub this: Box<Expression>,
12167 #[serde(default)]
12168 pub expression: Option<Box<Expression>>,
12169}
12170
12171#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12173#[cfg_attr(feature = "bindings", derive(TS))]
12174pub struct DropPartition {
12175 #[serde(default)]
12176 pub expressions: Vec<Expression>,
12177 #[serde(default)]
12178 pub exists: bool,
12179}
12180
12181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct ReplacePartition {
12185 pub expression: Box<Expression>,
12186 #[serde(default)]
12187 pub source: Option<Box<Expression>>,
12188}
12189
12190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12192#[cfg_attr(feature = "bindings", derive(TS))]
12193pub struct DPipe {
12194 pub this: Box<Expression>,
12195 pub expression: Box<Expression>,
12196 #[serde(default)]
12197 pub safe: Option<Box<Expression>>,
12198}
12199
12200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12202#[cfg_attr(feature = "bindings", derive(TS))]
12203pub struct Operator {
12204 pub this: Box<Expression>,
12205 #[serde(default)]
12206 pub operator: Option<Box<Expression>>,
12207 pub expression: Box<Expression>,
12208 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12210 pub comments: Vec<String>,
12211}
12212
12213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12215#[cfg_attr(feature = "bindings", derive(TS))]
12216pub struct PivotAny {
12217 #[serde(default)]
12218 pub this: Option<Box<Expression>>,
12219}
12220
12221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12223#[cfg_attr(feature = "bindings", derive(TS))]
12224pub struct Aliases {
12225 pub this: Box<Expression>,
12226 #[serde(default)]
12227 pub expressions: Vec<Expression>,
12228}
12229
12230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct AtIndex {
12234 pub this: Box<Expression>,
12235 pub expression: Box<Expression>,
12236}
12237
12238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12240#[cfg_attr(feature = "bindings", derive(TS))]
12241pub struct FromTimeZone {
12242 pub this: Box<Expression>,
12243 #[serde(default)]
12244 pub zone: Option<Box<Expression>>,
12245}
12246
12247#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12249#[cfg_attr(feature = "bindings", derive(TS))]
12250pub struct FormatPhrase {
12251 pub this: Box<Expression>,
12252 pub format: String,
12253}
12254
12255#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12257#[cfg_attr(feature = "bindings", derive(TS))]
12258pub struct ForIn {
12259 pub this: Box<Expression>,
12260 pub expression: Box<Expression>,
12261}
12262
12263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12265#[cfg_attr(feature = "bindings", derive(TS))]
12266pub struct TimeUnit {
12267 #[serde(default)]
12268 pub unit: Option<String>,
12269}
12270
12271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12273#[cfg_attr(feature = "bindings", derive(TS))]
12274pub struct IntervalOp {
12275 #[serde(default)]
12276 pub unit: Option<String>,
12277 pub expression: Box<Expression>,
12278}
12279
12280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12282#[cfg_attr(feature = "bindings", derive(TS))]
12283pub struct HavingMax {
12284 pub this: Box<Expression>,
12285 pub expression: Box<Expression>,
12286 #[serde(default)]
12287 pub max: Option<Box<Expression>>,
12288}
12289
12290#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12292#[cfg_attr(feature = "bindings", derive(TS))]
12293pub struct CosineDistance {
12294 pub this: Box<Expression>,
12295 pub expression: Box<Expression>,
12296}
12297
12298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12300#[cfg_attr(feature = "bindings", derive(TS))]
12301pub struct DotProduct {
12302 pub this: Box<Expression>,
12303 pub expression: Box<Expression>,
12304}
12305
12306#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12308#[cfg_attr(feature = "bindings", derive(TS))]
12309pub struct EuclideanDistance {
12310 pub this: Box<Expression>,
12311 pub expression: Box<Expression>,
12312}
12313
12314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12316#[cfg_attr(feature = "bindings", derive(TS))]
12317pub struct ManhattanDistance {
12318 pub this: Box<Expression>,
12319 pub expression: Box<Expression>,
12320}
12321
12322#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12324#[cfg_attr(feature = "bindings", derive(TS))]
12325pub struct JarowinklerSimilarity {
12326 pub this: Box<Expression>,
12327 pub expression: Box<Expression>,
12328}
12329
12330#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12332#[cfg_attr(feature = "bindings", derive(TS))]
12333pub struct Booland {
12334 pub this: Box<Expression>,
12335 pub expression: Box<Expression>,
12336}
12337
12338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12340#[cfg_attr(feature = "bindings", derive(TS))]
12341pub struct Boolor {
12342 pub this: Box<Expression>,
12343 pub expression: Box<Expression>,
12344}
12345
12346#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12348#[cfg_attr(feature = "bindings", derive(TS))]
12349pub struct ParameterizedAgg {
12350 pub this: Box<Expression>,
12351 #[serde(default)]
12352 pub expressions: Vec<Expression>,
12353 #[serde(default)]
12354 pub params: Vec<Expression>,
12355}
12356
12357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12359#[cfg_attr(feature = "bindings", derive(TS))]
12360pub struct ArgMax {
12361 pub this: Box<Expression>,
12362 pub expression: Box<Expression>,
12363 #[serde(default)]
12364 pub count: Option<Box<Expression>>,
12365}
12366
12367#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12369#[cfg_attr(feature = "bindings", derive(TS))]
12370pub struct ArgMin {
12371 pub this: Box<Expression>,
12372 pub expression: Box<Expression>,
12373 #[serde(default)]
12374 pub count: Option<Box<Expression>>,
12375}
12376
12377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12379#[cfg_attr(feature = "bindings", derive(TS))]
12380pub struct ApproxTopK {
12381 pub this: Box<Expression>,
12382 #[serde(default)]
12383 pub expression: Option<Box<Expression>>,
12384 #[serde(default)]
12385 pub counters: Option<Box<Expression>>,
12386}
12387
12388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12390#[cfg_attr(feature = "bindings", derive(TS))]
12391pub struct ApproxTopKAccumulate {
12392 pub this: Box<Expression>,
12393 #[serde(default)]
12394 pub expression: Option<Box<Expression>>,
12395}
12396
12397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12399#[cfg_attr(feature = "bindings", derive(TS))]
12400pub struct ApproxTopKCombine {
12401 pub this: Box<Expression>,
12402 #[serde(default)]
12403 pub expression: Option<Box<Expression>>,
12404}
12405
12406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12408#[cfg_attr(feature = "bindings", derive(TS))]
12409pub struct ApproxTopKEstimate {
12410 pub this: Box<Expression>,
12411 #[serde(default)]
12412 pub expression: Option<Box<Expression>>,
12413}
12414
12415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12417#[cfg_attr(feature = "bindings", derive(TS))]
12418pub struct ApproxTopSum {
12419 pub this: Box<Expression>,
12420 pub expression: Box<Expression>,
12421 #[serde(default)]
12422 pub count: Option<Box<Expression>>,
12423}
12424
12425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12427#[cfg_attr(feature = "bindings", derive(TS))]
12428pub struct ApproxQuantiles {
12429 pub this: Box<Expression>,
12430 #[serde(default)]
12431 pub expression: Option<Box<Expression>>,
12432}
12433
12434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12436#[cfg_attr(feature = "bindings", derive(TS))]
12437pub struct Minhash {
12438 pub this: Box<Expression>,
12439 #[serde(default)]
12440 pub expressions: Vec<Expression>,
12441}
12442
12443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12445#[cfg_attr(feature = "bindings", derive(TS))]
12446pub struct FarmFingerprint {
12447 #[serde(default)]
12448 pub expressions: Vec<Expression>,
12449}
12450
12451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12453#[cfg_attr(feature = "bindings", derive(TS))]
12454pub struct Float64 {
12455 pub this: Box<Expression>,
12456 #[serde(default)]
12457 pub expression: Option<Box<Expression>>,
12458}
12459
12460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12462#[cfg_attr(feature = "bindings", derive(TS))]
12463pub struct Transform {
12464 pub this: Box<Expression>,
12465 pub expression: Box<Expression>,
12466}
12467
12468#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12470#[cfg_attr(feature = "bindings", derive(TS))]
12471pub struct Translate {
12472 pub this: Box<Expression>,
12473 #[serde(default)]
12474 pub from_: Option<Box<Expression>>,
12475 #[serde(default)]
12476 pub to: Option<Box<Expression>>,
12477}
12478
12479#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12481#[cfg_attr(feature = "bindings", derive(TS))]
12482pub struct Grouping {
12483 #[serde(default)]
12484 pub expressions: Vec<Expression>,
12485}
12486
12487#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12489#[cfg_attr(feature = "bindings", derive(TS))]
12490pub struct GroupingId {
12491 #[serde(default)]
12492 pub expressions: Vec<Expression>,
12493}
12494
12495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12497#[cfg_attr(feature = "bindings", derive(TS))]
12498pub struct Anonymous {
12499 pub this: Box<Expression>,
12500 #[serde(default)]
12501 pub expressions: Vec<Expression>,
12502}
12503
12504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12506#[cfg_attr(feature = "bindings", derive(TS))]
12507pub struct AnonymousAggFunc {
12508 pub this: Box<Expression>,
12509 #[serde(default)]
12510 pub expressions: Vec<Expression>,
12511}
12512
12513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12515#[cfg_attr(feature = "bindings", derive(TS))]
12516pub struct CombinedAggFunc {
12517 pub this: Box<Expression>,
12518 #[serde(default)]
12519 pub expressions: Vec<Expression>,
12520}
12521
12522#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12524#[cfg_attr(feature = "bindings", derive(TS))]
12525pub struct CombinedParameterizedAgg {
12526 pub this: Box<Expression>,
12527 #[serde(default)]
12528 pub expressions: Vec<Expression>,
12529 #[serde(default)]
12530 pub params: Vec<Expression>,
12531}
12532
12533#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12535#[cfg_attr(feature = "bindings", derive(TS))]
12536pub struct HashAgg {
12537 pub this: Box<Expression>,
12538 #[serde(default)]
12539 pub expressions: Vec<Expression>,
12540}
12541
12542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12544#[cfg_attr(feature = "bindings", derive(TS))]
12545pub struct Hll {
12546 pub this: Box<Expression>,
12547 #[serde(default)]
12548 pub expressions: Vec<Expression>,
12549}
12550
12551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12553#[cfg_attr(feature = "bindings", derive(TS))]
12554pub struct Apply {
12555 pub this: Box<Expression>,
12556 pub expression: Box<Expression>,
12557}
12558
12559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12561#[cfg_attr(feature = "bindings", derive(TS))]
12562pub struct ToBoolean {
12563 pub this: Box<Expression>,
12564 #[serde(default)]
12565 pub safe: Option<Box<Expression>>,
12566}
12567
12568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12570#[cfg_attr(feature = "bindings", derive(TS))]
12571pub struct List {
12572 #[serde(default)]
12573 pub expressions: Vec<Expression>,
12574}
12575
12576#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12581#[cfg_attr(feature = "bindings", derive(TS))]
12582pub struct ToMap {
12583 pub this: Box<Expression>,
12585}
12586
12587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12589#[cfg_attr(feature = "bindings", derive(TS))]
12590pub struct Pad {
12591 pub this: Box<Expression>,
12592 pub expression: Box<Expression>,
12593 #[serde(default)]
12594 pub fill_pattern: Option<Box<Expression>>,
12595 #[serde(default)]
12596 pub is_left: Option<Box<Expression>>,
12597}
12598
12599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12601#[cfg_attr(feature = "bindings", derive(TS))]
12602pub struct ToChar {
12603 pub this: Box<Expression>,
12604 #[serde(default)]
12605 pub format: Option<String>,
12606 #[serde(default)]
12607 pub nlsparam: Option<Box<Expression>>,
12608 #[serde(default)]
12609 pub is_numeric: Option<Box<Expression>>,
12610}
12611
12612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12614#[cfg_attr(feature = "bindings", derive(TS))]
12615pub struct StringFunc {
12616 pub this: Box<Expression>,
12617 #[serde(default)]
12618 pub zone: Option<Box<Expression>>,
12619}
12620
12621#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12623#[cfg_attr(feature = "bindings", derive(TS))]
12624pub struct ToNumber {
12625 pub this: Box<Expression>,
12626 #[serde(default)]
12627 pub format: Option<Box<Expression>>,
12628 #[serde(default)]
12629 pub nlsparam: Option<Box<Expression>>,
12630 #[serde(default)]
12631 pub precision: Option<Box<Expression>>,
12632 #[serde(default)]
12633 pub scale: Option<Box<Expression>>,
12634 #[serde(default)]
12635 pub safe: Option<Box<Expression>>,
12636 #[serde(default)]
12637 pub safe_name: Option<Box<Expression>>,
12638}
12639
12640#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12642#[cfg_attr(feature = "bindings", derive(TS))]
12643pub struct ToDouble {
12644 pub this: Box<Expression>,
12645 #[serde(default)]
12646 pub format: Option<String>,
12647 #[serde(default)]
12648 pub safe: Option<Box<Expression>>,
12649}
12650
12651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12653#[cfg_attr(feature = "bindings", derive(TS))]
12654pub struct ToDecfloat {
12655 pub this: Box<Expression>,
12656 #[serde(default)]
12657 pub format: Option<String>,
12658}
12659
12660#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12662#[cfg_attr(feature = "bindings", derive(TS))]
12663pub struct TryToDecfloat {
12664 pub this: Box<Expression>,
12665 #[serde(default)]
12666 pub format: Option<String>,
12667}
12668
12669#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12671#[cfg_attr(feature = "bindings", derive(TS))]
12672pub struct ToFile {
12673 pub this: Box<Expression>,
12674 #[serde(default)]
12675 pub path: Option<Box<Expression>>,
12676 #[serde(default)]
12677 pub safe: Option<Box<Expression>>,
12678}
12679
12680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12682#[cfg_attr(feature = "bindings", derive(TS))]
12683pub struct Columns {
12684 pub this: Box<Expression>,
12685 #[serde(default)]
12686 pub unpack: Option<Box<Expression>>,
12687}
12688
12689#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12691#[cfg_attr(feature = "bindings", derive(TS))]
12692pub struct ConvertToCharset {
12693 pub this: Box<Expression>,
12694 #[serde(default)]
12695 pub dest: Option<Box<Expression>>,
12696 #[serde(default)]
12697 pub source: Option<Box<Expression>>,
12698}
12699
12700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12702#[cfg_attr(feature = "bindings", derive(TS))]
12703pub struct ConvertTimezone {
12704 #[serde(default)]
12705 pub source_tz: Option<Box<Expression>>,
12706 #[serde(default)]
12707 pub target_tz: Option<Box<Expression>>,
12708 #[serde(default)]
12709 pub timestamp: Option<Box<Expression>>,
12710 #[serde(default)]
12711 pub options: Vec<Expression>,
12712}
12713
12714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12716#[cfg_attr(feature = "bindings", derive(TS))]
12717pub struct GenerateSeries {
12718 #[serde(default)]
12719 pub start: Option<Box<Expression>>,
12720 #[serde(default)]
12721 pub end: Option<Box<Expression>>,
12722 #[serde(default)]
12723 pub step: Option<Box<Expression>>,
12724 #[serde(default)]
12725 pub is_end_exclusive: Option<Box<Expression>>,
12726}
12727
12728#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12730#[cfg_attr(feature = "bindings", derive(TS))]
12731pub struct AIAgg {
12732 pub this: Box<Expression>,
12733 pub expression: Box<Expression>,
12734}
12735
12736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12738#[cfg_attr(feature = "bindings", derive(TS))]
12739pub struct AIClassify {
12740 pub this: Box<Expression>,
12741 #[serde(default)]
12742 pub categories: Option<Box<Expression>>,
12743 #[serde(default)]
12744 pub config: Option<Box<Expression>>,
12745}
12746
12747#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12749#[cfg_attr(feature = "bindings", derive(TS))]
12750pub struct ArrayAll {
12751 pub this: Box<Expression>,
12752 pub expression: Box<Expression>,
12753}
12754
12755#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12757#[cfg_attr(feature = "bindings", derive(TS))]
12758pub struct ArrayAny {
12759 pub this: Box<Expression>,
12760 pub expression: Box<Expression>,
12761}
12762
12763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12765#[cfg_attr(feature = "bindings", derive(TS))]
12766pub struct ArrayConstructCompact {
12767 #[serde(default)]
12768 pub expressions: Vec<Expression>,
12769}
12770
12771#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12773#[cfg_attr(feature = "bindings", derive(TS))]
12774pub struct StPoint {
12775 pub this: Box<Expression>,
12776 pub expression: Box<Expression>,
12777 #[serde(default)]
12778 pub null: Option<Box<Expression>>,
12779}
12780
12781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12783#[cfg_attr(feature = "bindings", derive(TS))]
12784pub struct StDistance {
12785 pub this: Box<Expression>,
12786 pub expression: Box<Expression>,
12787 #[serde(default)]
12788 pub use_spheroid: Option<Box<Expression>>,
12789}
12790
12791#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12793#[cfg_attr(feature = "bindings", derive(TS))]
12794pub struct StringToArray {
12795 pub this: Box<Expression>,
12796 #[serde(default)]
12797 pub expression: Option<Box<Expression>>,
12798 #[serde(default)]
12799 pub null: Option<Box<Expression>>,
12800}
12801
12802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12804#[cfg_attr(feature = "bindings", derive(TS))]
12805pub struct ArraySum {
12806 pub this: Box<Expression>,
12807 #[serde(default)]
12808 pub expression: Option<Box<Expression>>,
12809}
12810
12811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12813#[cfg_attr(feature = "bindings", derive(TS))]
12814pub struct ObjectAgg {
12815 pub this: Box<Expression>,
12816 pub expression: Box<Expression>,
12817}
12818
12819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12821#[cfg_attr(feature = "bindings", derive(TS))]
12822pub struct CastToStrType {
12823 pub this: Box<Expression>,
12824 #[serde(default)]
12825 pub to: Option<Box<Expression>>,
12826}
12827
12828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12830#[cfg_attr(feature = "bindings", derive(TS))]
12831pub struct CheckJson {
12832 pub this: Box<Expression>,
12833}
12834
12835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12837#[cfg_attr(feature = "bindings", derive(TS))]
12838pub struct CheckXml {
12839 pub this: Box<Expression>,
12840 #[serde(default)]
12841 pub disable_auto_convert: Option<Box<Expression>>,
12842}
12843
12844#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12846#[cfg_attr(feature = "bindings", derive(TS))]
12847pub struct TranslateCharacters {
12848 pub this: Box<Expression>,
12849 pub expression: Box<Expression>,
12850 #[serde(default)]
12851 pub with_error: Option<Box<Expression>>,
12852}
12853
12854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12856#[cfg_attr(feature = "bindings", derive(TS))]
12857pub struct CurrentSchemas {
12858 #[serde(default)]
12859 pub this: Option<Box<Expression>>,
12860}
12861
12862#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12864#[cfg_attr(feature = "bindings", derive(TS))]
12865pub struct CurrentDatetime {
12866 #[serde(default)]
12867 pub this: Option<Box<Expression>>,
12868}
12869
12870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12872#[cfg_attr(feature = "bindings", derive(TS))]
12873pub struct Localtime {
12874 #[serde(default)]
12875 pub this: Option<Box<Expression>>,
12876}
12877
12878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12880#[cfg_attr(feature = "bindings", derive(TS))]
12881pub struct Localtimestamp {
12882 #[serde(default)]
12883 pub this: Option<Box<Expression>>,
12884}
12885
12886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12888#[cfg_attr(feature = "bindings", derive(TS))]
12889pub struct Systimestamp {
12890 #[serde(default)]
12891 pub this: Option<Box<Expression>>,
12892}
12893
12894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12896#[cfg_attr(feature = "bindings", derive(TS))]
12897pub struct CurrentSchema {
12898 #[serde(default)]
12899 pub this: Option<Box<Expression>>,
12900}
12901
12902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12904#[cfg_attr(feature = "bindings", derive(TS))]
12905pub struct CurrentUser {
12906 #[serde(default)]
12907 pub this: Option<Box<Expression>>,
12908}
12909
12910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12912#[cfg_attr(feature = "bindings", derive(TS))]
12913pub struct SessionUser;
12914
12915#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12917#[cfg_attr(feature = "bindings", derive(TS))]
12918pub struct JSONPathRoot;
12919
12920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12922#[cfg_attr(feature = "bindings", derive(TS))]
12923pub struct UtcTime {
12924 #[serde(default)]
12925 pub this: Option<Box<Expression>>,
12926}
12927
12928#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12930#[cfg_attr(feature = "bindings", derive(TS))]
12931pub struct UtcTimestamp {
12932 #[serde(default)]
12933 pub this: Option<Box<Expression>>,
12934}
12935
12936#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12938#[cfg_attr(feature = "bindings", derive(TS))]
12939pub struct TimestampFunc {
12940 #[serde(default)]
12941 pub this: Option<Box<Expression>>,
12942 #[serde(default)]
12943 pub zone: Option<Box<Expression>>,
12944 #[serde(default)]
12945 pub with_tz: Option<bool>,
12946 #[serde(default)]
12947 pub safe: Option<bool>,
12948}
12949
12950#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12952#[cfg_attr(feature = "bindings", derive(TS))]
12953pub struct DateBin {
12954 pub this: Box<Expression>,
12955 pub expression: Box<Expression>,
12956 #[serde(default)]
12957 pub unit: Option<String>,
12958 #[serde(default)]
12959 pub zone: Option<Box<Expression>>,
12960 #[serde(default)]
12961 pub origin: Option<Box<Expression>>,
12962}
12963
12964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12966#[cfg_attr(feature = "bindings", derive(TS))]
12967pub struct Datetime {
12968 pub this: Box<Expression>,
12969 #[serde(default)]
12970 pub expression: Option<Box<Expression>>,
12971}
12972
12973#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12975#[cfg_attr(feature = "bindings", derive(TS))]
12976pub struct DatetimeAdd {
12977 pub this: Box<Expression>,
12978 pub expression: Box<Expression>,
12979 #[serde(default)]
12980 pub unit: Option<String>,
12981}
12982
12983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12985#[cfg_attr(feature = "bindings", derive(TS))]
12986pub struct DatetimeSub {
12987 pub this: Box<Expression>,
12988 pub expression: Box<Expression>,
12989 #[serde(default)]
12990 pub unit: Option<String>,
12991}
12992
12993#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12995#[cfg_attr(feature = "bindings", derive(TS))]
12996pub struct DatetimeDiff {
12997 pub this: Box<Expression>,
12998 pub expression: Box<Expression>,
12999 #[serde(default)]
13000 pub unit: Option<String>,
13001}
13002
13003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13005#[cfg_attr(feature = "bindings", derive(TS))]
13006pub struct DatetimeTrunc {
13007 pub this: Box<Expression>,
13008 pub unit: String,
13009 #[serde(default)]
13010 pub zone: Option<Box<Expression>>,
13011}
13012
13013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13015#[cfg_attr(feature = "bindings", derive(TS))]
13016pub struct Dayname {
13017 pub this: Box<Expression>,
13018 #[serde(default)]
13019 pub abbreviated: Option<Box<Expression>>,
13020}
13021
13022#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13024#[cfg_attr(feature = "bindings", derive(TS))]
13025pub struct MakeInterval {
13026 #[serde(default)]
13027 pub year: Option<Box<Expression>>,
13028 #[serde(default)]
13029 pub month: Option<Box<Expression>>,
13030 #[serde(default)]
13031 pub week: Option<Box<Expression>>,
13032 #[serde(default)]
13033 pub day: Option<Box<Expression>>,
13034 #[serde(default)]
13035 pub hour: Option<Box<Expression>>,
13036 #[serde(default)]
13037 pub minute: Option<Box<Expression>>,
13038 #[serde(default)]
13039 pub second: Option<Box<Expression>>,
13040}
13041
13042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13044#[cfg_attr(feature = "bindings", derive(TS))]
13045pub struct PreviousDay {
13046 pub this: Box<Expression>,
13047 pub expression: Box<Expression>,
13048}
13049
13050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13052#[cfg_attr(feature = "bindings", derive(TS))]
13053pub struct Elt {
13054 pub this: Box<Expression>,
13055 #[serde(default)]
13056 pub expressions: Vec<Expression>,
13057}
13058
13059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13061#[cfg_attr(feature = "bindings", derive(TS))]
13062pub struct TimestampAdd {
13063 pub this: Box<Expression>,
13064 pub expression: Box<Expression>,
13065 #[serde(default)]
13066 pub unit: Option<String>,
13067}
13068
13069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13071#[cfg_attr(feature = "bindings", derive(TS))]
13072pub struct TimestampSub {
13073 pub this: Box<Expression>,
13074 pub expression: Box<Expression>,
13075 #[serde(default)]
13076 pub unit: Option<String>,
13077}
13078
13079#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13081#[cfg_attr(feature = "bindings", derive(TS))]
13082pub struct TimestampDiff {
13083 pub this: Box<Expression>,
13084 pub expression: Box<Expression>,
13085 #[serde(default)]
13086 pub unit: Option<String>,
13087}
13088
13089#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13091#[cfg_attr(feature = "bindings", derive(TS))]
13092pub struct TimeSlice {
13093 pub this: Box<Expression>,
13094 pub expression: Box<Expression>,
13095 pub unit: String,
13096 #[serde(default)]
13097 pub kind: Option<String>,
13098}
13099
13100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13102#[cfg_attr(feature = "bindings", derive(TS))]
13103pub struct TimeAdd {
13104 pub this: Box<Expression>,
13105 pub expression: Box<Expression>,
13106 #[serde(default)]
13107 pub unit: Option<String>,
13108}
13109
13110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13112#[cfg_attr(feature = "bindings", derive(TS))]
13113pub struct TimeSub {
13114 pub this: Box<Expression>,
13115 pub expression: Box<Expression>,
13116 #[serde(default)]
13117 pub unit: Option<String>,
13118}
13119
13120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13122#[cfg_attr(feature = "bindings", derive(TS))]
13123pub struct TimeDiff {
13124 pub this: Box<Expression>,
13125 pub expression: Box<Expression>,
13126 #[serde(default)]
13127 pub unit: Option<String>,
13128}
13129
13130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13132#[cfg_attr(feature = "bindings", derive(TS))]
13133pub struct TimeTrunc {
13134 pub this: Box<Expression>,
13135 pub unit: String,
13136 #[serde(default)]
13137 pub zone: Option<Box<Expression>>,
13138}
13139
13140#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13142#[cfg_attr(feature = "bindings", derive(TS))]
13143pub struct DateFromParts {
13144 #[serde(default)]
13145 pub year: Option<Box<Expression>>,
13146 #[serde(default)]
13147 pub month: Option<Box<Expression>>,
13148 #[serde(default)]
13149 pub day: Option<Box<Expression>>,
13150 #[serde(default)]
13151 pub allow_overflow: Option<Box<Expression>>,
13152}
13153
13154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13156#[cfg_attr(feature = "bindings", derive(TS))]
13157pub struct TimeFromParts {
13158 #[serde(default)]
13159 pub hour: Option<Box<Expression>>,
13160 #[serde(default)]
13161 pub min: Option<Box<Expression>>,
13162 #[serde(default)]
13163 pub sec: Option<Box<Expression>>,
13164 #[serde(default)]
13165 pub nano: Option<Box<Expression>>,
13166 #[serde(default)]
13167 pub fractions: Option<Box<Expression>>,
13168 #[serde(default)]
13169 pub precision: Option<i64>,
13170}
13171
13172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13174#[cfg_attr(feature = "bindings", derive(TS))]
13175pub struct DecodeCase {
13176 #[serde(default)]
13177 pub expressions: Vec<Expression>,
13178}
13179
13180#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13182#[cfg_attr(feature = "bindings", derive(TS))]
13183pub struct Decrypt {
13184 pub this: Box<Expression>,
13185 #[serde(default)]
13186 pub passphrase: Option<Box<Expression>>,
13187 #[serde(default)]
13188 pub aad: Option<Box<Expression>>,
13189 #[serde(default)]
13190 pub encryption_method: Option<Box<Expression>>,
13191 #[serde(default)]
13192 pub safe: Option<Box<Expression>>,
13193}
13194
13195#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13197#[cfg_attr(feature = "bindings", derive(TS))]
13198pub struct DecryptRaw {
13199 pub this: Box<Expression>,
13200 #[serde(default)]
13201 pub key: Option<Box<Expression>>,
13202 #[serde(default)]
13203 pub iv: Option<Box<Expression>>,
13204 #[serde(default)]
13205 pub aad: Option<Box<Expression>>,
13206 #[serde(default)]
13207 pub encryption_method: Option<Box<Expression>>,
13208 #[serde(default)]
13209 pub aead: Option<Box<Expression>>,
13210 #[serde(default)]
13211 pub safe: Option<Box<Expression>>,
13212}
13213
13214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13216#[cfg_attr(feature = "bindings", derive(TS))]
13217pub struct Encode {
13218 pub this: Box<Expression>,
13219 #[serde(default)]
13220 pub charset: Option<Box<Expression>>,
13221}
13222
13223#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13225#[cfg_attr(feature = "bindings", derive(TS))]
13226pub struct Encrypt {
13227 pub this: Box<Expression>,
13228 #[serde(default)]
13229 pub passphrase: Option<Box<Expression>>,
13230 #[serde(default)]
13231 pub aad: Option<Box<Expression>>,
13232 #[serde(default)]
13233 pub encryption_method: Option<Box<Expression>>,
13234}
13235
13236#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13238#[cfg_attr(feature = "bindings", derive(TS))]
13239pub struct EncryptRaw {
13240 pub this: Box<Expression>,
13241 #[serde(default)]
13242 pub key: Option<Box<Expression>>,
13243 #[serde(default)]
13244 pub iv: Option<Box<Expression>>,
13245 #[serde(default)]
13246 pub aad: Option<Box<Expression>>,
13247 #[serde(default)]
13248 pub encryption_method: Option<Box<Expression>>,
13249}
13250
13251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13253#[cfg_attr(feature = "bindings", derive(TS))]
13254pub struct EqualNull {
13255 pub this: Box<Expression>,
13256 pub expression: Box<Expression>,
13257}
13258
13259#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13261#[cfg_attr(feature = "bindings", derive(TS))]
13262pub struct ToBinary {
13263 pub this: Box<Expression>,
13264 #[serde(default)]
13265 pub format: Option<String>,
13266 #[serde(default)]
13267 pub safe: Option<Box<Expression>>,
13268}
13269
13270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13272#[cfg_attr(feature = "bindings", derive(TS))]
13273pub struct Base64DecodeBinary {
13274 pub this: Box<Expression>,
13275 #[serde(default)]
13276 pub alphabet: Option<Box<Expression>>,
13277}
13278
13279#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13281#[cfg_attr(feature = "bindings", derive(TS))]
13282pub struct Base64DecodeString {
13283 pub this: Box<Expression>,
13284 #[serde(default)]
13285 pub alphabet: Option<Box<Expression>>,
13286}
13287
13288#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13290#[cfg_attr(feature = "bindings", derive(TS))]
13291pub struct Base64Encode {
13292 pub this: Box<Expression>,
13293 #[serde(default)]
13294 pub max_line_length: Option<Box<Expression>>,
13295 #[serde(default)]
13296 pub alphabet: Option<Box<Expression>>,
13297}
13298
13299#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13301#[cfg_attr(feature = "bindings", derive(TS))]
13302pub struct TryBase64DecodeBinary {
13303 pub this: Box<Expression>,
13304 #[serde(default)]
13305 pub alphabet: Option<Box<Expression>>,
13306}
13307
13308#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13310#[cfg_attr(feature = "bindings", derive(TS))]
13311pub struct TryBase64DecodeString {
13312 pub this: Box<Expression>,
13313 #[serde(default)]
13314 pub alphabet: Option<Box<Expression>>,
13315}
13316
13317#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13319#[cfg_attr(feature = "bindings", derive(TS))]
13320pub struct GapFill {
13321 pub this: Box<Expression>,
13322 #[serde(default)]
13323 pub ts_column: Option<Box<Expression>>,
13324 #[serde(default)]
13325 pub bucket_width: Option<Box<Expression>>,
13326 #[serde(default)]
13327 pub partitioning_columns: Option<Box<Expression>>,
13328 #[serde(default)]
13329 pub value_columns: Option<Box<Expression>>,
13330 #[serde(default)]
13331 pub origin: Option<Box<Expression>>,
13332 #[serde(default)]
13333 pub ignore_nulls: Option<Box<Expression>>,
13334}
13335
13336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13338#[cfg_attr(feature = "bindings", derive(TS))]
13339pub struct GenerateDateArray {
13340 #[serde(default)]
13341 pub start: Option<Box<Expression>>,
13342 #[serde(default)]
13343 pub end: Option<Box<Expression>>,
13344 #[serde(default)]
13345 pub step: Option<Box<Expression>>,
13346}
13347
13348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13350#[cfg_attr(feature = "bindings", derive(TS))]
13351pub struct GenerateTimestampArray {
13352 #[serde(default)]
13353 pub start: Option<Box<Expression>>,
13354 #[serde(default)]
13355 pub end: Option<Box<Expression>>,
13356 #[serde(default)]
13357 pub step: Option<Box<Expression>>,
13358}
13359
13360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13362#[cfg_attr(feature = "bindings", derive(TS))]
13363pub struct GetExtract {
13364 pub this: Box<Expression>,
13365 pub expression: Box<Expression>,
13366}
13367
13368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13370#[cfg_attr(feature = "bindings", derive(TS))]
13371pub struct Getbit {
13372 pub this: Box<Expression>,
13373 pub expression: Box<Expression>,
13374 #[serde(default)]
13375 pub zero_is_msb: Option<Box<Expression>>,
13376}
13377
13378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13380#[cfg_attr(feature = "bindings", derive(TS))]
13381pub struct OverflowTruncateBehavior {
13382 #[serde(default)]
13383 pub this: Option<Box<Expression>>,
13384 #[serde(default)]
13385 pub with_count: Option<Box<Expression>>,
13386}
13387
13388#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13390#[cfg_attr(feature = "bindings", derive(TS))]
13391pub struct HexEncode {
13392 pub this: Box<Expression>,
13393 #[serde(default)]
13394 pub case: Option<Box<Expression>>,
13395}
13396
13397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13399#[cfg_attr(feature = "bindings", derive(TS))]
13400pub struct Compress {
13401 pub this: Box<Expression>,
13402 #[serde(default)]
13403 pub method: Option<String>,
13404}
13405
13406#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13408#[cfg_attr(feature = "bindings", derive(TS))]
13409pub struct DecompressBinary {
13410 pub this: Box<Expression>,
13411 pub method: String,
13412}
13413
13414#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13416#[cfg_attr(feature = "bindings", derive(TS))]
13417pub struct DecompressString {
13418 pub this: Box<Expression>,
13419 pub method: String,
13420}
13421
13422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13424#[cfg_attr(feature = "bindings", derive(TS))]
13425pub struct Xor {
13426 #[serde(default)]
13427 pub this: Option<Box<Expression>>,
13428 #[serde(default)]
13429 pub expression: Option<Box<Expression>>,
13430 #[serde(default)]
13431 pub expressions: Vec<Expression>,
13432}
13433
13434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13436#[cfg_attr(feature = "bindings", derive(TS))]
13437pub struct Nullif {
13438 pub this: Box<Expression>,
13439 pub expression: Box<Expression>,
13440}
13441
13442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13444#[cfg_attr(feature = "bindings", derive(TS))]
13445pub struct JSON {
13446 #[serde(default)]
13447 pub this: Option<Box<Expression>>,
13448 #[serde(default)]
13449 pub with_: Option<Box<Expression>>,
13450 #[serde(default)]
13451 pub unique: bool,
13452}
13453
13454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13456#[cfg_attr(feature = "bindings", derive(TS))]
13457pub struct JSONPath {
13458 #[serde(default)]
13459 pub expressions: Vec<Expression>,
13460 #[serde(default)]
13461 pub escape: Option<Box<Expression>>,
13462}
13463
13464#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13466#[cfg_attr(feature = "bindings", derive(TS))]
13467pub struct JSONPathFilter {
13468 pub this: Box<Expression>,
13469}
13470
13471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13473#[cfg_attr(feature = "bindings", derive(TS))]
13474pub struct JSONPathKey {
13475 pub this: Box<Expression>,
13476}
13477
13478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13480#[cfg_attr(feature = "bindings", derive(TS))]
13481pub struct JSONPathRecursive {
13482 #[serde(default)]
13483 pub this: Option<Box<Expression>>,
13484}
13485
13486#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13488#[cfg_attr(feature = "bindings", derive(TS))]
13489pub struct JSONPathScript {
13490 pub this: Box<Expression>,
13491}
13492
13493#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13495#[cfg_attr(feature = "bindings", derive(TS))]
13496pub struct JSONPathSlice {
13497 #[serde(default)]
13498 pub start: Option<Box<Expression>>,
13499 #[serde(default)]
13500 pub end: Option<Box<Expression>>,
13501 #[serde(default)]
13502 pub step: Option<Box<Expression>>,
13503}
13504
13505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13507#[cfg_attr(feature = "bindings", derive(TS))]
13508pub struct JSONPathSelector {
13509 pub this: Box<Expression>,
13510}
13511
13512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13514#[cfg_attr(feature = "bindings", derive(TS))]
13515pub struct JSONPathSubscript {
13516 pub this: Box<Expression>,
13517}
13518
13519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13521#[cfg_attr(feature = "bindings", derive(TS))]
13522pub struct JSONPathUnion {
13523 #[serde(default)]
13524 pub expressions: Vec<Expression>,
13525}
13526
13527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13529#[cfg_attr(feature = "bindings", derive(TS))]
13530pub struct Format {
13531 pub this: Box<Expression>,
13532 #[serde(default)]
13533 pub expressions: Vec<Expression>,
13534}
13535
13536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13538#[cfg_attr(feature = "bindings", derive(TS))]
13539pub struct JSONKeys {
13540 pub this: Box<Expression>,
13541 #[serde(default)]
13542 pub expression: Option<Box<Expression>>,
13543 #[serde(default)]
13544 pub expressions: Vec<Expression>,
13545}
13546
13547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13549#[cfg_attr(feature = "bindings", derive(TS))]
13550pub struct JSONKeyValue {
13551 pub this: Box<Expression>,
13552 pub expression: Box<Expression>,
13553}
13554
13555#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13557#[cfg_attr(feature = "bindings", derive(TS))]
13558pub struct JSONKeysAtDepth {
13559 pub this: Box<Expression>,
13560 #[serde(default)]
13561 pub expression: Option<Box<Expression>>,
13562 #[serde(default)]
13563 pub mode: Option<Box<Expression>>,
13564}
13565
13566#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13568#[cfg_attr(feature = "bindings", derive(TS))]
13569pub struct JSONObject {
13570 #[serde(default)]
13571 pub expressions: Vec<Expression>,
13572 #[serde(default)]
13573 pub null_handling: Option<Box<Expression>>,
13574 #[serde(default)]
13575 pub unique_keys: Option<Box<Expression>>,
13576 #[serde(default)]
13577 pub return_type: Option<Box<Expression>>,
13578 #[serde(default)]
13579 pub encoding: Option<Box<Expression>>,
13580}
13581
13582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13584#[cfg_attr(feature = "bindings", derive(TS))]
13585pub struct JSONObjectAgg {
13586 #[serde(default)]
13587 pub expressions: Vec<Expression>,
13588 #[serde(default)]
13589 pub null_handling: Option<Box<Expression>>,
13590 #[serde(default)]
13591 pub unique_keys: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub return_type: Option<Box<Expression>>,
13594 #[serde(default)]
13595 pub encoding: Option<Box<Expression>>,
13596}
13597
13598#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13600#[cfg_attr(feature = "bindings", derive(TS))]
13601pub struct JSONBObjectAgg {
13602 pub this: Box<Expression>,
13603 pub expression: Box<Expression>,
13604}
13605
13606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13608#[cfg_attr(feature = "bindings", derive(TS))]
13609pub struct JSONArray {
13610 #[serde(default)]
13611 pub expressions: Vec<Expression>,
13612 #[serde(default)]
13613 pub null_handling: Option<Box<Expression>>,
13614 #[serde(default)]
13615 pub return_type: Option<Box<Expression>>,
13616 #[serde(default)]
13617 pub strict: Option<Box<Expression>>,
13618}
13619
13620#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13622#[cfg_attr(feature = "bindings", derive(TS))]
13623pub struct JSONArrayAgg {
13624 pub this: Box<Expression>,
13625 #[serde(default)]
13626 pub order: Option<Box<Expression>>,
13627 #[serde(default)]
13628 pub null_handling: Option<Box<Expression>>,
13629 #[serde(default)]
13630 pub return_type: Option<Box<Expression>>,
13631 #[serde(default)]
13632 pub strict: Option<Box<Expression>>,
13633}
13634
13635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13637#[cfg_attr(feature = "bindings", derive(TS))]
13638pub struct JSONExists {
13639 pub this: Box<Expression>,
13640 #[serde(default)]
13641 pub path: Option<Box<Expression>>,
13642 #[serde(default)]
13643 pub passing: Option<Box<Expression>>,
13644 #[serde(default)]
13645 pub on_condition: Option<Box<Expression>>,
13646 #[serde(default)]
13647 pub from_dcolonqmark: Option<Box<Expression>>,
13648}
13649
13650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13652#[cfg_attr(feature = "bindings", derive(TS))]
13653pub struct JSONColumnDef {
13654 #[serde(default)]
13655 pub this: Option<Box<Expression>>,
13656 #[serde(default)]
13657 pub kind: Option<String>,
13658 #[serde(default)]
13659 pub format_json: bool,
13660 #[serde(default)]
13661 pub path: Option<Box<Expression>>,
13662 #[serde(default)]
13663 pub nested_schema: Option<Box<Expression>>,
13664 #[serde(default)]
13665 pub ordinality: Option<Box<Expression>>,
13666}
13667
13668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13670#[cfg_attr(feature = "bindings", derive(TS))]
13671pub struct JSONSchema {
13672 #[serde(default)]
13673 pub expressions: Vec<Expression>,
13674}
13675
13676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13678#[cfg_attr(feature = "bindings", derive(TS))]
13679pub struct JSONSet {
13680 pub this: Box<Expression>,
13681 #[serde(default)]
13682 pub expressions: Vec<Expression>,
13683}
13684
13685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13687#[cfg_attr(feature = "bindings", derive(TS))]
13688pub struct JSONStripNulls {
13689 pub this: Box<Expression>,
13690 #[serde(default)]
13691 pub expression: Option<Box<Expression>>,
13692 #[serde(default)]
13693 pub include_arrays: Option<Box<Expression>>,
13694 #[serde(default)]
13695 pub remove_empty: Option<Box<Expression>>,
13696}
13697
13698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13700#[cfg_attr(feature = "bindings", derive(TS))]
13701pub struct JSONValue {
13702 pub this: Box<Expression>,
13703 #[serde(default)]
13704 pub path: Option<Box<Expression>>,
13705 #[serde(default)]
13706 pub returning: Option<Box<Expression>>,
13707 #[serde(default)]
13708 pub on_condition: Option<Box<Expression>>,
13709}
13710
13711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13713#[cfg_attr(feature = "bindings", derive(TS))]
13714pub struct JSONValueArray {
13715 pub this: Box<Expression>,
13716 #[serde(default)]
13717 pub expression: Option<Box<Expression>>,
13718}
13719
13720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13722#[cfg_attr(feature = "bindings", derive(TS))]
13723pub struct JSONRemove {
13724 pub this: Box<Expression>,
13725 #[serde(default)]
13726 pub expressions: Vec<Expression>,
13727}
13728
13729#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13731#[cfg_attr(feature = "bindings", derive(TS))]
13732pub struct JSONTable {
13733 pub this: Box<Expression>,
13734 #[serde(default)]
13735 pub schema: Option<Box<Expression>>,
13736 #[serde(default)]
13737 pub path: Option<Box<Expression>>,
13738 #[serde(default)]
13739 pub error_handling: Option<Box<Expression>>,
13740 #[serde(default)]
13741 pub empty_handling: Option<Box<Expression>>,
13742}
13743
13744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13746#[cfg_attr(feature = "bindings", derive(TS))]
13747pub struct JSONType {
13748 pub this: Box<Expression>,
13749 #[serde(default)]
13750 pub expression: Option<Box<Expression>>,
13751}
13752
13753#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13755#[cfg_attr(feature = "bindings", derive(TS))]
13756pub struct ObjectInsert {
13757 pub this: Box<Expression>,
13758 #[serde(default)]
13759 pub key: Option<Box<Expression>>,
13760 #[serde(default)]
13761 pub value: Option<Box<Expression>>,
13762 #[serde(default)]
13763 pub update_flag: Option<Box<Expression>>,
13764}
13765
13766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13768#[cfg_attr(feature = "bindings", derive(TS))]
13769pub struct OpenJSONColumnDef {
13770 pub this: Box<Expression>,
13771 pub kind: String,
13772 #[serde(default)]
13773 pub path: Option<Box<Expression>>,
13774 #[serde(default)]
13775 pub as_json: Option<Box<Expression>>,
13776 #[serde(default, skip_serializing_if = "Option::is_none")]
13778 pub data_type: Option<DataType>,
13779}
13780
13781#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13783#[cfg_attr(feature = "bindings", derive(TS))]
13784pub struct OpenJSON {
13785 pub this: Box<Expression>,
13786 #[serde(default)]
13787 pub path: Option<Box<Expression>>,
13788 #[serde(default)]
13789 pub expressions: Vec<Expression>,
13790}
13791
13792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13794#[cfg_attr(feature = "bindings", derive(TS))]
13795pub struct JSONBExists {
13796 pub this: Box<Expression>,
13797 #[serde(default)]
13798 pub path: Option<Box<Expression>>,
13799}
13800
13801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13803#[cfg_attr(feature = "bindings", derive(TS))]
13804pub struct JSONCast {
13805 pub this: Box<Expression>,
13806 pub to: DataType,
13807}
13808
13809#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13811#[cfg_attr(feature = "bindings", derive(TS))]
13812pub struct JSONExtract {
13813 pub this: Box<Expression>,
13814 pub expression: Box<Expression>,
13815 #[serde(default)]
13816 pub only_json_types: Option<Box<Expression>>,
13817 #[serde(default)]
13818 pub expressions: Vec<Expression>,
13819 #[serde(default)]
13820 pub variant_extract: Option<Box<Expression>>,
13821 #[serde(default)]
13822 pub json_query: Option<Box<Expression>>,
13823 #[serde(default)]
13824 pub option: Option<Box<Expression>>,
13825 #[serde(default)]
13826 pub quote: Option<Box<Expression>>,
13827 #[serde(default)]
13828 pub on_condition: Option<Box<Expression>>,
13829 #[serde(default)]
13830 pub requires_json: Option<Box<Expression>>,
13831}
13832
13833#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13835#[cfg_attr(feature = "bindings", derive(TS))]
13836pub struct JSONExtractQuote {
13837 #[serde(default)]
13838 pub option: Option<Box<Expression>>,
13839 #[serde(default)]
13840 pub scalar: Option<Box<Expression>>,
13841}
13842
13843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13845#[cfg_attr(feature = "bindings", derive(TS))]
13846pub struct JSONExtractArray {
13847 pub this: Box<Expression>,
13848 #[serde(default)]
13849 pub expression: Option<Box<Expression>>,
13850}
13851
13852#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13854#[cfg_attr(feature = "bindings", derive(TS))]
13855pub struct JSONExtractScalar {
13856 pub this: Box<Expression>,
13857 pub expression: Box<Expression>,
13858 #[serde(default)]
13859 pub only_json_types: Option<Box<Expression>>,
13860 #[serde(default)]
13861 pub expressions: Vec<Expression>,
13862 #[serde(default)]
13863 pub json_type: Option<Box<Expression>>,
13864 #[serde(default)]
13865 pub scalar_only: Option<Box<Expression>>,
13866}
13867
13868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13870#[cfg_attr(feature = "bindings", derive(TS))]
13871pub struct JSONBExtractScalar {
13872 pub this: Box<Expression>,
13873 pub expression: Box<Expression>,
13874 #[serde(default)]
13875 pub json_type: Option<Box<Expression>>,
13876}
13877
13878#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13880#[cfg_attr(feature = "bindings", derive(TS))]
13881pub struct JSONFormat {
13882 #[serde(default)]
13883 pub this: Option<Box<Expression>>,
13884 #[serde(default)]
13885 pub options: Vec<Expression>,
13886 #[serde(default)]
13887 pub is_json: Option<Box<Expression>>,
13888 #[serde(default)]
13889 pub to_json: Option<Box<Expression>>,
13890}
13891
13892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13894#[cfg_attr(feature = "bindings", derive(TS))]
13895pub struct JSONArrayAppend {
13896 pub this: Box<Expression>,
13897 #[serde(default)]
13898 pub expressions: Vec<Expression>,
13899}
13900
13901#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13903#[cfg_attr(feature = "bindings", derive(TS))]
13904pub struct JSONArrayContains {
13905 pub this: Box<Expression>,
13906 pub expression: Box<Expression>,
13907 #[serde(default)]
13908 pub json_type: Option<Box<Expression>>,
13909}
13910
13911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13913#[cfg_attr(feature = "bindings", derive(TS))]
13914pub struct JSONArrayInsert {
13915 pub this: Box<Expression>,
13916 #[serde(default)]
13917 pub expressions: Vec<Expression>,
13918}
13919
13920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13922#[cfg_attr(feature = "bindings", derive(TS))]
13923pub struct ParseJSON {
13924 pub this: Box<Expression>,
13925 #[serde(default)]
13926 pub expression: Option<Box<Expression>>,
13927 #[serde(default)]
13928 pub safe: Option<Box<Expression>>,
13929}
13930
13931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13933#[cfg_attr(feature = "bindings", derive(TS))]
13934pub struct ParseUrl {
13935 pub this: Box<Expression>,
13936 #[serde(default)]
13937 pub part_to_extract: Option<Box<Expression>>,
13938 #[serde(default)]
13939 pub key: Option<Box<Expression>>,
13940 #[serde(default)]
13941 pub permissive: Option<Box<Expression>>,
13942}
13943
13944#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13946#[cfg_attr(feature = "bindings", derive(TS))]
13947pub struct ParseIp {
13948 pub this: Box<Expression>,
13949 #[serde(default)]
13950 pub type_: Option<Box<Expression>>,
13951 #[serde(default)]
13952 pub permissive: Option<Box<Expression>>,
13953}
13954
13955#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13957#[cfg_attr(feature = "bindings", derive(TS))]
13958pub struct ParseTime {
13959 pub this: Box<Expression>,
13960 pub format: String,
13961}
13962
13963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13965#[cfg_attr(feature = "bindings", derive(TS))]
13966pub struct ParseDatetime {
13967 pub this: Box<Expression>,
13968 #[serde(default)]
13969 pub format: Option<String>,
13970 #[serde(default)]
13971 pub zone: Option<Box<Expression>>,
13972}
13973
13974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13976#[cfg_attr(feature = "bindings", derive(TS))]
13977pub struct Map {
13978 #[serde(default)]
13979 pub keys: Vec<Expression>,
13980 #[serde(default)]
13981 pub values: Vec<Expression>,
13982}
13983
13984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13986#[cfg_attr(feature = "bindings", derive(TS))]
13987pub struct MapCat {
13988 pub this: Box<Expression>,
13989 pub expression: Box<Expression>,
13990}
13991
13992#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13994#[cfg_attr(feature = "bindings", derive(TS))]
13995pub struct MapDelete {
13996 pub this: Box<Expression>,
13997 #[serde(default)]
13998 pub expressions: Vec<Expression>,
13999}
14000
14001#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14003#[cfg_attr(feature = "bindings", derive(TS))]
14004pub struct MapInsert {
14005 pub this: Box<Expression>,
14006 #[serde(default)]
14007 pub key: Option<Box<Expression>>,
14008 #[serde(default)]
14009 pub value: Option<Box<Expression>>,
14010 #[serde(default)]
14011 pub update_flag: Option<Box<Expression>>,
14012}
14013
14014#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14016#[cfg_attr(feature = "bindings", derive(TS))]
14017pub struct MapPick {
14018 pub this: Box<Expression>,
14019 #[serde(default)]
14020 pub expressions: Vec<Expression>,
14021}
14022
14023#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14025#[cfg_attr(feature = "bindings", derive(TS))]
14026pub struct ScopeResolution {
14027 #[serde(default)]
14028 pub this: Option<Box<Expression>>,
14029 pub expression: Box<Expression>,
14030}
14031
14032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14034#[cfg_attr(feature = "bindings", derive(TS))]
14035pub struct Slice {
14036 #[serde(default)]
14037 pub this: Option<Box<Expression>>,
14038 #[serde(default)]
14039 pub expression: Option<Box<Expression>>,
14040 #[serde(default)]
14041 pub step: Option<Box<Expression>>,
14042}
14043
14044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14046#[cfg_attr(feature = "bindings", derive(TS))]
14047pub struct VarMap {
14048 #[serde(default)]
14049 pub keys: Vec<Expression>,
14050 #[serde(default)]
14051 pub values: Vec<Expression>,
14052}
14053
14054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14056#[cfg_attr(feature = "bindings", derive(TS))]
14057pub struct MatchAgainst {
14058 pub this: Box<Expression>,
14059 #[serde(default)]
14060 pub expressions: Vec<Expression>,
14061 #[serde(default)]
14062 pub modifier: Option<Box<Expression>>,
14063}
14064
14065#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14067#[cfg_attr(feature = "bindings", derive(TS))]
14068pub struct MD5Digest {
14069 pub this: Box<Expression>,
14070 #[serde(default)]
14071 pub expressions: Vec<Expression>,
14072}
14073
14074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14076#[cfg_attr(feature = "bindings", derive(TS))]
14077pub struct Monthname {
14078 pub this: Box<Expression>,
14079 #[serde(default)]
14080 pub abbreviated: Option<Box<Expression>>,
14081}
14082
14083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14085#[cfg_attr(feature = "bindings", derive(TS))]
14086pub struct Ntile {
14087 #[serde(default)]
14088 pub this: Option<Box<Expression>>,
14089}
14090
14091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14093#[cfg_attr(feature = "bindings", derive(TS))]
14094pub struct Normalize {
14095 pub this: Box<Expression>,
14096 #[serde(default)]
14097 pub form: Option<Box<Expression>>,
14098 #[serde(default)]
14099 pub is_casefold: Option<Box<Expression>>,
14100}
14101
14102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14104#[cfg_attr(feature = "bindings", derive(TS))]
14105pub struct Normal {
14106 pub this: Box<Expression>,
14107 #[serde(default)]
14108 pub stddev: Option<Box<Expression>>,
14109 #[serde(default)]
14110 pub gen: Option<Box<Expression>>,
14111}
14112
14113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14115#[cfg_attr(feature = "bindings", derive(TS))]
14116pub struct Predict {
14117 pub this: Box<Expression>,
14118 pub expression: Box<Expression>,
14119 #[serde(default)]
14120 pub params_struct: Option<Box<Expression>>,
14121}
14122
14123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14125#[cfg_attr(feature = "bindings", derive(TS))]
14126pub struct MLTranslate {
14127 pub this: Box<Expression>,
14128 pub expression: Box<Expression>,
14129 #[serde(default)]
14130 pub params_struct: Option<Box<Expression>>,
14131}
14132
14133#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14135#[cfg_attr(feature = "bindings", derive(TS))]
14136pub struct FeaturesAtTime {
14137 pub this: Box<Expression>,
14138 #[serde(default)]
14139 pub time: Option<Box<Expression>>,
14140 #[serde(default)]
14141 pub num_rows: Option<Box<Expression>>,
14142 #[serde(default)]
14143 pub ignore_feature_nulls: Option<Box<Expression>>,
14144}
14145
14146#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14148#[cfg_attr(feature = "bindings", derive(TS))]
14149pub struct GenerateEmbedding {
14150 pub this: Box<Expression>,
14151 pub expression: Box<Expression>,
14152 #[serde(default)]
14153 pub params_struct: Option<Box<Expression>>,
14154 #[serde(default)]
14155 pub is_text: Option<Box<Expression>>,
14156}
14157
14158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14160#[cfg_attr(feature = "bindings", derive(TS))]
14161pub struct MLForecast {
14162 pub this: Box<Expression>,
14163 #[serde(default)]
14164 pub expression: Option<Box<Expression>>,
14165 #[serde(default)]
14166 pub params_struct: Option<Box<Expression>>,
14167}
14168
14169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14171#[cfg_attr(feature = "bindings", derive(TS))]
14172pub struct ModelAttribute {
14173 pub this: Box<Expression>,
14174 pub expression: Box<Expression>,
14175}
14176
14177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14179#[cfg_attr(feature = "bindings", derive(TS))]
14180pub struct VectorSearch {
14181 pub this: Box<Expression>,
14182 #[serde(default)]
14183 pub column_to_search: Option<Box<Expression>>,
14184 #[serde(default)]
14185 pub query_table: Option<Box<Expression>>,
14186 #[serde(default)]
14187 pub query_column_to_search: Option<Box<Expression>>,
14188 #[serde(default)]
14189 pub top_k: Option<Box<Expression>>,
14190 #[serde(default)]
14191 pub distance_type: Option<Box<Expression>>,
14192 #[serde(default)]
14193 pub options: Vec<Expression>,
14194}
14195
14196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14198#[cfg_attr(feature = "bindings", derive(TS))]
14199pub struct Quantile {
14200 pub this: Box<Expression>,
14201 #[serde(default)]
14202 pub quantile: Option<Box<Expression>>,
14203}
14204
14205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14207#[cfg_attr(feature = "bindings", derive(TS))]
14208pub struct ApproxQuantile {
14209 pub this: Box<Expression>,
14210 #[serde(default)]
14211 pub quantile: Option<Box<Expression>>,
14212 #[serde(default)]
14213 pub accuracy: Option<Box<Expression>>,
14214 #[serde(default)]
14215 pub weight: Option<Box<Expression>>,
14216 #[serde(default)]
14217 pub error_tolerance: Option<Box<Expression>>,
14218}
14219
14220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14222#[cfg_attr(feature = "bindings", derive(TS))]
14223pub struct ApproxPercentileEstimate {
14224 pub this: Box<Expression>,
14225 #[serde(default)]
14226 pub percentile: Option<Box<Expression>>,
14227}
14228
14229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14231#[cfg_attr(feature = "bindings", derive(TS))]
14232pub struct Randn {
14233 #[serde(default)]
14234 pub this: Option<Box<Expression>>,
14235}
14236
14237#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14239#[cfg_attr(feature = "bindings", derive(TS))]
14240pub struct Randstr {
14241 pub this: Box<Expression>,
14242 #[serde(default)]
14243 pub generator: Option<Box<Expression>>,
14244}
14245
14246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14248#[cfg_attr(feature = "bindings", derive(TS))]
14249pub struct RangeN {
14250 pub this: Box<Expression>,
14251 #[serde(default)]
14252 pub expressions: Vec<Expression>,
14253 #[serde(default)]
14254 pub each: Option<Box<Expression>>,
14255}
14256
14257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14259#[cfg_attr(feature = "bindings", derive(TS))]
14260pub struct RangeBucket {
14261 pub this: Box<Expression>,
14262 pub expression: Box<Expression>,
14263}
14264
14265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14267#[cfg_attr(feature = "bindings", derive(TS))]
14268pub struct ReadCSV {
14269 pub this: Box<Expression>,
14270 #[serde(default)]
14271 pub expressions: Vec<Expression>,
14272}
14273
14274#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14276#[cfg_attr(feature = "bindings", derive(TS))]
14277pub struct ReadParquet {
14278 #[serde(default)]
14279 pub expressions: Vec<Expression>,
14280}
14281
14282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14284#[cfg_attr(feature = "bindings", derive(TS))]
14285pub struct Reduce {
14286 pub this: Box<Expression>,
14287 #[serde(default)]
14288 pub initial: Option<Box<Expression>>,
14289 #[serde(default)]
14290 pub merge: Option<Box<Expression>>,
14291 #[serde(default)]
14292 pub finish: Option<Box<Expression>>,
14293}
14294
14295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14297#[cfg_attr(feature = "bindings", derive(TS))]
14298pub struct RegexpExtractAll {
14299 pub this: Box<Expression>,
14300 pub expression: Box<Expression>,
14301 #[serde(default)]
14302 pub group: Option<Box<Expression>>,
14303 #[serde(default)]
14304 pub parameters: Option<Box<Expression>>,
14305 #[serde(default)]
14306 pub position: Option<Box<Expression>>,
14307 #[serde(default)]
14308 pub occurrence: Option<Box<Expression>>,
14309}
14310
14311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14313#[cfg_attr(feature = "bindings", derive(TS))]
14314pub struct RegexpILike {
14315 pub this: Box<Expression>,
14316 pub expression: Box<Expression>,
14317 #[serde(default)]
14318 pub flag: Option<Box<Expression>>,
14319}
14320
14321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14323#[cfg_attr(feature = "bindings", derive(TS))]
14324pub struct RegexpFullMatch {
14325 pub this: Box<Expression>,
14326 pub expression: Box<Expression>,
14327 #[serde(default)]
14328 pub options: Vec<Expression>,
14329}
14330
14331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14333#[cfg_attr(feature = "bindings", derive(TS))]
14334pub struct RegexpInstr {
14335 pub this: Box<Expression>,
14336 pub expression: Box<Expression>,
14337 #[serde(default)]
14338 pub position: Option<Box<Expression>>,
14339 #[serde(default)]
14340 pub occurrence: Option<Box<Expression>>,
14341 #[serde(default)]
14342 pub option: Option<Box<Expression>>,
14343 #[serde(default)]
14344 pub parameters: Option<Box<Expression>>,
14345 #[serde(default)]
14346 pub group: Option<Box<Expression>>,
14347}
14348
14349#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14351#[cfg_attr(feature = "bindings", derive(TS))]
14352pub struct RegexpSplit {
14353 pub this: Box<Expression>,
14354 pub expression: Box<Expression>,
14355 #[serde(default)]
14356 pub limit: Option<Box<Expression>>,
14357}
14358
14359#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14361#[cfg_attr(feature = "bindings", derive(TS))]
14362pub struct RegexpCount {
14363 pub this: Box<Expression>,
14364 pub expression: Box<Expression>,
14365 #[serde(default)]
14366 pub position: Option<Box<Expression>>,
14367 #[serde(default)]
14368 pub parameters: Option<Box<Expression>>,
14369}
14370
14371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14373#[cfg_attr(feature = "bindings", derive(TS))]
14374pub struct RegrValx {
14375 pub this: Box<Expression>,
14376 pub expression: Box<Expression>,
14377}
14378
14379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14381#[cfg_attr(feature = "bindings", derive(TS))]
14382pub struct RegrValy {
14383 pub this: Box<Expression>,
14384 pub expression: Box<Expression>,
14385}
14386
14387#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14389#[cfg_attr(feature = "bindings", derive(TS))]
14390pub struct RegrAvgy {
14391 pub this: Box<Expression>,
14392 pub expression: Box<Expression>,
14393}
14394
14395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14397#[cfg_attr(feature = "bindings", derive(TS))]
14398pub struct RegrAvgx {
14399 pub this: Box<Expression>,
14400 pub expression: Box<Expression>,
14401}
14402
14403#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14405#[cfg_attr(feature = "bindings", derive(TS))]
14406pub struct RegrCount {
14407 pub this: Box<Expression>,
14408 pub expression: Box<Expression>,
14409}
14410
14411#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14413#[cfg_attr(feature = "bindings", derive(TS))]
14414pub struct RegrIntercept {
14415 pub this: Box<Expression>,
14416 pub expression: Box<Expression>,
14417}
14418
14419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14421#[cfg_attr(feature = "bindings", derive(TS))]
14422pub struct RegrR2 {
14423 pub this: Box<Expression>,
14424 pub expression: Box<Expression>,
14425}
14426
14427#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14429#[cfg_attr(feature = "bindings", derive(TS))]
14430pub struct RegrSxx {
14431 pub this: Box<Expression>,
14432 pub expression: Box<Expression>,
14433}
14434
14435#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14437#[cfg_attr(feature = "bindings", derive(TS))]
14438pub struct RegrSxy {
14439 pub this: Box<Expression>,
14440 pub expression: Box<Expression>,
14441}
14442
14443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14445#[cfg_attr(feature = "bindings", derive(TS))]
14446pub struct RegrSyy {
14447 pub this: Box<Expression>,
14448 pub expression: Box<Expression>,
14449}
14450
14451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14453#[cfg_attr(feature = "bindings", derive(TS))]
14454pub struct RegrSlope {
14455 pub this: Box<Expression>,
14456 pub expression: Box<Expression>,
14457}
14458
14459#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14461#[cfg_attr(feature = "bindings", derive(TS))]
14462pub struct SafeAdd {
14463 pub this: Box<Expression>,
14464 pub expression: Box<Expression>,
14465}
14466
14467#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14469#[cfg_attr(feature = "bindings", derive(TS))]
14470pub struct SafeDivide {
14471 pub this: Box<Expression>,
14472 pub expression: Box<Expression>,
14473}
14474
14475#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14477#[cfg_attr(feature = "bindings", derive(TS))]
14478pub struct SafeMultiply {
14479 pub this: Box<Expression>,
14480 pub expression: Box<Expression>,
14481}
14482
14483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14485#[cfg_attr(feature = "bindings", derive(TS))]
14486pub struct SafeSubtract {
14487 pub this: Box<Expression>,
14488 pub expression: Box<Expression>,
14489}
14490
14491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14493#[cfg_attr(feature = "bindings", derive(TS))]
14494pub struct SHA2 {
14495 pub this: Box<Expression>,
14496 #[serde(default)]
14497 pub length: Option<i64>,
14498}
14499
14500#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14502#[cfg_attr(feature = "bindings", derive(TS))]
14503pub struct SHA2Digest {
14504 pub this: Box<Expression>,
14505 #[serde(default)]
14506 pub length: Option<i64>,
14507}
14508
14509#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14511#[cfg_attr(feature = "bindings", derive(TS))]
14512pub struct SortArray {
14513 pub this: Box<Expression>,
14514 #[serde(default)]
14515 pub asc: Option<Box<Expression>>,
14516 #[serde(default)]
14517 pub nulls_first: Option<Box<Expression>>,
14518}
14519
14520#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14522#[cfg_attr(feature = "bindings", derive(TS))]
14523pub struct SplitPart {
14524 pub this: Box<Expression>,
14525 #[serde(default)]
14526 pub delimiter: Option<Box<Expression>>,
14527 #[serde(default)]
14528 pub part_index: Option<Box<Expression>>,
14529}
14530
14531#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14533#[cfg_attr(feature = "bindings", derive(TS))]
14534pub struct SubstringIndex {
14535 pub this: Box<Expression>,
14536 #[serde(default)]
14537 pub delimiter: Option<Box<Expression>>,
14538 #[serde(default)]
14539 pub count: Option<Box<Expression>>,
14540}
14541
14542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14544#[cfg_attr(feature = "bindings", derive(TS))]
14545pub struct StandardHash {
14546 pub this: Box<Expression>,
14547 #[serde(default)]
14548 pub expression: Option<Box<Expression>>,
14549}
14550
14551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14553#[cfg_attr(feature = "bindings", derive(TS))]
14554pub struct StrPosition {
14555 pub this: Box<Expression>,
14556 #[serde(default)]
14557 pub substr: Option<Box<Expression>>,
14558 #[serde(default)]
14559 pub position: Option<Box<Expression>>,
14560 #[serde(default)]
14561 pub occurrence: Option<Box<Expression>>,
14562}
14563
14564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14566#[cfg_attr(feature = "bindings", derive(TS))]
14567pub struct Search {
14568 pub this: Box<Expression>,
14569 pub expression: Box<Expression>,
14570 #[serde(default)]
14571 pub json_scope: Option<Box<Expression>>,
14572 #[serde(default)]
14573 pub analyzer: Option<Box<Expression>>,
14574 #[serde(default)]
14575 pub analyzer_options: Option<Box<Expression>>,
14576 #[serde(default)]
14577 pub search_mode: Option<Box<Expression>>,
14578}
14579
14580#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14582#[cfg_attr(feature = "bindings", derive(TS))]
14583pub struct SearchIp {
14584 pub this: Box<Expression>,
14585 pub expression: Box<Expression>,
14586}
14587
14588#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14590#[cfg_attr(feature = "bindings", derive(TS))]
14591pub struct StrToDate {
14592 pub this: Box<Expression>,
14593 #[serde(default)]
14594 pub format: Option<String>,
14595 #[serde(default)]
14596 pub safe: Option<Box<Expression>>,
14597}
14598
14599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14601#[cfg_attr(feature = "bindings", derive(TS))]
14602pub struct StrToTime {
14603 pub this: Box<Expression>,
14604 pub format: String,
14605 #[serde(default)]
14606 pub zone: Option<Box<Expression>>,
14607 #[serde(default)]
14608 pub safe: Option<Box<Expression>>,
14609 #[serde(default)]
14610 pub target_type: Option<Box<Expression>>,
14611}
14612
14613#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14615#[cfg_attr(feature = "bindings", derive(TS))]
14616pub struct StrToUnix {
14617 #[serde(default)]
14618 pub this: Option<Box<Expression>>,
14619 #[serde(default)]
14620 pub format: Option<String>,
14621}
14622
14623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14625#[cfg_attr(feature = "bindings", derive(TS))]
14626pub struct StrToMap {
14627 pub this: Box<Expression>,
14628 #[serde(default)]
14629 pub pair_delim: Option<Box<Expression>>,
14630 #[serde(default)]
14631 pub key_value_delim: Option<Box<Expression>>,
14632 #[serde(default)]
14633 pub duplicate_resolution_callback: Option<Box<Expression>>,
14634}
14635
14636#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14638#[cfg_attr(feature = "bindings", derive(TS))]
14639pub struct NumberToStr {
14640 pub this: Box<Expression>,
14641 pub format: String,
14642 #[serde(default)]
14643 pub culture: Option<Box<Expression>>,
14644}
14645
14646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14648#[cfg_attr(feature = "bindings", derive(TS))]
14649pub struct FromBase {
14650 pub this: Box<Expression>,
14651 pub expression: Box<Expression>,
14652}
14653
14654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14656#[cfg_attr(feature = "bindings", derive(TS))]
14657pub struct Stuff {
14658 pub this: Box<Expression>,
14659 #[serde(default)]
14660 pub start: Option<Box<Expression>>,
14661 #[serde(default)]
14662 pub length: Option<i64>,
14663 pub expression: Box<Expression>,
14664}
14665
14666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14668#[cfg_attr(feature = "bindings", derive(TS))]
14669pub struct TimeToStr {
14670 pub this: Box<Expression>,
14671 pub format: String,
14672 #[serde(default)]
14673 pub culture: Option<Box<Expression>>,
14674 #[serde(default)]
14675 pub zone: Option<Box<Expression>>,
14676}
14677
14678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14680#[cfg_attr(feature = "bindings", derive(TS))]
14681pub struct TimeStrToTime {
14682 pub this: Box<Expression>,
14683 #[serde(default)]
14684 pub zone: Option<Box<Expression>>,
14685}
14686
14687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14689#[cfg_attr(feature = "bindings", derive(TS))]
14690pub struct TsOrDsAdd {
14691 pub this: Box<Expression>,
14692 pub expression: Box<Expression>,
14693 #[serde(default)]
14694 pub unit: Option<String>,
14695 #[serde(default)]
14696 pub return_type: Option<Box<Expression>>,
14697}
14698
14699#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14701#[cfg_attr(feature = "bindings", derive(TS))]
14702pub struct TsOrDsDiff {
14703 pub this: Box<Expression>,
14704 pub expression: Box<Expression>,
14705 #[serde(default)]
14706 pub unit: Option<String>,
14707}
14708
14709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14711#[cfg_attr(feature = "bindings", derive(TS))]
14712pub struct TsOrDsToDate {
14713 pub this: Box<Expression>,
14714 #[serde(default)]
14715 pub format: Option<String>,
14716 #[serde(default)]
14717 pub safe: Option<Box<Expression>>,
14718}
14719
14720#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14722#[cfg_attr(feature = "bindings", derive(TS))]
14723pub struct TsOrDsToTime {
14724 pub this: Box<Expression>,
14725 #[serde(default)]
14726 pub format: Option<String>,
14727 #[serde(default)]
14728 pub safe: Option<Box<Expression>>,
14729}
14730
14731#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14733#[cfg_attr(feature = "bindings", derive(TS))]
14734pub struct Unhex {
14735 pub this: Box<Expression>,
14736 #[serde(default)]
14737 pub expression: Option<Box<Expression>>,
14738}
14739
14740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14742#[cfg_attr(feature = "bindings", derive(TS))]
14743pub struct Uniform {
14744 pub this: Box<Expression>,
14745 pub expression: Box<Expression>,
14746 #[serde(default)]
14747 pub gen: Option<Box<Expression>>,
14748 #[serde(default)]
14749 pub seed: Option<Box<Expression>>,
14750}
14751
14752#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14754#[cfg_attr(feature = "bindings", derive(TS))]
14755pub struct UnixToStr {
14756 pub this: Box<Expression>,
14757 #[serde(default)]
14758 pub format: Option<String>,
14759}
14760
14761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14763#[cfg_attr(feature = "bindings", derive(TS))]
14764pub struct UnixToTime {
14765 pub this: Box<Expression>,
14766 #[serde(default)]
14767 pub scale: Option<i64>,
14768 #[serde(default)]
14769 pub zone: Option<Box<Expression>>,
14770 #[serde(default)]
14771 pub hours: Option<Box<Expression>>,
14772 #[serde(default)]
14773 pub minutes: Option<Box<Expression>>,
14774 #[serde(default)]
14775 pub format: Option<String>,
14776 #[serde(default)]
14777 pub target_type: Option<Box<Expression>>,
14778}
14779
14780#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14782#[cfg_attr(feature = "bindings", derive(TS))]
14783pub struct Uuid {
14784 #[serde(default)]
14785 pub this: Option<Box<Expression>>,
14786 #[serde(default)]
14787 pub name: Option<String>,
14788 #[serde(default)]
14789 pub is_string: Option<Box<Expression>>,
14790}
14791
14792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14794#[cfg_attr(feature = "bindings", derive(TS))]
14795pub struct TimestampFromParts {
14796 #[serde(default)]
14797 pub zone: Option<Box<Expression>>,
14798 #[serde(default)]
14799 pub milli: Option<Box<Expression>>,
14800 #[serde(default)]
14801 pub this: Option<Box<Expression>>,
14802 #[serde(default)]
14803 pub expression: Option<Box<Expression>>,
14804}
14805
14806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14808#[cfg_attr(feature = "bindings", derive(TS))]
14809pub struct TimestampTzFromParts {
14810 #[serde(default)]
14811 pub zone: Option<Box<Expression>>,
14812}
14813
14814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14816#[cfg_attr(feature = "bindings", derive(TS))]
14817pub struct Corr {
14818 pub this: Box<Expression>,
14819 pub expression: Box<Expression>,
14820 #[serde(default)]
14821 pub null_on_zero_variance: Option<Box<Expression>>,
14822}
14823
14824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14826#[cfg_attr(feature = "bindings", derive(TS))]
14827pub struct WidthBucket {
14828 pub this: Box<Expression>,
14829 #[serde(default)]
14830 pub min_value: Option<Box<Expression>>,
14831 #[serde(default)]
14832 pub max_value: Option<Box<Expression>>,
14833 #[serde(default)]
14834 pub num_buckets: Option<Box<Expression>>,
14835 #[serde(default)]
14836 pub threshold: Option<Box<Expression>>,
14837}
14838
14839#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14841#[cfg_attr(feature = "bindings", derive(TS))]
14842pub struct CovarSamp {
14843 pub this: Box<Expression>,
14844 pub expression: Box<Expression>,
14845}
14846
14847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14849#[cfg_attr(feature = "bindings", derive(TS))]
14850pub struct CovarPop {
14851 pub this: Box<Expression>,
14852 pub expression: Box<Expression>,
14853}
14854
14855#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14857#[cfg_attr(feature = "bindings", derive(TS))]
14858pub struct Week {
14859 pub this: Box<Expression>,
14860 #[serde(default)]
14861 pub mode: Option<Box<Expression>>,
14862}
14863
14864#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14866#[cfg_attr(feature = "bindings", derive(TS))]
14867pub struct XMLElement {
14868 pub this: Box<Expression>,
14869 #[serde(default)]
14870 pub expressions: Vec<Expression>,
14871 #[serde(default)]
14872 pub evalname: Option<Box<Expression>>,
14873}
14874
14875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14877#[cfg_attr(feature = "bindings", derive(TS))]
14878pub struct XMLGet {
14879 pub this: Box<Expression>,
14880 pub expression: Box<Expression>,
14881 #[serde(default)]
14882 pub instance: Option<Box<Expression>>,
14883}
14884
14885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14887#[cfg_attr(feature = "bindings", derive(TS))]
14888pub struct XMLTable {
14889 pub this: Box<Expression>,
14890 #[serde(default)]
14891 pub namespaces: Option<Box<Expression>>,
14892 #[serde(default)]
14893 pub passing: Option<Box<Expression>>,
14894 #[serde(default)]
14895 pub columns: Vec<Expression>,
14896 #[serde(default)]
14897 pub by_ref: Option<Box<Expression>>,
14898}
14899
14900#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14902#[cfg_attr(feature = "bindings", derive(TS))]
14903pub struct XMLKeyValueOption {
14904 pub this: Box<Expression>,
14905 #[serde(default)]
14906 pub expression: Option<Box<Expression>>,
14907}
14908
14909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14911#[cfg_attr(feature = "bindings", derive(TS))]
14912pub struct Zipf {
14913 pub this: Box<Expression>,
14914 #[serde(default)]
14915 pub elementcount: Option<Box<Expression>>,
14916 #[serde(default)]
14917 pub gen: Option<Box<Expression>>,
14918}
14919
14920#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14922#[cfg_attr(feature = "bindings", derive(TS))]
14923pub struct Merge {
14924 pub this: Box<Expression>,
14925 pub using: Box<Expression>,
14926 #[serde(default)]
14927 pub on: Option<Box<Expression>>,
14928 #[serde(default)]
14929 pub using_cond: Option<Box<Expression>>,
14930 #[serde(default)]
14931 pub whens: Option<Box<Expression>>,
14932 #[serde(default)]
14933 pub with_: Option<Box<Expression>>,
14934 #[serde(default)]
14935 pub returning: Option<Box<Expression>>,
14936}
14937
14938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14940#[cfg_attr(feature = "bindings", derive(TS))]
14941pub struct When {
14942 #[serde(default)]
14943 pub matched: Option<Box<Expression>>,
14944 #[serde(default)]
14945 pub source: Option<Box<Expression>>,
14946 #[serde(default)]
14947 pub condition: Option<Box<Expression>>,
14948 pub then: Box<Expression>,
14949}
14950
14951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14953#[cfg_attr(feature = "bindings", derive(TS))]
14954pub struct Whens {
14955 #[serde(default)]
14956 pub expressions: Vec<Expression>,
14957}
14958
14959#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14961#[cfg_attr(feature = "bindings", derive(TS))]
14962pub struct NextValueFor {
14963 pub this: Box<Expression>,
14964 #[serde(default)]
14965 pub order: Option<Box<Expression>>,
14966}
14967
14968#[cfg(test)]
14969mod tests {
14970 use super::*;
14971
14972 #[test]
14973 #[cfg(feature = "bindings")]
14974 fn export_typescript_types() {
14975 Expression::export_all(&ts_rs::Config::default())
14978 .expect("Failed to export Expression types");
14979 }
14980
14981 #[test]
14982 fn test_simple_select_builder() {
14983 let select = Select::new()
14984 .column(Expression::star())
14985 .from(Expression::Table(Box::new(TableRef::new("users"))));
14986
14987 assert_eq!(select.expressions.len(), 1);
14988 assert!(select.from.is_some());
14989 }
14990
14991 #[test]
14992 fn test_expression_alias() {
14993 let expr = Expression::column("id").alias("user_id");
14994
14995 match expr {
14996 Expression::Alias(a) => {
14997 assert_eq!(a.alias.name, "user_id");
14998 }
14999 _ => panic!("Expected Alias"),
15000 }
15001 }
15002
15003 #[test]
15004 fn test_literal_creation() {
15005 let num = Expression::number(42);
15006 let str = Expression::string("hello");
15007
15008 match num {
15009 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
15010 let Literal::Number(n) = lit.as_ref() else {
15011 unreachable!()
15012 };
15013 assert_eq!(n, "42")
15014 }
15015 _ => panic!("Expected Number"),
15016 }
15017
15018 match str {
15019 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15020 let Literal::String(s) = lit.as_ref() else {
15021 unreachable!()
15022 };
15023 assert_eq!(s, "hello")
15024 }
15025 _ => panic!("Expected String"),
15026 }
15027 }
15028
15029 #[test]
15030 fn test_expression_sql() {
15031 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15032 assert_eq!(expr.sql(), "SELECT 1 + 2");
15033 }
15034
15035 #[test]
15036 fn test_expression_sql_for() {
15037 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15038 let sql = expr.sql_for(crate::DialectType::Generic);
15039 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15041 }
15042}