1use crate::tokens::Span;
34use serde::{Deserialize, Serialize};
35use std::fmt;
36#[cfg(feature = "bindings")]
37use ts_rs::TS;
38
39fn default_true() -> bool {
41 true
42}
43
44fn is_true(v: &bool) -> bool {
45 *v
46}
47
48#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Box<Literal>),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Box<Column>),
89 Table(Box<TableRef>),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117
118 Alias(Box<Alias>),
120 Cast(Box<Cast>),
121 Collation(Box<CollationExpr>),
122 Case(Box<Case>),
123
124 And(Box<BinaryOp>),
126 Or(Box<BinaryOp>),
127 Add(Box<BinaryOp>),
128 Sub(Box<BinaryOp>),
129 Mul(Box<BinaryOp>),
130 Div(Box<BinaryOp>),
131 Mod(Box<BinaryOp>),
132 Eq(Box<BinaryOp>),
133 Neq(Box<BinaryOp>),
134 Lt(Box<BinaryOp>),
135 Lte(Box<BinaryOp>),
136 Gt(Box<BinaryOp>),
137 Gte(Box<BinaryOp>),
138 Like(Box<LikeOp>),
139 ILike(Box<LikeOp>),
140 Match(Box<BinaryOp>),
142 BitwiseAnd(Box<BinaryOp>),
143 BitwiseOr(Box<BinaryOp>),
144 BitwiseXor(Box<BinaryOp>),
145 Concat(Box<BinaryOp>),
146 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
162 Neg(Box<UnaryOp>),
163 BitwiseNot(Box<UnaryOp>),
164
165 In(Box<In>),
167 Between(Box<Between>),
168 IsNull(Box<IsNull>),
169 IsTrue(Box<IsTrueFalse>),
170 IsFalse(Box<IsTrueFalse>),
171 IsJson(Box<IsJson>),
172 Is(Box<BinaryOp>), Exists(Box<Exists>),
174 MemberOf(Box<BinaryOp>),
176
177 Function(Box<Function>),
179 AggregateFunction(Box<AggregateFunction>),
180 WindowFunction(Box<WindowFunction>),
181
182 From(Box<From>),
184 Join(Box<Join>),
185 JoinedTable(Box<JoinedTable>),
186 Where(Box<Where>),
187 GroupBy(Box<GroupBy>),
188 Having(Box<Having>),
189 OrderBy(Box<OrderBy>),
190 Limit(Box<Limit>),
191 Offset(Box<Offset>),
192 Qualify(Box<Qualify>),
193 With(Box<With>),
194 Cte(Box<Cte>),
195 DistributeBy(Box<DistributeBy>),
196 ClusterBy(Box<ClusterBy>),
197 SortBy(Box<SortBy>),
198 LateralView(Box<LateralView>),
199 Hint(Box<Hint>),
200 Pseudocolumn(Pseudocolumn),
201
202 Connect(Box<Connect>),
204 Prior(Box<Prior>),
205 ConnectByRoot(Box<ConnectByRoot>),
206
207 MatchRecognize(Box<MatchRecognize>),
209
210 Ordered(Box<Ordered>),
212
213 Window(Box<WindowSpec>),
215 Over(Box<Over>),
216 WithinGroup(Box<WithinGroup>),
217
218 DataType(DataType),
220
221 Array(Box<Array>),
223 Struct(Box<Struct>),
224 Tuple(Box<Tuple>),
225
226 Interval(Box<Interval>),
228
229 ConcatWs(Box<ConcatWs>),
231 Substring(Box<SubstringFunc>),
232 Upper(Box<UnaryFunc>),
233 Lower(Box<UnaryFunc>),
234 Length(Box<UnaryFunc>),
235 Trim(Box<TrimFunc>),
236 LTrim(Box<UnaryFunc>),
237 RTrim(Box<UnaryFunc>),
238 Replace(Box<ReplaceFunc>),
239 Reverse(Box<UnaryFunc>),
240 Left(Box<LeftRightFunc>),
241 Right(Box<LeftRightFunc>),
242 Repeat(Box<RepeatFunc>),
243 Lpad(Box<PadFunc>),
244 Rpad(Box<PadFunc>),
245 Split(Box<SplitFunc>),
246 RegexpLike(Box<RegexpFunc>),
247 RegexpReplace(Box<RegexpReplaceFunc>),
248 RegexpExtract(Box<RegexpExtractFunc>),
249 Overlay(Box<OverlayFunc>),
250
251 Abs(Box<UnaryFunc>),
253 Round(Box<RoundFunc>),
254 Floor(Box<FloorFunc>),
255 Ceil(Box<CeilFunc>),
256 Power(Box<BinaryFunc>),
257 Sqrt(Box<UnaryFunc>),
258 Cbrt(Box<UnaryFunc>),
259 Ln(Box<UnaryFunc>),
260 Log(Box<LogFunc>),
261 Exp(Box<UnaryFunc>),
262 Sign(Box<UnaryFunc>),
263 Greatest(Box<VarArgFunc>),
264 Least(Box<VarArgFunc>),
265
266 CurrentDate(CurrentDate),
268 CurrentTime(CurrentTime),
269 CurrentTimestamp(CurrentTimestamp),
270 CurrentTimestampLTZ(CurrentTimestampLTZ),
271 AtTimeZone(Box<AtTimeZone>),
272 DateAdd(Box<DateAddFunc>),
273 DateSub(Box<DateAddFunc>),
274 DateDiff(Box<DateDiffFunc>),
275 DateTrunc(Box<DateTruncFunc>),
276 Extract(Box<ExtractFunc>),
277 ToDate(Box<ToDateFunc>),
278 ToTimestamp(Box<ToTimestampFunc>),
279 Date(Box<UnaryFunc>),
280 Time(Box<UnaryFunc>),
281 DateFromUnixDate(Box<UnaryFunc>),
282 UnixDate(Box<UnaryFunc>),
283 UnixSeconds(Box<UnaryFunc>),
284 UnixMillis(Box<UnaryFunc>),
285 UnixMicros(Box<UnaryFunc>),
286 UnixToTimeStr(Box<BinaryFunc>),
287 TimeStrToDate(Box<UnaryFunc>),
288 DateToDi(Box<UnaryFunc>),
289 DiToDate(Box<UnaryFunc>),
290 TsOrDiToDi(Box<UnaryFunc>),
291 TsOrDsToDatetime(Box<UnaryFunc>),
292 TsOrDsToTimestamp(Box<UnaryFunc>),
293 YearOfWeek(Box<UnaryFunc>),
294 YearOfWeekIso(Box<UnaryFunc>),
295
296 Coalesce(Box<VarArgFunc>),
298 NullIf(Box<BinaryFunc>),
299 IfFunc(Box<IfFunc>),
300 IfNull(Box<BinaryFunc>),
301 Nvl(Box<BinaryFunc>),
302 Nvl2(Box<Nvl2Func>),
303
304 TryCast(Box<Cast>),
306 SafeCast(Box<Cast>),
307
308 Count(Box<CountFunc>),
310 Sum(Box<AggFunc>),
311 Avg(Box<AggFunc>),
312 Min(Box<AggFunc>),
313 Max(Box<AggFunc>),
314 GroupConcat(Box<GroupConcatFunc>),
315 StringAgg(Box<StringAggFunc>),
316 ListAgg(Box<ListAggFunc>),
317 ArrayAgg(Box<AggFunc>),
318 CountIf(Box<AggFunc>),
319 SumIf(Box<SumIfFunc>),
320 Stddev(Box<AggFunc>),
321 StddevPop(Box<AggFunc>),
322 StddevSamp(Box<AggFunc>),
323 Variance(Box<AggFunc>),
324 VarPop(Box<AggFunc>),
325 VarSamp(Box<AggFunc>),
326 Median(Box<AggFunc>),
327 Mode(Box<AggFunc>),
328 First(Box<AggFunc>),
329 Last(Box<AggFunc>),
330 AnyValue(Box<AggFunc>),
331 ApproxDistinct(Box<AggFunc>),
332 ApproxCountDistinct(Box<AggFunc>),
333 ApproxPercentile(Box<ApproxPercentileFunc>),
334 Percentile(Box<PercentileFunc>),
335 LogicalAnd(Box<AggFunc>),
336 LogicalOr(Box<AggFunc>),
337 Skewness(Box<AggFunc>),
338 BitwiseCount(Box<UnaryFunc>),
339 ArrayConcatAgg(Box<AggFunc>),
340 ArrayUniqueAgg(Box<AggFunc>),
341 BoolXorAgg(Box<AggFunc>),
342
343 RowNumber(RowNumber),
345 Rank(Rank),
346 DenseRank(DenseRank),
347 NTile(Box<NTileFunc>),
348 Lead(Box<LeadLagFunc>),
349 Lag(Box<LeadLagFunc>),
350 FirstValue(Box<ValueFunc>),
351 LastValue(Box<ValueFunc>),
352 NthValue(Box<NthValueFunc>),
353 PercentRank(PercentRank),
354 CumeDist(CumeDist),
355 PercentileCont(Box<PercentileFunc>),
356 PercentileDisc(Box<PercentileFunc>),
357
358 Contains(Box<BinaryFunc>),
360 StartsWith(Box<BinaryFunc>),
361 EndsWith(Box<BinaryFunc>),
362 Position(Box<PositionFunc>),
363 Initcap(Box<UnaryFunc>),
364 Ascii(Box<UnaryFunc>),
365 Chr(Box<UnaryFunc>),
366 CharFunc(Box<CharFunc>),
368 Soundex(Box<UnaryFunc>),
369 Levenshtein(Box<BinaryFunc>),
370 ByteLength(Box<UnaryFunc>),
371 Hex(Box<UnaryFunc>),
372 LowerHex(Box<UnaryFunc>),
373 Unicode(Box<UnaryFunc>),
374
375 ModFunc(Box<BinaryFunc>),
377 Random(Random),
378 Rand(Box<Rand>),
379 TruncFunc(Box<TruncateFunc>),
380 Pi(Pi),
381 Radians(Box<UnaryFunc>),
382 Degrees(Box<UnaryFunc>),
383 Sin(Box<UnaryFunc>),
384 Cos(Box<UnaryFunc>),
385 Tan(Box<UnaryFunc>),
386 Asin(Box<UnaryFunc>),
387 Acos(Box<UnaryFunc>),
388 Atan(Box<UnaryFunc>),
389 Atan2(Box<BinaryFunc>),
390 IsNan(Box<UnaryFunc>),
391 IsInf(Box<UnaryFunc>),
392 IntDiv(Box<BinaryFunc>),
393
394 Decode(Box<DecodeFunc>),
396
397 DateFormat(Box<DateFormatFunc>),
399 FormatDate(Box<DateFormatFunc>),
400 Year(Box<UnaryFunc>),
401 Month(Box<UnaryFunc>),
402 Day(Box<UnaryFunc>),
403 Hour(Box<UnaryFunc>),
404 Minute(Box<UnaryFunc>),
405 Second(Box<UnaryFunc>),
406 DayOfWeek(Box<UnaryFunc>),
407 DayOfWeekIso(Box<UnaryFunc>),
408 DayOfMonth(Box<UnaryFunc>),
409 DayOfYear(Box<UnaryFunc>),
410 WeekOfYear(Box<UnaryFunc>),
411 Quarter(Box<UnaryFunc>),
412 AddMonths(Box<BinaryFunc>),
413 MonthsBetween(Box<BinaryFunc>),
414 LastDay(Box<LastDayFunc>),
415 NextDay(Box<BinaryFunc>),
416 Epoch(Box<UnaryFunc>),
417 EpochMs(Box<UnaryFunc>),
418 FromUnixtime(Box<FromUnixtimeFunc>),
419 UnixTimestamp(Box<UnixTimestampFunc>),
420 MakeDate(Box<MakeDateFunc>),
421 MakeTimestamp(Box<MakeTimestampFunc>),
422 TimestampTrunc(Box<DateTruncFunc>),
423 TimeStrToUnix(Box<UnaryFunc>),
424
425 SessionUser(SessionUser),
427
428 SHA(Box<UnaryFunc>),
430 SHA1Digest(Box<UnaryFunc>),
431
432 TimeToUnix(Box<UnaryFunc>),
434
435 ArrayFunc(Box<ArrayConstructor>),
437 ArrayLength(Box<UnaryFunc>),
438 ArraySize(Box<UnaryFunc>),
439 Cardinality(Box<UnaryFunc>),
440 ArrayContains(Box<BinaryFunc>),
441 ArrayPosition(Box<BinaryFunc>),
442 ArrayAppend(Box<BinaryFunc>),
443 ArrayPrepend(Box<BinaryFunc>),
444 ArrayConcat(Box<VarArgFunc>),
445 ArraySort(Box<ArraySortFunc>),
446 ArrayReverse(Box<UnaryFunc>),
447 ArrayDistinct(Box<UnaryFunc>),
448 ArrayJoin(Box<ArrayJoinFunc>),
449 ArrayToString(Box<ArrayJoinFunc>),
450 Unnest(Box<UnnestFunc>),
451 Explode(Box<UnaryFunc>),
452 ExplodeOuter(Box<UnaryFunc>),
453 ArrayFilter(Box<ArrayFilterFunc>),
454 ArrayTransform(Box<ArrayTransformFunc>),
455 ArrayFlatten(Box<UnaryFunc>),
456 ArrayCompact(Box<UnaryFunc>),
457 ArrayIntersect(Box<VarArgFunc>),
458 ArrayUnion(Box<BinaryFunc>),
459 ArrayExcept(Box<BinaryFunc>),
460 ArrayRemove(Box<BinaryFunc>),
461 ArrayZip(Box<VarArgFunc>),
462 Sequence(Box<SequenceFunc>),
463 Generate(Box<SequenceFunc>),
464 ExplodingGenerateSeries(Box<SequenceFunc>),
465 ToArray(Box<UnaryFunc>),
466 StarMap(Box<BinaryFunc>),
467
468 StructFunc(Box<StructConstructor>),
470 StructExtract(Box<StructExtractFunc>),
471 NamedStruct(Box<NamedStructFunc>),
472
473 MapFunc(Box<MapConstructor>),
475 MapFromEntries(Box<UnaryFunc>),
476 MapFromArrays(Box<BinaryFunc>),
477 MapKeys(Box<UnaryFunc>),
478 MapValues(Box<UnaryFunc>),
479 MapContainsKey(Box<BinaryFunc>),
480 MapConcat(Box<VarArgFunc>),
481 ElementAt(Box<BinaryFunc>),
482 TransformKeys(Box<TransformFunc>),
483 TransformValues(Box<TransformFunc>),
484
485 FunctionEmits(Box<FunctionEmits>),
487
488 JsonExtract(Box<JsonExtractFunc>),
490 JsonExtractScalar(Box<JsonExtractFunc>),
491 JsonExtractPath(Box<JsonPathFunc>),
492 JsonArray(Box<VarArgFunc>),
493 JsonObject(Box<JsonObjectFunc>),
494 JsonQuery(Box<JsonExtractFunc>),
495 JsonValue(Box<JsonExtractFunc>),
496 JsonArrayLength(Box<UnaryFunc>),
497 JsonKeys(Box<UnaryFunc>),
498 JsonType(Box<UnaryFunc>),
499 ParseJson(Box<UnaryFunc>),
500 ToJson(Box<UnaryFunc>),
501 JsonSet(Box<JsonModifyFunc>),
502 JsonInsert(Box<JsonModifyFunc>),
503 JsonRemove(Box<JsonPathFunc>),
504 JsonMergePatch(Box<BinaryFunc>),
505 JsonArrayAgg(Box<JsonArrayAggFunc>),
506 JsonObjectAgg(Box<JsonObjectAggFunc>),
507
508 Convert(Box<ConvertFunc>),
510 Typeof(Box<UnaryFunc>),
511
512 Lambda(Box<LambdaExpr>),
514 Parameter(Box<Parameter>),
515 Placeholder(Placeholder),
516 NamedArgument(Box<NamedArgument>),
517 TableArgument(Box<TableArgument>),
520 SqlComment(Box<SqlComment>),
521
522 NullSafeEq(Box<BinaryOp>),
524 NullSafeNeq(Box<BinaryOp>),
525 Glob(Box<BinaryOp>),
526 SimilarTo(Box<SimilarToExpr>),
527 Any(Box<QuantifiedExpr>),
528 All(Box<QuantifiedExpr>),
529 Overlaps(Box<OverlapsExpr>),
530
531 BitwiseLeftShift(Box<BinaryOp>),
533 BitwiseRightShift(Box<BinaryOp>),
534 BitwiseAndAgg(Box<AggFunc>),
535 BitwiseOrAgg(Box<AggFunc>),
536 BitwiseXorAgg(Box<AggFunc>),
537
538 Subscript(Box<Subscript>),
540 Dot(Box<DotAccess>),
541 MethodCall(Box<MethodCall>),
542 ArraySlice(Box<ArraySlice>),
543
544 CreateTable(Box<CreateTable>),
546 DropTable(Box<DropTable>),
547 Undrop(Box<Undrop>),
548 AlterTable(Box<AlterTable>),
549 CreateIndex(Box<CreateIndex>),
550 DropIndex(Box<DropIndex>),
551 CreateView(Box<CreateView>),
552 DropView(Box<DropView>),
553 AlterView(Box<AlterView>),
554 AlterIndex(Box<AlterIndex>),
555 Truncate(Box<Truncate>),
556 Use(Box<Use>),
557 Cache(Box<Cache>),
558 Uncache(Box<Uncache>),
559 LoadData(Box<LoadData>),
560 Pragma(Box<Pragma>),
561 Grant(Box<Grant>),
562 Revoke(Box<Revoke>),
563 Comment(Box<Comment>),
564 SetStatement(Box<SetStatement>),
565 CreateSchema(Box<CreateSchema>),
567 DropSchema(Box<DropSchema>),
568 DropNamespace(Box<DropNamespace>),
569 CreateDatabase(Box<CreateDatabase>),
570 DropDatabase(Box<DropDatabase>),
571 CreateFunction(Box<CreateFunction>),
572 DropFunction(Box<DropFunction>),
573 CreateProcedure(Box<CreateProcedure>),
574 DropProcedure(Box<DropProcedure>),
575 CreateSequence(Box<CreateSequence>),
576 CreateSynonym(Box<CreateSynonym>),
577 DropSequence(Box<DropSequence>),
578 AlterSequence(Box<AlterSequence>),
579 CreateTrigger(Box<CreateTrigger>),
580 DropTrigger(Box<DropTrigger>),
581 CreateType(Box<CreateType>),
582 DropType(Box<DropType>),
583 Describe(Box<Describe>),
584 Show(Box<Show>),
585
586 Command(Box<Command>),
588 Kill(Box<Kill>),
589 Execute(Box<ExecuteStatement>),
591
592 CreateTask(Box<CreateTask>),
594
595 Raw(Raw),
597
598 Paren(Box<Paren>),
600
601 Annotated(Box<Annotated>),
603
604 Refresh(Box<Refresh>),
607 LockingStatement(Box<LockingStatement>),
608 SequenceProperties(Box<SequenceProperties>),
609 TruncateTable(Box<TruncateTable>),
610 Clone(Box<Clone>),
611 Attach(Box<Attach>),
612 Detach(Box<Detach>),
613 Install(Box<Install>),
614 Summarize(Box<Summarize>),
615 Declare(Box<Declare>),
616 DeclareItem(Box<DeclareItem>),
617 Set(Box<Set>),
618 Heredoc(Box<Heredoc>),
619 SetItem(Box<SetItem>),
620 QueryBand(Box<QueryBand>),
621 UserDefinedFunction(Box<UserDefinedFunction>),
622 RecursiveWithSearch(Box<RecursiveWithSearch>),
623 ProjectionDef(Box<ProjectionDef>),
624 TableAlias(Box<TableAlias>),
625 ByteString(Box<ByteString>),
626 HexStringExpr(Box<HexStringExpr>),
627 UnicodeString(Box<UnicodeString>),
628 ColumnPosition(Box<ColumnPosition>),
629 ColumnDef(Box<ColumnDef>),
630 AlterColumn(Box<AlterColumn>),
631 AlterSortKey(Box<AlterSortKey>),
632 AlterSet(Box<AlterSet>),
633 RenameColumn(Box<RenameColumn>),
634 Comprehension(Box<Comprehension>),
635 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
636 MergeTreeTTL(Box<MergeTreeTTL>),
637 IndexConstraintOption(Box<IndexConstraintOption>),
638 ColumnConstraint(Box<ColumnConstraint>),
639 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
640 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
641 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
642 CheckColumnConstraint(Box<CheckColumnConstraint>),
643 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
644 CompressColumnConstraint(Box<CompressColumnConstraint>),
645 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
646 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
647 WithOperator(Box<WithOperator>),
648 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
649 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
650 CommentColumnConstraint(CommentColumnConstraint),
651 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
652 IndexColumnConstraint(Box<IndexColumnConstraint>),
653 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
654 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
655 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
656 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
657 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
658 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
659 InOutColumnConstraint(Box<InOutColumnConstraint>),
660 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
661 PathColumnConstraint(Box<PathColumnConstraint>),
662 Constraint(Box<Constraint>),
663 Export(Box<Export>),
664 Filter(Box<Filter>),
665 Changes(Box<Changes>),
666 CopyParameter(Box<CopyParameter>),
667 Credentials(Box<Credentials>),
668 Directory(Box<Directory>),
669 ForeignKey(Box<ForeignKey>),
670 ColumnPrefix(Box<ColumnPrefix>),
671 PrimaryKey(Box<PrimaryKey>),
672 IntoClause(Box<IntoClause>),
673 JoinHint(Box<JoinHint>),
674 Opclass(Box<Opclass>),
675 Index(Box<Index>),
676 IndexParameters(Box<IndexParameters>),
677 ConditionalInsert(Box<ConditionalInsert>),
678 MultitableInserts(Box<MultitableInserts>),
679 OnConflict(Box<OnConflict>),
680 OnCondition(Box<OnCondition>),
681 Returning(Box<Returning>),
682 Introducer(Box<Introducer>),
683 PartitionRange(Box<PartitionRange>),
684 Fetch(Box<Fetch>),
685 Group(Box<Group>),
686 Cube(Box<Cube>),
687 Rollup(Box<Rollup>),
688 GroupingSets(Box<GroupingSets>),
689 LimitOptions(Box<LimitOptions>),
690 Lateral(Box<Lateral>),
691 TableFromRows(Box<TableFromRows>),
692 RowsFrom(Box<RowsFrom>),
693 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
694 WithFill(Box<WithFill>),
695 Property(Box<Property>),
696 GrantPrivilege(Box<GrantPrivilege>),
697 GrantPrincipal(Box<GrantPrincipal>),
698 AllowedValuesProperty(Box<AllowedValuesProperty>),
699 AlgorithmProperty(Box<AlgorithmProperty>),
700 AutoIncrementProperty(Box<AutoIncrementProperty>),
701 AutoRefreshProperty(Box<AutoRefreshProperty>),
702 BackupProperty(Box<BackupProperty>),
703 BuildProperty(Box<BuildProperty>),
704 BlockCompressionProperty(Box<BlockCompressionProperty>),
705 CharacterSetProperty(Box<CharacterSetProperty>),
706 ChecksumProperty(Box<ChecksumProperty>),
707 CollateProperty(Box<CollateProperty>),
708 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
709 DataDeletionProperty(Box<DataDeletionProperty>),
710 DefinerProperty(Box<DefinerProperty>),
711 DistKeyProperty(Box<DistKeyProperty>),
712 DistributedByProperty(Box<DistributedByProperty>),
713 DistStyleProperty(Box<DistStyleProperty>),
714 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
715 EngineProperty(Box<EngineProperty>),
716 ToTableProperty(Box<ToTableProperty>),
717 ExecuteAsProperty(Box<ExecuteAsProperty>),
718 ExternalProperty(Box<ExternalProperty>),
719 FallbackProperty(Box<FallbackProperty>),
720 FileFormatProperty(Box<FileFormatProperty>),
721 CredentialsProperty(Box<CredentialsProperty>),
722 FreespaceProperty(Box<FreespaceProperty>),
723 InheritsProperty(Box<InheritsProperty>),
724 InputModelProperty(Box<InputModelProperty>),
725 OutputModelProperty(Box<OutputModelProperty>),
726 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
727 JournalProperty(Box<JournalProperty>),
728 LanguageProperty(Box<LanguageProperty>),
729 EnviromentProperty(Box<EnviromentProperty>),
730 ClusteredByProperty(Box<ClusteredByProperty>),
731 DictProperty(Box<DictProperty>),
732 DictRange(Box<DictRange>),
733 OnCluster(Box<OnCluster>),
734 LikeProperty(Box<LikeProperty>),
735 LocationProperty(Box<LocationProperty>),
736 LockProperty(Box<LockProperty>),
737 LockingProperty(Box<LockingProperty>),
738 LogProperty(Box<LogProperty>),
739 MaterializedProperty(Box<MaterializedProperty>),
740 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
741 OnProperty(Box<OnProperty>),
742 OnCommitProperty(Box<OnCommitProperty>),
743 PartitionedByProperty(Box<PartitionedByProperty>),
744 PartitionByProperty(Box<PartitionByProperty>),
745 PartitionedByBucket(Box<PartitionedByBucket>),
746 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
747 PartitionByTruncate(Box<PartitionByTruncate>),
748 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
749 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
750 PartitionByListProperty(Box<PartitionByListProperty>),
751 PartitionList(Box<PartitionList>),
752 Partition(Box<Partition>),
753 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
754 UniqueKeyProperty(Box<UniqueKeyProperty>),
755 RollupProperty(Box<RollupProperty>),
756 PartitionBoundSpec(Box<PartitionBoundSpec>),
757 PartitionedOfProperty(Box<PartitionedOfProperty>),
758 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
759 ReturnsProperty(Box<ReturnsProperty>),
760 RowFormatProperty(Box<RowFormatProperty>),
761 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
762 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
763 QueryTransform(Box<QueryTransform>),
764 SampleProperty(Box<SampleProperty>),
765 SecurityProperty(Box<SecurityProperty>),
766 SchemaCommentProperty(Box<SchemaCommentProperty>),
767 SemanticView(Box<SemanticView>),
768 SerdeProperties(Box<SerdeProperties>),
769 SetProperty(Box<SetProperty>),
770 SharingProperty(Box<SharingProperty>),
771 SetConfigProperty(Box<SetConfigProperty>),
772 SettingsProperty(Box<SettingsProperty>),
773 SortKeyProperty(Box<SortKeyProperty>),
774 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
775 SqlSecurityProperty(Box<SqlSecurityProperty>),
776 StabilityProperty(Box<StabilityProperty>),
777 StorageHandlerProperty(Box<StorageHandlerProperty>),
778 TemporaryProperty(Box<TemporaryProperty>),
779 Tags(Box<Tags>),
780 TransformModelProperty(Box<TransformModelProperty>),
781 TransientProperty(Box<TransientProperty>),
782 UsingTemplateProperty(Box<UsingTemplateProperty>),
783 ViewAttributeProperty(Box<ViewAttributeProperty>),
784 VolatileProperty(Box<VolatileProperty>),
785 WithDataProperty(Box<WithDataProperty>),
786 WithJournalTableProperty(Box<WithJournalTableProperty>),
787 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
788 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
789 WithProcedureOptions(Box<WithProcedureOptions>),
790 EncodeProperty(Box<EncodeProperty>),
791 IncludeProperty(Box<IncludeProperty>),
792 Properties(Box<Properties>),
793 OptionsProperty(Box<OptionsProperty>),
794 InputOutputFormat(Box<InputOutputFormat>),
795 Reference(Box<Reference>),
796 QueryOption(Box<QueryOption>),
797 WithTableHint(Box<WithTableHint>),
798 IndexTableHint(Box<IndexTableHint>),
799 HistoricalData(Box<HistoricalData>),
800 Get(Box<Get>),
801 SetOperation(Box<SetOperation>),
802 Var(Box<Var>),
803 Variadic(Box<Variadic>),
804 Version(Box<Version>),
805 Schema(Box<Schema>),
806 Lock(Box<Lock>),
807 TableSample(Box<TableSample>),
808 Tag(Box<Tag>),
809 UnpivotColumns(Box<UnpivotColumns>),
810 WindowSpec(Box<WindowSpec>),
811 SessionParameter(Box<SessionParameter>),
812 PseudoType(Box<PseudoType>),
813 ObjectIdentifier(Box<ObjectIdentifier>),
814 Transaction(Box<Transaction>),
815 Commit(Box<Commit>),
816 Rollback(Box<Rollback>),
817 AlterSession(Box<AlterSession>),
818 Analyze(Box<Analyze>),
819 AnalyzeStatistics(Box<AnalyzeStatistics>),
820 AnalyzeHistogram(Box<AnalyzeHistogram>),
821 AnalyzeSample(Box<AnalyzeSample>),
822 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
823 AnalyzeDelete(Box<AnalyzeDelete>),
824 AnalyzeWith(Box<AnalyzeWith>),
825 AnalyzeValidate(Box<AnalyzeValidate>),
826 AddPartition(Box<AddPartition>),
827 AttachOption(Box<AttachOption>),
828 DropPartition(Box<DropPartition>),
829 ReplacePartition(Box<ReplacePartition>),
830 DPipe(Box<DPipe>),
831 Operator(Box<Operator>),
832 PivotAny(Box<PivotAny>),
833 Aliases(Box<Aliases>),
834 AtIndex(Box<AtIndex>),
835 FromTimeZone(Box<FromTimeZone>),
836 FormatPhrase(Box<FormatPhrase>),
837 ForIn(Box<ForIn>),
838 TimeUnit(Box<TimeUnit>),
839 IntervalOp(Box<IntervalOp>),
840 IntervalSpan(Box<IntervalSpan>),
841 HavingMax(Box<HavingMax>),
842 CosineDistance(Box<CosineDistance>),
843 DotProduct(Box<DotProduct>),
844 EuclideanDistance(Box<EuclideanDistance>),
845 ManhattanDistance(Box<ManhattanDistance>),
846 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
847 Booland(Box<Booland>),
848 Boolor(Box<Boolor>),
849 ParameterizedAgg(Box<ParameterizedAgg>),
850 ArgMax(Box<ArgMax>),
851 ArgMin(Box<ArgMin>),
852 ApproxTopK(Box<ApproxTopK>),
853 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
854 ApproxTopKCombine(Box<ApproxTopKCombine>),
855 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
856 ApproxTopSum(Box<ApproxTopSum>),
857 ApproxQuantiles(Box<ApproxQuantiles>),
858 Minhash(Box<Minhash>),
859 FarmFingerprint(Box<FarmFingerprint>),
860 Float64(Box<Float64>),
861 Transform(Box<Transform>),
862 Translate(Box<Translate>),
863 Grouping(Box<Grouping>),
864 GroupingId(Box<GroupingId>),
865 Anonymous(Box<Anonymous>),
866 AnonymousAggFunc(Box<AnonymousAggFunc>),
867 CombinedAggFunc(Box<CombinedAggFunc>),
868 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
869 HashAgg(Box<HashAgg>),
870 Hll(Box<Hll>),
871 Apply(Box<Apply>),
872 ToBoolean(Box<ToBoolean>),
873 List(Box<List>),
874 ToMap(Box<ToMap>),
875 Pad(Box<Pad>),
876 ToChar(Box<ToChar>),
877 ToNumber(Box<ToNumber>),
878 ToDouble(Box<ToDouble>),
879 Int64(Box<UnaryFunc>),
880 StringFunc(Box<StringFunc>),
881 ToDecfloat(Box<ToDecfloat>),
882 TryToDecfloat(Box<TryToDecfloat>),
883 ToFile(Box<ToFile>),
884 Columns(Box<Columns>),
885 ConvertToCharset(Box<ConvertToCharset>),
886 ConvertTimezone(Box<ConvertTimezone>),
887 GenerateSeries(Box<GenerateSeries>),
888 AIAgg(Box<AIAgg>),
889 AIClassify(Box<AIClassify>),
890 ArrayAll(Box<ArrayAll>),
891 ArrayAny(Box<ArrayAny>),
892 ArrayConstructCompact(Box<ArrayConstructCompact>),
893 StPoint(Box<StPoint>),
894 StDistance(Box<StDistance>),
895 StringToArray(Box<StringToArray>),
896 ArraySum(Box<ArraySum>),
897 ObjectAgg(Box<ObjectAgg>),
898 CastToStrType(Box<CastToStrType>),
899 CheckJson(Box<CheckJson>),
900 CheckXml(Box<CheckXml>),
901 TranslateCharacters(Box<TranslateCharacters>),
902 CurrentSchemas(Box<CurrentSchemas>),
903 CurrentDatetime(Box<CurrentDatetime>),
904 Localtime(Box<Localtime>),
905 Localtimestamp(Box<Localtimestamp>),
906 Systimestamp(Box<Systimestamp>),
907 CurrentSchema(Box<CurrentSchema>),
908 CurrentUser(Box<CurrentUser>),
909 UtcTime(Box<UtcTime>),
910 UtcTimestamp(Box<UtcTimestamp>),
911 Timestamp(Box<TimestampFunc>),
912 DateBin(Box<DateBin>),
913 Datetime(Box<Datetime>),
914 DatetimeAdd(Box<DatetimeAdd>),
915 DatetimeSub(Box<DatetimeSub>),
916 DatetimeDiff(Box<DatetimeDiff>),
917 DatetimeTrunc(Box<DatetimeTrunc>),
918 Dayname(Box<Dayname>),
919 MakeInterval(Box<MakeInterval>),
920 PreviousDay(Box<PreviousDay>),
921 Elt(Box<Elt>),
922 TimestampAdd(Box<TimestampAdd>),
923 TimestampSub(Box<TimestampSub>),
924 TimestampDiff(Box<TimestampDiff>),
925 TimeSlice(Box<TimeSlice>),
926 TimeAdd(Box<TimeAdd>),
927 TimeSub(Box<TimeSub>),
928 TimeDiff(Box<TimeDiff>),
929 TimeTrunc(Box<TimeTrunc>),
930 DateFromParts(Box<DateFromParts>),
931 TimeFromParts(Box<TimeFromParts>),
932 DecodeCase(Box<DecodeCase>),
933 Decrypt(Box<Decrypt>),
934 DecryptRaw(Box<DecryptRaw>),
935 Encode(Box<Encode>),
936 Encrypt(Box<Encrypt>),
937 EncryptRaw(Box<EncryptRaw>),
938 EqualNull(Box<EqualNull>),
939 ToBinary(Box<ToBinary>),
940 Base64DecodeBinary(Box<Base64DecodeBinary>),
941 Base64DecodeString(Box<Base64DecodeString>),
942 Base64Encode(Box<Base64Encode>),
943 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
944 TryBase64DecodeString(Box<TryBase64DecodeString>),
945 GapFill(Box<GapFill>),
946 GenerateDateArray(Box<GenerateDateArray>),
947 GenerateTimestampArray(Box<GenerateTimestampArray>),
948 GetExtract(Box<GetExtract>),
949 Getbit(Box<Getbit>),
950 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
951 HexEncode(Box<HexEncode>),
952 Compress(Box<Compress>),
953 DecompressBinary(Box<DecompressBinary>),
954 DecompressString(Box<DecompressString>),
955 Xor(Box<Xor>),
956 Nullif(Box<Nullif>),
957 JSON(Box<JSON>),
958 JSONPath(Box<JSONPath>),
959 JSONPathFilter(Box<JSONPathFilter>),
960 JSONPathKey(Box<JSONPathKey>),
961 JSONPathRecursive(Box<JSONPathRecursive>),
962 JSONPathScript(Box<JSONPathScript>),
963 JSONPathSlice(Box<JSONPathSlice>),
964 JSONPathSelector(Box<JSONPathSelector>),
965 JSONPathSubscript(Box<JSONPathSubscript>),
966 JSONPathUnion(Box<JSONPathUnion>),
967 Format(Box<Format>),
968 JSONKeys(Box<JSONKeys>),
969 JSONKeyValue(Box<JSONKeyValue>),
970 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
971 JSONObject(Box<JSONObject>),
972 JSONObjectAgg(Box<JSONObjectAgg>),
973 JSONBObjectAgg(Box<JSONBObjectAgg>),
974 JSONArray(Box<JSONArray>),
975 JSONArrayAgg(Box<JSONArrayAgg>),
976 JSONExists(Box<JSONExists>),
977 JSONColumnDef(Box<JSONColumnDef>),
978 JSONSchema(Box<JSONSchema>),
979 JSONSet(Box<JSONSet>),
980 JSONStripNulls(Box<JSONStripNulls>),
981 JSONValue(Box<JSONValue>),
982 JSONValueArray(Box<JSONValueArray>),
983 JSONRemove(Box<JSONRemove>),
984 JSONTable(Box<JSONTable>),
985 JSONType(Box<JSONType>),
986 ObjectInsert(Box<ObjectInsert>),
987 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
988 OpenJSON(Box<OpenJSON>),
989 JSONBExists(Box<JSONBExists>),
990 JSONBContains(Box<BinaryFunc>),
991 JSONBExtract(Box<BinaryFunc>),
992 JSONCast(Box<JSONCast>),
993 JSONExtract(Box<JSONExtract>),
994 JSONExtractQuote(Box<JSONExtractQuote>),
995 JSONExtractArray(Box<JSONExtractArray>),
996 JSONExtractScalar(Box<JSONExtractScalar>),
997 JSONBExtractScalar(Box<JSONBExtractScalar>),
998 JSONFormat(Box<JSONFormat>),
999 JSONBool(Box<UnaryFunc>),
1000 JSONPathRoot(JSONPathRoot),
1001 JSONArrayAppend(Box<JSONArrayAppend>),
1002 JSONArrayContains(Box<JSONArrayContains>),
1003 JSONArrayInsert(Box<JSONArrayInsert>),
1004 ParseJSON(Box<ParseJSON>),
1005 ParseUrl(Box<ParseUrl>),
1006 ParseIp(Box<ParseIp>),
1007 ParseTime(Box<ParseTime>),
1008 ParseDatetime(Box<ParseDatetime>),
1009 Map(Box<Map>),
1010 MapCat(Box<MapCat>),
1011 MapDelete(Box<MapDelete>),
1012 MapInsert(Box<MapInsert>),
1013 MapPick(Box<MapPick>),
1014 ScopeResolution(Box<ScopeResolution>),
1015 Slice(Box<Slice>),
1016 VarMap(Box<VarMap>),
1017 MatchAgainst(Box<MatchAgainst>),
1018 MD5Digest(Box<MD5Digest>),
1019 MD5NumberLower64(Box<UnaryFunc>),
1020 MD5NumberUpper64(Box<UnaryFunc>),
1021 Monthname(Box<Monthname>),
1022 Ntile(Box<Ntile>),
1023 Normalize(Box<Normalize>),
1024 Normal(Box<Normal>),
1025 Predict(Box<Predict>),
1026 MLTranslate(Box<MLTranslate>),
1027 FeaturesAtTime(Box<FeaturesAtTime>),
1028 GenerateEmbedding(Box<GenerateEmbedding>),
1029 MLForecast(Box<MLForecast>),
1030 ModelAttribute(Box<ModelAttribute>),
1031 VectorSearch(Box<VectorSearch>),
1032 Quantile(Box<Quantile>),
1033 ApproxQuantile(Box<ApproxQuantile>),
1034 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1035 Randn(Box<Randn>),
1036 Randstr(Box<Randstr>),
1037 RangeN(Box<RangeN>),
1038 RangeBucket(Box<RangeBucket>),
1039 ReadCSV(Box<ReadCSV>),
1040 ReadParquet(Box<ReadParquet>),
1041 Reduce(Box<Reduce>),
1042 RegexpExtractAll(Box<RegexpExtractAll>),
1043 RegexpILike(Box<RegexpILike>),
1044 RegexpFullMatch(Box<RegexpFullMatch>),
1045 RegexpInstr(Box<RegexpInstr>),
1046 RegexpSplit(Box<RegexpSplit>),
1047 RegexpCount(Box<RegexpCount>),
1048 RegrValx(Box<RegrValx>),
1049 RegrValy(Box<RegrValy>),
1050 RegrAvgy(Box<RegrAvgy>),
1051 RegrAvgx(Box<RegrAvgx>),
1052 RegrCount(Box<RegrCount>),
1053 RegrIntercept(Box<RegrIntercept>),
1054 RegrR2(Box<RegrR2>),
1055 RegrSxx(Box<RegrSxx>),
1056 RegrSxy(Box<RegrSxy>),
1057 RegrSyy(Box<RegrSyy>),
1058 RegrSlope(Box<RegrSlope>),
1059 SafeAdd(Box<SafeAdd>),
1060 SafeDivide(Box<SafeDivide>),
1061 SafeMultiply(Box<SafeMultiply>),
1062 SafeSubtract(Box<SafeSubtract>),
1063 SHA2(Box<SHA2>),
1064 SHA2Digest(Box<SHA2Digest>),
1065 SortArray(Box<SortArray>),
1066 SplitPart(Box<SplitPart>),
1067 SubstringIndex(Box<SubstringIndex>),
1068 StandardHash(Box<StandardHash>),
1069 StrPosition(Box<StrPosition>),
1070 Search(Box<Search>),
1071 SearchIp(Box<SearchIp>),
1072 StrToDate(Box<StrToDate>),
1073 DateStrToDate(Box<UnaryFunc>),
1074 DateToDateStr(Box<UnaryFunc>),
1075 StrToTime(Box<StrToTime>),
1076 StrToUnix(Box<StrToUnix>),
1077 StrToMap(Box<StrToMap>),
1078 NumberToStr(Box<NumberToStr>),
1079 FromBase(Box<FromBase>),
1080 Stuff(Box<Stuff>),
1081 TimeToStr(Box<TimeToStr>),
1082 TimeStrToTime(Box<TimeStrToTime>),
1083 TsOrDsAdd(Box<TsOrDsAdd>),
1084 TsOrDsDiff(Box<TsOrDsDiff>),
1085 TsOrDsToDate(Box<TsOrDsToDate>),
1086 TsOrDsToTime(Box<TsOrDsToTime>),
1087 Unhex(Box<Unhex>),
1088 Uniform(Box<Uniform>),
1089 UnixToStr(Box<UnixToStr>),
1090 UnixToTime(Box<UnixToTime>),
1091 Uuid(Box<Uuid>),
1092 TimestampFromParts(Box<TimestampFromParts>),
1093 TimestampTzFromParts(Box<TimestampTzFromParts>),
1094 Corr(Box<Corr>),
1095 WidthBucket(Box<WidthBucket>),
1096 CovarSamp(Box<CovarSamp>),
1097 CovarPop(Box<CovarPop>),
1098 Week(Box<Week>),
1099 XMLElement(Box<XMLElement>),
1100 XMLGet(Box<XMLGet>),
1101 XMLTable(Box<XMLTable>),
1102 XMLKeyValueOption(Box<XMLKeyValueOption>),
1103 Zipf(Box<Zipf>),
1104 Merge(Box<Merge>),
1105 When(Box<When>),
1106 Whens(Box<Whens>),
1107 NextValueFor(Box<NextValueFor>),
1108 ReturnStmt(Box<Expression>),
1110}
1111
1112impl Expression {
1113 #[inline]
1115 pub fn boxed_column(col: Column) -> Self {
1116 Expression::Column(Box::new(col))
1117 }
1118
1119 #[inline]
1121 pub fn boxed_table(t: TableRef) -> Self {
1122 Expression::Table(Box::new(t))
1123 }
1124
1125 pub fn is_statement(&self) -> bool {
1132 match self {
1133 Expression::Select(_)
1135 | Expression::Union(_)
1136 | Expression::Intersect(_)
1137 | Expression::Except(_)
1138 | Expression::Subquery(_)
1139 | Expression::Values(_)
1140 | Expression::PipeOperator(_)
1141
1142 | Expression::Insert(_)
1144 | Expression::Update(_)
1145 | Expression::Delete(_)
1146 | Expression::Copy(_)
1147 | Expression::Put(_)
1148 | Expression::Merge(_)
1149
1150 | Expression::CreateTable(_)
1152 | Expression::DropTable(_)
1153 | Expression::Undrop(_)
1154 | Expression::AlterTable(_)
1155 | Expression::CreateIndex(_)
1156 | Expression::DropIndex(_)
1157 | Expression::CreateView(_)
1158 | Expression::DropView(_)
1159 | Expression::AlterView(_)
1160 | Expression::AlterIndex(_)
1161 | Expression::Truncate(_)
1162 | Expression::TruncateTable(_)
1163 | Expression::CreateSchema(_)
1164 | Expression::DropSchema(_)
1165 | Expression::DropNamespace(_)
1166 | Expression::CreateDatabase(_)
1167 | Expression::DropDatabase(_)
1168 | Expression::CreateFunction(_)
1169 | Expression::DropFunction(_)
1170 | Expression::CreateProcedure(_)
1171 | Expression::DropProcedure(_)
1172 | Expression::CreateSequence(_)
1173 | Expression::CreateSynonym(_)
1174 | Expression::DropSequence(_)
1175 | Expression::AlterSequence(_)
1176 | Expression::CreateTrigger(_)
1177 | Expression::DropTrigger(_)
1178 | Expression::CreateType(_)
1179 | Expression::DropType(_)
1180 | Expression::Comment(_)
1181
1182 | Expression::Use(_)
1184 | Expression::Set(_)
1185 | Expression::SetStatement(_)
1186 | Expression::Transaction(_)
1187 | Expression::Commit(_)
1188 | Expression::Rollback(_)
1189 | Expression::Grant(_)
1190 | Expression::Revoke(_)
1191 | Expression::Cache(_)
1192 | Expression::Uncache(_)
1193 | Expression::LoadData(_)
1194 | Expression::Pragma(_)
1195 | Expression::Describe(_)
1196 | Expression::Show(_)
1197 | Expression::Kill(_)
1198 | Expression::Execute(_)
1199 | Expression::Declare(_)
1200 | Expression::Refresh(_)
1201 | Expression::AlterSession(_)
1202 | Expression::LockingStatement(_)
1203
1204 | Expression::Analyze(_)
1206 | Expression::AnalyzeStatistics(_)
1207 | Expression::AnalyzeHistogram(_)
1208 | Expression::AnalyzeSample(_)
1209 | Expression::AnalyzeListChainedRows(_)
1210 | Expression::AnalyzeDelete(_)
1211
1212 | Expression::Attach(_)
1214 | Expression::Detach(_)
1215 | Expression::Install(_)
1216 | Expression::Summarize(_)
1217
1218 | Expression::Pivot(_)
1220 | Expression::Unpivot(_)
1221
1222 | Expression::Command(_)
1224 | Expression::Raw(_)
1225 | Expression::CreateTask(_)
1226
1227 | Expression::ReturnStmt(_) => true,
1229
1230 Expression::Annotated(a) => a.this.is_statement(),
1232
1233 Expression::Alias(a) => a.this.is_statement(),
1235
1236 _ => false,
1238 }
1239 }
1240
1241 pub fn number(n: i64) -> Self {
1243 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1244 }
1245
1246 pub fn string(s: impl Into<String>) -> Self {
1248 Expression::Literal(Box::new(Literal::String(s.into())))
1249 }
1250
1251 pub fn float(f: f64) -> Self {
1253 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1254 }
1255
1256 pub fn inferred_type(&self) -> Option<&DataType> {
1262 match self {
1263 Expression::And(op)
1265 | Expression::Or(op)
1266 | Expression::Add(op)
1267 | Expression::Sub(op)
1268 | Expression::Mul(op)
1269 | Expression::Div(op)
1270 | Expression::Mod(op)
1271 | Expression::Eq(op)
1272 | Expression::Neq(op)
1273 | Expression::Lt(op)
1274 | Expression::Lte(op)
1275 | Expression::Gt(op)
1276 | Expression::Gte(op)
1277 | Expression::Concat(op)
1278 | Expression::BitwiseAnd(op)
1279 | Expression::BitwiseOr(op)
1280 | Expression::BitwiseXor(op)
1281 | Expression::Adjacent(op)
1282 | Expression::TsMatch(op)
1283 | Expression::PropertyEQ(op)
1284 | Expression::ArrayContainsAll(op)
1285 | Expression::ArrayContainedBy(op)
1286 | Expression::ArrayOverlaps(op)
1287 | Expression::JSONBContainsAllTopKeys(op)
1288 | Expression::JSONBContainsAnyTopKeys(op)
1289 | Expression::JSONBDeleteAtPath(op)
1290 | Expression::ExtendsLeft(op)
1291 | Expression::ExtendsRight(op)
1292 | Expression::Is(op)
1293 | Expression::MemberOf(op)
1294 | Expression::Match(op)
1295 | Expression::NullSafeEq(op)
1296 | Expression::NullSafeNeq(op)
1297 | Expression::Glob(op)
1298 | Expression::BitwiseLeftShift(op)
1299 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1300
1301 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1302 op.inferred_type.as_ref()
1303 }
1304
1305 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1306
1307 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1308 c.inferred_type.as_ref()
1309 }
1310
1311 Expression::Column(c) => c.inferred_type.as_ref(),
1312 Expression::Function(f) => f.inferred_type.as_ref(),
1313 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1314 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1315 Expression::Case(c) => c.inferred_type.as_ref(),
1316 Expression::Subquery(s) => s.inferred_type.as_ref(),
1317 Expression::Alias(a) => a.inferred_type.as_ref(),
1318 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1319 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1320 Expression::Count(f) => f.inferred_type.as_ref(),
1321 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1322 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1323 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1324 Expression::SumIf(f) => f.inferred_type.as_ref(),
1325
1326 Expression::Upper(f)
1328 | Expression::Lower(f)
1329 | Expression::Length(f)
1330 | Expression::LTrim(f)
1331 | Expression::RTrim(f)
1332 | Expression::Reverse(f)
1333 | Expression::Abs(f)
1334 | Expression::Sqrt(f)
1335 | Expression::Cbrt(f)
1336 | Expression::Ln(f)
1337 | Expression::Exp(f)
1338 | Expression::Sign(f)
1339 | Expression::Date(f)
1340 | Expression::Time(f)
1341 | Expression::Initcap(f)
1342 | Expression::Ascii(f)
1343 | Expression::Chr(f)
1344 | Expression::Soundex(f)
1345 | Expression::ByteLength(f)
1346 | Expression::Hex(f)
1347 | Expression::LowerHex(f)
1348 | Expression::Unicode(f)
1349 | Expression::Typeof(f)
1350 | Expression::Explode(f)
1351 | Expression::ExplodeOuter(f)
1352 | Expression::MapFromEntries(f)
1353 | Expression::MapKeys(f)
1354 | Expression::MapValues(f)
1355 | Expression::ArrayLength(f)
1356 | Expression::ArraySize(f)
1357 | Expression::Cardinality(f)
1358 | Expression::ArrayReverse(f)
1359 | Expression::ArrayDistinct(f)
1360 | Expression::ArrayFlatten(f)
1361 | Expression::ArrayCompact(f)
1362 | Expression::ToArray(f)
1363 | Expression::JsonArrayLength(f)
1364 | Expression::JsonKeys(f)
1365 | Expression::JsonType(f)
1366 | Expression::ParseJson(f)
1367 | Expression::ToJson(f)
1368 | Expression::Radians(f)
1369 | Expression::Degrees(f)
1370 | Expression::Sin(f)
1371 | Expression::Cos(f)
1372 | Expression::Tan(f)
1373 | Expression::Asin(f)
1374 | Expression::Acos(f)
1375 | Expression::Atan(f)
1376 | Expression::IsNan(f)
1377 | Expression::IsInf(f)
1378 | Expression::Year(f)
1379 | Expression::Month(f)
1380 | Expression::Day(f)
1381 | Expression::Hour(f)
1382 | Expression::Minute(f)
1383 | Expression::Second(f)
1384 | Expression::DayOfWeek(f)
1385 | Expression::DayOfWeekIso(f)
1386 | Expression::DayOfMonth(f)
1387 | Expression::DayOfYear(f)
1388 | Expression::WeekOfYear(f)
1389 | Expression::Quarter(f)
1390 | Expression::Epoch(f)
1391 | Expression::EpochMs(f)
1392 | Expression::BitwiseCount(f)
1393 | Expression::DateFromUnixDate(f)
1394 | Expression::UnixDate(f)
1395 | Expression::UnixSeconds(f)
1396 | Expression::UnixMillis(f)
1397 | Expression::UnixMicros(f)
1398 | Expression::TimeStrToDate(f)
1399 | Expression::DateToDi(f)
1400 | Expression::DiToDate(f)
1401 | Expression::TsOrDiToDi(f)
1402 | Expression::TsOrDsToDatetime(f)
1403 | Expression::TsOrDsToTimestamp(f)
1404 | Expression::YearOfWeek(f)
1405 | Expression::YearOfWeekIso(f)
1406 | Expression::SHA(f)
1407 | Expression::SHA1Digest(f)
1408 | Expression::TimeToUnix(f)
1409 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1410
1411 Expression::Power(f)
1413 | Expression::NullIf(f)
1414 | Expression::IfNull(f)
1415 | Expression::Nvl(f)
1416 | Expression::Contains(f)
1417 | Expression::StartsWith(f)
1418 | Expression::EndsWith(f)
1419 | Expression::Levenshtein(f)
1420 | Expression::ModFunc(f)
1421 | Expression::IntDiv(f)
1422 | Expression::Atan2(f)
1423 | Expression::AddMonths(f)
1424 | Expression::MonthsBetween(f)
1425 | Expression::NextDay(f)
1426 | Expression::UnixToTimeStr(f)
1427 | Expression::ArrayContains(f)
1428 | Expression::ArrayPosition(f)
1429 | Expression::ArrayAppend(f)
1430 | Expression::ArrayPrepend(f)
1431 | Expression::ArrayUnion(f)
1432 | Expression::ArrayExcept(f)
1433 | Expression::ArrayRemove(f)
1434 | Expression::StarMap(f)
1435 | Expression::MapFromArrays(f)
1436 | Expression::MapContainsKey(f)
1437 | Expression::ElementAt(f)
1438 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1439
1440 Expression::Coalesce(f)
1442 | Expression::Greatest(f)
1443 | Expression::Least(f)
1444 | Expression::ArrayConcat(f)
1445 | Expression::ArrayIntersect(f)
1446 | Expression::ArrayZip(f)
1447 | Expression::MapConcat(f)
1448 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1449
1450 Expression::Sum(f)
1452 | Expression::Avg(f)
1453 | Expression::Min(f)
1454 | Expression::Max(f)
1455 | Expression::ArrayAgg(f)
1456 | Expression::CountIf(f)
1457 | Expression::Stddev(f)
1458 | Expression::StddevPop(f)
1459 | Expression::StddevSamp(f)
1460 | Expression::Variance(f)
1461 | Expression::VarPop(f)
1462 | Expression::VarSamp(f)
1463 | Expression::Median(f)
1464 | Expression::Mode(f)
1465 | Expression::First(f)
1466 | Expression::Last(f)
1467 | Expression::AnyValue(f)
1468 | Expression::ApproxDistinct(f)
1469 | Expression::ApproxCountDistinct(f)
1470 | Expression::LogicalAnd(f)
1471 | Expression::LogicalOr(f)
1472 | Expression::Skewness(f)
1473 | Expression::ArrayConcatAgg(f)
1474 | Expression::ArrayUniqueAgg(f)
1475 | Expression::BoolXorAgg(f)
1476 | Expression::BitwiseAndAgg(f)
1477 | Expression::BitwiseOrAgg(f)
1478 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1479
1480 _ => None,
1482 }
1483 }
1484
1485 pub fn set_inferred_type(&mut self, dt: DataType) {
1490 match self {
1491 Expression::And(op)
1492 | Expression::Or(op)
1493 | Expression::Add(op)
1494 | Expression::Sub(op)
1495 | Expression::Mul(op)
1496 | Expression::Div(op)
1497 | Expression::Mod(op)
1498 | Expression::Eq(op)
1499 | Expression::Neq(op)
1500 | Expression::Lt(op)
1501 | Expression::Lte(op)
1502 | Expression::Gt(op)
1503 | Expression::Gte(op)
1504 | Expression::Concat(op)
1505 | Expression::BitwiseAnd(op)
1506 | Expression::BitwiseOr(op)
1507 | Expression::BitwiseXor(op)
1508 | Expression::Adjacent(op)
1509 | Expression::TsMatch(op)
1510 | Expression::PropertyEQ(op)
1511 | Expression::ArrayContainsAll(op)
1512 | Expression::ArrayContainedBy(op)
1513 | Expression::ArrayOverlaps(op)
1514 | Expression::JSONBContainsAllTopKeys(op)
1515 | Expression::JSONBContainsAnyTopKeys(op)
1516 | Expression::JSONBDeleteAtPath(op)
1517 | Expression::ExtendsLeft(op)
1518 | Expression::ExtendsRight(op)
1519 | Expression::Is(op)
1520 | Expression::MemberOf(op)
1521 | Expression::Match(op)
1522 | Expression::NullSafeEq(op)
1523 | Expression::NullSafeNeq(op)
1524 | Expression::Glob(op)
1525 | Expression::BitwiseLeftShift(op)
1526 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1527
1528 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1529 op.inferred_type = Some(dt)
1530 }
1531
1532 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1533
1534 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1535 c.inferred_type = Some(dt)
1536 }
1537
1538 Expression::Column(c) => c.inferred_type = Some(dt),
1539 Expression::Function(f) => f.inferred_type = Some(dt),
1540 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1541 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1542 Expression::Case(c) => c.inferred_type = Some(dt),
1543 Expression::Subquery(s) => s.inferred_type = Some(dt),
1544 Expression::Alias(a) => a.inferred_type = Some(dt),
1545 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1546 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1547 Expression::Count(f) => f.inferred_type = Some(dt),
1548 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1549 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1550 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1551 Expression::SumIf(f) => f.inferred_type = Some(dt),
1552
1553 Expression::Upper(f)
1555 | Expression::Lower(f)
1556 | Expression::Length(f)
1557 | Expression::LTrim(f)
1558 | Expression::RTrim(f)
1559 | Expression::Reverse(f)
1560 | Expression::Abs(f)
1561 | Expression::Sqrt(f)
1562 | Expression::Cbrt(f)
1563 | Expression::Ln(f)
1564 | Expression::Exp(f)
1565 | Expression::Sign(f)
1566 | Expression::Date(f)
1567 | Expression::Time(f)
1568 | Expression::Initcap(f)
1569 | Expression::Ascii(f)
1570 | Expression::Chr(f)
1571 | Expression::Soundex(f)
1572 | Expression::ByteLength(f)
1573 | Expression::Hex(f)
1574 | Expression::LowerHex(f)
1575 | Expression::Unicode(f)
1576 | Expression::Typeof(f)
1577 | Expression::Explode(f)
1578 | Expression::ExplodeOuter(f)
1579 | Expression::MapFromEntries(f)
1580 | Expression::MapKeys(f)
1581 | Expression::MapValues(f)
1582 | Expression::ArrayLength(f)
1583 | Expression::ArraySize(f)
1584 | Expression::Cardinality(f)
1585 | Expression::ArrayReverse(f)
1586 | Expression::ArrayDistinct(f)
1587 | Expression::ArrayFlatten(f)
1588 | Expression::ArrayCompact(f)
1589 | Expression::ToArray(f)
1590 | Expression::JsonArrayLength(f)
1591 | Expression::JsonKeys(f)
1592 | Expression::JsonType(f)
1593 | Expression::ParseJson(f)
1594 | Expression::ToJson(f)
1595 | Expression::Radians(f)
1596 | Expression::Degrees(f)
1597 | Expression::Sin(f)
1598 | Expression::Cos(f)
1599 | Expression::Tan(f)
1600 | Expression::Asin(f)
1601 | Expression::Acos(f)
1602 | Expression::Atan(f)
1603 | Expression::IsNan(f)
1604 | Expression::IsInf(f)
1605 | Expression::Year(f)
1606 | Expression::Month(f)
1607 | Expression::Day(f)
1608 | Expression::Hour(f)
1609 | Expression::Minute(f)
1610 | Expression::Second(f)
1611 | Expression::DayOfWeek(f)
1612 | Expression::DayOfWeekIso(f)
1613 | Expression::DayOfMonth(f)
1614 | Expression::DayOfYear(f)
1615 | Expression::WeekOfYear(f)
1616 | Expression::Quarter(f)
1617 | Expression::Epoch(f)
1618 | Expression::EpochMs(f)
1619 | Expression::BitwiseCount(f)
1620 | Expression::DateFromUnixDate(f)
1621 | Expression::UnixDate(f)
1622 | Expression::UnixSeconds(f)
1623 | Expression::UnixMillis(f)
1624 | Expression::UnixMicros(f)
1625 | Expression::TimeStrToDate(f)
1626 | Expression::DateToDi(f)
1627 | Expression::DiToDate(f)
1628 | Expression::TsOrDiToDi(f)
1629 | Expression::TsOrDsToDatetime(f)
1630 | Expression::TsOrDsToTimestamp(f)
1631 | Expression::YearOfWeek(f)
1632 | Expression::YearOfWeekIso(f)
1633 | Expression::SHA(f)
1634 | Expression::SHA1Digest(f)
1635 | Expression::TimeToUnix(f)
1636 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1637
1638 Expression::Power(f)
1640 | Expression::NullIf(f)
1641 | Expression::IfNull(f)
1642 | Expression::Nvl(f)
1643 | Expression::Contains(f)
1644 | Expression::StartsWith(f)
1645 | Expression::EndsWith(f)
1646 | Expression::Levenshtein(f)
1647 | Expression::ModFunc(f)
1648 | Expression::IntDiv(f)
1649 | Expression::Atan2(f)
1650 | Expression::AddMonths(f)
1651 | Expression::MonthsBetween(f)
1652 | Expression::NextDay(f)
1653 | Expression::UnixToTimeStr(f)
1654 | Expression::ArrayContains(f)
1655 | Expression::ArrayPosition(f)
1656 | Expression::ArrayAppend(f)
1657 | Expression::ArrayPrepend(f)
1658 | Expression::ArrayUnion(f)
1659 | Expression::ArrayExcept(f)
1660 | Expression::ArrayRemove(f)
1661 | Expression::StarMap(f)
1662 | Expression::MapFromArrays(f)
1663 | Expression::MapContainsKey(f)
1664 | Expression::ElementAt(f)
1665 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1666
1667 Expression::Coalesce(f)
1669 | Expression::Greatest(f)
1670 | Expression::Least(f)
1671 | Expression::ArrayConcat(f)
1672 | Expression::ArrayIntersect(f)
1673 | Expression::ArrayZip(f)
1674 | Expression::MapConcat(f)
1675 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1676
1677 Expression::Sum(f)
1679 | Expression::Avg(f)
1680 | Expression::Min(f)
1681 | Expression::Max(f)
1682 | Expression::ArrayAgg(f)
1683 | Expression::CountIf(f)
1684 | Expression::Stddev(f)
1685 | Expression::StddevPop(f)
1686 | Expression::StddevSamp(f)
1687 | Expression::Variance(f)
1688 | Expression::VarPop(f)
1689 | Expression::VarSamp(f)
1690 | Expression::Median(f)
1691 | Expression::Mode(f)
1692 | Expression::First(f)
1693 | Expression::Last(f)
1694 | Expression::AnyValue(f)
1695 | Expression::ApproxDistinct(f)
1696 | Expression::ApproxCountDistinct(f)
1697 | Expression::LogicalAnd(f)
1698 | Expression::LogicalOr(f)
1699 | Expression::Skewness(f)
1700 | Expression::ArrayConcatAgg(f)
1701 | Expression::ArrayUniqueAgg(f)
1702 | Expression::BoolXorAgg(f)
1703 | Expression::BitwiseAndAgg(f)
1704 | Expression::BitwiseOrAgg(f)
1705 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1706
1707 _ => {}
1709 }
1710 }
1711
1712 pub fn column(name: impl Into<String>) -> Self {
1714 Expression::Column(Box::new(Column {
1715 name: Identifier::new(name),
1716 table: None,
1717 join_mark: false,
1718 trailing_comments: Vec::new(),
1719 span: None,
1720 inferred_type: None,
1721 }))
1722 }
1723
1724 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1726 Expression::Column(Box::new(Column {
1727 name: Identifier::new(column),
1728 table: Some(Identifier::new(table)),
1729 join_mark: false,
1730 trailing_comments: Vec::new(),
1731 span: None,
1732 inferred_type: None,
1733 }))
1734 }
1735
1736 pub fn identifier(name: impl Into<String>) -> Self {
1738 Expression::Identifier(Identifier::new(name))
1739 }
1740
1741 pub fn null() -> Self {
1743 Expression::Null(Null)
1744 }
1745
1746 pub fn true_() -> Self {
1748 Expression::Boolean(BooleanLiteral { value: true })
1749 }
1750
1751 pub fn false_() -> Self {
1753 Expression::Boolean(BooleanLiteral { value: false })
1754 }
1755
1756 pub fn star() -> Self {
1758 Expression::Star(Star {
1759 table: None,
1760 except: None,
1761 replace: None,
1762 rename: None,
1763 trailing_comments: Vec::new(),
1764 span: None,
1765 })
1766 }
1767
1768 pub fn alias(self, name: impl Into<String>) -> Self {
1770 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1771 }
1772
1773 pub fn is_select(&self) -> bool {
1775 matches!(self, Expression::Select(_))
1776 }
1777
1778 pub fn as_select(&self) -> Option<&Select> {
1780 match self {
1781 Expression::Select(s) => Some(s),
1782 _ => None,
1783 }
1784 }
1785
1786 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1788 match self {
1789 Expression::Select(s) => Some(s),
1790 _ => None,
1791 }
1792 }
1793
1794 pub fn sql(&self) -> String {
1799 crate::generator::Generator::sql(self).unwrap_or_default()
1800 }
1801
1802 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1808 crate::generate(self, dialect).unwrap_or_default()
1809 }
1810}
1811
1812impl Expression {
1815 pub fn variant_name(&self) -> &'static str {
1818 match self {
1819 Expression::Literal(_) => "literal",
1820 Expression::Boolean(_) => "boolean",
1821 Expression::Null(_) => "null",
1822 Expression::Identifier(_) => "identifier",
1823 Expression::Column(_) => "column",
1824 Expression::Table(_) => "table",
1825 Expression::Star(_) => "star",
1826 Expression::BracedWildcard(_) => "braced_wildcard",
1827 Expression::Select(_) => "select",
1828 Expression::Union(_) => "union",
1829 Expression::Intersect(_) => "intersect",
1830 Expression::Except(_) => "except",
1831 Expression::Subquery(_) => "subquery",
1832 Expression::PipeOperator(_) => "pipe_operator",
1833 Expression::Pivot(_) => "pivot",
1834 Expression::PivotAlias(_) => "pivot_alias",
1835 Expression::Unpivot(_) => "unpivot",
1836 Expression::Values(_) => "values",
1837 Expression::PreWhere(_) => "pre_where",
1838 Expression::Stream(_) => "stream",
1839 Expression::UsingData(_) => "using_data",
1840 Expression::XmlNamespace(_) => "xml_namespace",
1841 Expression::Insert(_) => "insert",
1842 Expression::Update(_) => "update",
1843 Expression::Delete(_) => "delete",
1844 Expression::Copy(_) => "copy",
1845 Expression::Put(_) => "put",
1846 Expression::StageReference(_) => "stage_reference",
1847 Expression::Alias(_) => "alias",
1848 Expression::Cast(_) => "cast",
1849 Expression::Collation(_) => "collation",
1850 Expression::Case(_) => "case",
1851 Expression::And(_) => "and",
1852 Expression::Or(_) => "or",
1853 Expression::Add(_) => "add",
1854 Expression::Sub(_) => "sub",
1855 Expression::Mul(_) => "mul",
1856 Expression::Div(_) => "div",
1857 Expression::Mod(_) => "mod",
1858 Expression::Eq(_) => "eq",
1859 Expression::Neq(_) => "neq",
1860 Expression::Lt(_) => "lt",
1861 Expression::Lte(_) => "lte",
1862 Expression::Gt(_) => "gt",
1863 Expression::Gte(_) => "gte",
1864 Expression::Like(_) => "like",
1865 Expression::ILike(_) => "i_like",
1866 Expression::Match(_) => "match",
1867 Expression::BitwiseAnd(_) => "bitwise_and",
1868 Expression::BitwiseOr(_) => "bitwise_or",
1869 Expression::BitwiseXor(_) => "bitwise_xor",
1870 Expression::Concat(_) => "concat",
1871 Expression::Adjacent(_) => "adjacent",
1872 Expression::TsMatch(_) => "ts_match",
1873 Expression::PropertyEQ(_) => "property_e_q",
1874 Expression::ArrayContainsAll(_) => "array_contains_all",
1875 Expression::ArrayContainedBy(_) => "array_contained_by",
1876 Expression::ArrayOverlaps(_) => "array_overlaps",
1877 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1878 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1879 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1880 Expression::ExtendsLeft(_) => "extends_left",
1881 Expression::ExtendsRight(_) => "extends_right",
1882 Expression::Not(_) => "not",
1883 Expression::Neg(_) => "neg",
1884 Expression::BitwiseNot(_) => "bitwise_not",
1885 Expression::In(_) => "in",
1886 Expression::Between(_) => "between",
1887 Expression::IsNull(_) => "is_null",
1888 Expression::IsTrue(_) => "is_true",
1889 Expression::IsFalse(_) => "is_false",
1890 Expression::IsJson(_) => "is_json",
1891 Expression::Is(_) => "is",
1892 Expression::Exists(_) => "exists",
1893 Expression::MemberOf(_) => "member_of",
1894 Expression::Function(_) => "function",
1895 Expression::AggregateFunction(_) => "aggregate_function",
1896 Expression::WindowFunction(_) => "window_function",
1897 Expression::From(_) => "from",
1898 Expression::Join(_) => "join",
1899 Expression::JoinedTable(_) => "joined_table",
1900 Expression::Where(_) => "where",
1901 Expression::GroupBy(_) => "group_by",
1902 Expression::Having(_) => "having",
1903 Expression::OrderBy(_) => "order_by",
1904 Expression::Limit(_) => "limit",
1905 Expression::Offset(_) => "offset",
1906 Expression::Qualify(_) => "qualify",
1907 Expression::With(_) => "with",
1908 Expression::Cte(_) => "cte",
1909 Expression::DistributeBy(_) => "distribute_by",
1910 Expression::ClusterBy(_) => "cluster_by",
1911 Expression::SortBy(_) => "sort_by",
1912 Expression::LateralView(_) => "lateral_view",
1913 Expression::Hint(_) => "hint",
1914 Expression::Pseudocolumn(_) => "pseudocolumn",
1915 Expression::Connect(_) => "connect",
1916 Expression::Prior(_) => "prior",
1917 Expression::ConnectByRoot(_) => "connect_by_root",
1918 Expression::MatchRecognize(_) => "match_recognize",
1919 Expression::Ordered(_) => "ordered",
1920 Expression::Window(_) => "window",
1921 Expression::Over(_) => "over",
1922 Expression::WithinGroup(_) => "within_group",
1923 Expression::DataType(_) => "data_type",
1924 Expression::Array(_) => "array",
1925 Expression::Struct(_) => "struct",
1926 Expression::Tuple(_) => "tuple",
1927 Expression::Interval(_) => "interval",
1928 Expression::ConcatWs(_) => "concat_ws",
1929 Expression::Substring(_) => "substring",
1930 Expression::Upper(_) => "upper",
1931 Expression::Lower(_) => "lower",
1932 Expression::Length(_) => "length",
1933 Expression::Trim(_) => "trim",
1934 Expression::LTrim(_) => "l_trim",
1935 Expression::RTrim(_) => "r_trim",
1936 Expression::Replace(_) => "replace",
1937 Expression::Reverse(_) => "reverse",
1938 Expression::Left(_) => "left",
1939 Expression::Right(_) => "right",
1940 Expression::Repeat(_) => "repeat",
1941 Expression::Lpad(_) => "lpad",
1942 Expression::Rpad(_) => "rpad",
1943 Expression::Split(_) => "split",
1944 Expression::RegexpLike(_) => "regexp_like",
1945 Expression::RegexpReplace(_) => "regexp_replace",
1946 Expression::RegexpExtract(_) => "regexp_extract",
1947 Expression::Overlay(_) => "overlay",
1948 Expression::Abs(_) => "abs",
1949 Expression::Round(_) => "round",
1950 Expression::Floor(_) => "floor",
1951 Expression::Ceil(_) => "ceil",
1952 Expression::Power(_) => "power",
1953 Expression::Sqrt(_) => "sqrt",
1954 Expression::Cbrt(_) => "cbrt",
1955 Expression::Ln(_) => "ln",
1956 Expression::Log(_) => "log",
1957 Expression::Exp(_) => "exp",
1958 Expression::Sign(_) => "sign",
1959 Expression::Greatest(_) => "greatest",
1960 Expression::Least(_) => "least",
1961 Expression::CurrentDate(_) => "current_date",
1962 Expression::CurrentTime(_) => "current_time",
1963 Expression::CurrentTimestamp(_) => "current_timestamp",
1964 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1965 Expression::AtTimeZone(_) => "at_time_zone",
1966 Expression::DateAdd(_) => "date_add",
1967 Expression::DateSub(_) => "date_sub",
1968 Expression::DateDiff(_) => "date_diff",
1969 Expression::DateTrunc(_) => "date_trunc",
1970 Expression::Extract(_) => "extract",
1971 Expression::ToDate(_) => "to_date",
1972 Expression::ToTimestamp(_) => "to_timestamp",
1973 Expression::Date(_) => "date",
1974 Expression::Time(_) => "time",
1975 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1976 Expression::UnixDate(_) => "unix_date",
1977 Expression::UnixSeconds(_) => "unix_seconds",
1978 Expression::UnixMillis(_) => "unix_millis",
1979 Expression::UnixMicros(_) => "unix_micros",
1980 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1981 Expression::TimeStrToDate(_) => "time_str_to_date",
1982 Expression::DateToDi(_) => "date_to_di",
1983 Expression::DiToDate(_) => "di_to_date",
1984 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1985 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1986 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
1987 Expression::YearOfWeek(_) => "year_of_week",
1988 Expression::YearOfWeekIso(_) => "year_of_week_iso",
1989 Expression::Coalesce(_) => "coalesce",
1990 Expression::NullIf(_) => "null_if",
1991 Expression::IfFunc(_) => "if_func",
1992 Expression::IfNull(_) => "if_null",
1993 Expression::Nvl(_) => "nvl",
1994 Expression::Nvl2(_) => "nvl2",
1995 Expression::TryCast(_) => "try_cast",
1996 Expression::SafeCast(_) => "safe_cast",
1997 Expression::Count(_) => "count",
1998 Expression::Sum(_) => "sum",
1999 Expression::Avg(_) => "avg",
2000 Expression::Min(_) => "min",
2001 Expression::Max(_) => "max",
2002 Expression::GroupConcat(_) => "group_concat",
2003 Expression::StringAgg(_) => "string_agg",
2004 Expression::ListAgg(_) => "list_agg",
2005 Expression::ArrayAgg(_) => "array_agg",
2006 Expression::CountIf(_) => "count_if",
2007 Expression::SumIf(_) => "sum_if",
2008 Expression::Stddev(_) => "stddev",
2009 Expression::StddevPop(_) => "stddev_pop",
2010 Expression::StddevSamp(_) => "stddev_samp",
2011 Expression::Variance(_) => "variance",
2012 Expression::VarPop(_) => "var_pop",
2013 Expression::VarSamp(_) => "var_samp",
2014 Expression::Median(_) => "median",
2015 Expression::Mode(_) => "mode",
2016 Expression::First(_) => "first",
2017 Expression::Last(_) => "last",
2018 Expression::AnyValue(_) => "any_value",
2019 Expression::ApproxDistinct(_) => "approx_distinct",
2020 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2021 Expression::ApproxPercentile(_) => "approx_percentile",
2022 Expression::Percentile(_) => "percentile",
2023 Expression::LogicalAnd(_) => "logical_and",
2024 Expression::LogicalOr(_) => "logical_or",
2025 Expression::Skewness(_) => "skewness",
2026 Expression::BitwiseCount(_) => "bitwise_count",
2027 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2028 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2029 Expression::BoolXorAgg(_) => "bool_xor_agg",
2030 Expression::RowNumber(_) => "row_number",
2031 Expression::Rank(_) => "rank",
2032 Expression::DenseRank(_) => "dense_rank",
2033 Expression::NTile(_) => "n_tile",
2034 Expression::Lead(_) => "lead",
2035 Expression::Lag(_) => "lag",
2036 Expression::FirstValue(_) => "first_value",
2037 Expression::LastValue(_) => "last_value",
2038 Expression::NthValue(_) => "nth_value",
2039 Expression::PercentRank(_) => "percent_rank",
2040 Expression::CumeDist(_) => "cume_dist",
2041 Expression::PercentileCont(_) => "percentile_cont",
2042 Expression::PercentileDisc(_) => "percentile_disc",
2043 Expression::Contains(_) => "contains",
2044 Expression::StartsWith(_) => "starts_with",
2045 Expression::EndsWith(_) => "ends_with",
2046 Expression::Position(_) => "position",
2047 Expression::Initcap(_) => "initcap",
2048 Expression::Ascii(_) => "ascii",
2049 Expression::Chr(_) => "chr",
2050 Expression::CharFunc(_) => "char_func",
2051 Expression::Soundex(_) => "soundex",
2052 Expression::Levenshtein(_) => "levenshtein",
2053 Expression::ByteLength(_) => "byte_length",
2054 Expression::Hex(_) => "hex",
2055 Expression::LowerHex(_) => "lower_hex",
2056 Expression::Unicode(_) => "unicode",
2057 Expression::ModFunc(_) => "mod_func",
2058 Expression::Random(_) => "random",
2059 Expression::Rand(_) => "rand",
2060 Expression::TruncFunc(_) => "trunc_func",
2061 Expression::Pi(_) => "pi",
2062 Expression::Radians(_) => "radians",
2063 Expression::Degrees(_) => "degrees",
2064 Expression::Sin(_) => "sin",
2065 Expression::Cos(_) => "cos",
2066 Expression::Tan(_) => "tan",
2067 Expression::Asin(_) => "asin",
2068 Expression::Acos(_) => "acos",
2069 Expression::Atan(_) => "atan",
2070 Expression::Atan2(_) => "atan2",
2071 Expression::IsNan(_) => "is_nan",
2072 Expression::IsInf(_) => "is_inf",
2073 Expression::IntDiv(_) => "int_div",
2074 Expression::Decode(_) => "decode",
2075 Expression::DateFormat(_) => "date_format",
2076 Expression::FormatDate(_) => "format_date",
2077 Expression::Year(_) => "year",
2078 Expression::Month(_) => "month",
2079 Expression::Day(_) => "day",
2080 Expression::Hour(_) => "hour",
2081 Expression::Minute(_) => "minute",
2082 Expression::Second(_) => "second",
2083 Expression::DayOfWeek(_) => "day_of_week",
2084 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2085 Expression::DayOfMonth(_) => "day_of_month",
2086 Expression::DayOfYear(_) => "day_of_year",
2087 Expression::WeekOfYear(_) => "week_of_year",
2088 Expression::Quarter(_) => "quarter",
2089 Expression::AddMonths(_) => "add_months",
2090 Expression::MonthsBetween(_) => "months_between",
2091 Expression::LastDay(_) => "last_day",
2092 Expression::NextDay(_) => "next_day",
2093 Expression::Epoch(_) => "epoch",
2094 Expression::EpochMs(_) => "epoch_ms",
2095 Expression::FromUnixtime(_) => "from_unixtime",
2096 Expression::UnixTimestamp(_) => "unix_timestamp",
2097 Expression::MakeDate(_) => "make_date",
2098 Expression::MakeTimestamp(_) => "make_timestamp",
2099 Expression::TimestampTrunc(_) => "timestamp_trunc",
2100 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2101 Expression::SessionUser(_) => "session_user",
2102 Expression::SHA(_) => "s_h_a",
2103 Expression::SHA1Digest(_) => "s_h_a1_digest",
2104 Expression::TimeToUnix(_) => "time_to_unix",
2105 Expression::ArrayFunc(_) => "array_func",
2106 Expression::ArrayLength(_) => "array_length",
2107 Expression::ArraySize(_) => "array_size",
2108 Expression::Cardinality(_) => "cardinality",
2109 Expression::ArrayContains(_) => "array_contains",
2110 Expression::ArrayPosition(_) => "array_position",
2111 Expression::ArrayAppend(_) => "array_append",
2112 Expression::ArrayPrepend(_) => "array_prepend",
2113 Expression::ArrayConcat(_) => "array_concat",
2114 Expression::ArraySort(_) => "array_sort",
2115 Expression::ArrayReverse(_) => "array_reverse",
2116 Expression::ArrayDistinct(_) => "array_distinct",
2117 Expression::ArrayJoin(_) => "array_join",
2118 Expression::ArrayToString(_) => "array_to_string",
2119 Expression::Unnest(_) => "unnest",
2120 Expression::Explode(_) => "explode",
2121 Expression::ExplodeOuter(_) => "explode_outer",
2122 Expression::ArrayFilter(_) => "array_filter",
2123 Expression::ArrayTransform(_) => "array_transform",
2124 Expression::ArrayFlatten(_) => "array_flatten",
2125 Expression::ArrayCompact(_) => "array_compact",
2126 Expression::ArrayIntersect(_) => "array_intersect",
2127 Expression::ArrayUnion(_) => "array_union",
2128 Expression::ArrayExcept(_) => "array_except",
2129 Expression::ArrayRemove(_) => "array_remove",
2130 Expression::ArrayZip(_) => "array_zip",
2131 Expression::Sequence(_) => "sequence",
2132 Expression::Generate(_) => "generate",
2133 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2134 Expression::ToArray(_) => "to_array",
2135 Expression::StarMap(_) => "star_map",
2136 Expression::StructFunc(_) => "struct_func",
2137 Expression::StructExtract(_) => "struct_extract",
2138 Expression::NamedStruct(_) => "named_struct",
2139 Expression::MapFunc(_) => "map_func",
2140 Expression::MapFromEntries(_) => "map_from_entries",
2141 Expression::MapFromArrays(_) => "map_from_arrays",
2142 Expression::MapKeys(_) => "map_keys",
2143 Expression::MapValues(_) => "map_values",
2144 Expression::MapContainsKey(_) => "map_contains_key",
2145 Expression::MapConcat(_) => "map_concat",
2146 Expression::ElementAt(_) => "element_at",
2147 Expression::TransformKeys(_) => "transform_keys",
2148 Expression::TransformValues(_) => "transform_values",
2149 Expression::FunctionEmits(_) => "function_emits",
2150 Expression::JsonExtract(_) => "json_extract",
2151 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2152 Expression::JsonExtractPath(_) => "json_extract_path",
2153 Expression::JsonArray(_) => "json_array",
2154 Expression::JsonObject(_) => "json_object",
2155 Expression::JsonQuery(_) => "json_query",
2156 Expression::JsonValue(_) => "json_value",
2157 Expression::JsonArrayLength(_) => "json_array_length",
2158 Expression::JsonKeys(_) => "json_keys",
2159 Expression::JsonType(_) => "json_type",
2160 Expression::ParseJson(_) => "parse_json",
2161 Expression::ToJson(_) => "to_json",
2162 Expression::JsonSet(_) => "json_set",
2163 Expression::JsonInsert(_) => "json_insert",
2164 Expression::JsonRemove(_) => "json_remove",
2165 Expression::JsonMergePatch(_) => "json_merge_patch",
2166 Expression::JsonArrayAgg(_) => "json_array_agg",
2167 Expression::JsonObjectAgg(_) => "json_object_agg",
2168 Expression::Convert(_) => "convert",
2169 Expression::Typeof(_) => "typeof",
2170 Expression::Lambda(_) => "lambda",
2171 Expression::Parameter(_) => "parameter",
2172 Expression::Placeholder(_) => "placeholder",
2173 Expression::NamedArgument(_) => "named_argument",
2174 Expression::TableArgument(_) => "table_argument",
2175 Expression::SqlComment(_) => "sql_comment",
2176 Expression::NullSafeEq(_) => "null_safe_eq",
2177 Expression::NullSafeNeq(_) => "null_safe_neq",
2178 Expression::Glob(_) => "glob",
2179 Expression::SimilarTo(_) => "similar_to",
2180 Expression::Any(_) => "any",
2181 Expression::All(_) => "all",
2182 Expression::Overlaps(_) => "overlaps",
2183 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2184 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2185 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2186 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2187 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2188 Expression::Subscript(_) => "subscript",
2189 Expression::Dot(_) => "dot",
2190 Expression::MethodCall(_) => "method_call",
2191 Expression::ArraySlice(_) => "array_slice",
2192 Expression::CreateTable(_) => "create_table",
2193 Expression::DropTable(_) => "drop_table",
2194 Expression::Undrop(_) => "undrop",
2195 Expression::AlterTable(_) => "alter_table",
2196 Expression::CreateIndex(_) => "create_index",
2197 Expression::DropIndex(_) => "drop_index",
2198 Expression::CreateView(_) => "create_view",
2199 Expression::DropView(_) => "drop_view",
2200 Expression::AlterView(_) => "alter_view",
2201 Expression::AlterIndex(_) => "alter_index",
2202 Expression::Truncate(_) => "truncate",
2203 Expression::Use(_) => "use",
2204 Expression::Cache(_) => "cache",
2205 Expression::Uncache(_) => "uncache",
2206 Expression::LoadData(_) => "load_data",
2207 Expression::Pragma(_) => "pragma",
2208 Expression::Grant(_) => "grant",
2209 Expression::Revoke(_) => "revoke",
2210 Expression::Comment(_) => "comment",
2211 Expression::SetStatement(_) => "set_statement",
2212 Expression::CreateSchema(_) => "create_schema",
2213 Expression::DropSchema(_) => "drop_schema",
2214 Expression::DropNamespace(_) => "drop_namespace",
2215 Expression::CreateDatabase(_) => "create_database",
2216 Expression::DropDatabase(_) => "drop_database",
2217 Expression::CreateFunction(_) => "create_function",
2218 Expression::DropFunction(_) => "drop_function",
2219 Expression::CreateProcedure(_) => "create_procedure",
2220 Expression::DropProcedure(_) => "drop_procedure",
2221 Expression::CreateSequence(_) => "create_sequence",
2222 Expression::CreateSynonym(_) => "create_synonym",
2223 Expression::DropSequence(_) => "drop_sequence",
2224 Expression::AlterSequence(_) => "alter_sequence",
2225 Expression::CreateTrigger(_) => "create_trigger",
2226 Expression::DropTrigger(_) => "drop_trigger",
2227 Expression::CreateType(_) => "create_type",
2228 Expression::DropType(_) => "drop_type",
2229 Expression::Describe(_) => "describe",
2230 Expression::Show(_) => "show",
2231 Expression::Command(_) => "command",
2232 Expression::Kill(_) => "kill",
2233 Expression::Execute(_) => "execute",
2234 Expression::Raw(_) => "raw",
2235 Expression::CreateTask(_) => "create_task",
2236 Expression::Paren(_) => "paren",
2237 Expression::Annotated(_) => "annotated",
2238 Expression::Refresh(_) => "refresh",
2239 Expression::LockingStatement(_) => "locking_statement",
2240 Expression::SequenceProperties(_) => "sequence_properties",
2241 Expression::TruncateTable(_) => "truncate_table",
2242 Expression::Clone(_) => "clone",
2243 Expression::Attach(_) => "attach",
2244 Expression::Detach(_) => "detach",
2245 Expression::Install(_) => "install",
2246 Expression::Summarize(_) => "summarize",
2247 Expression::Declare(_) => "declare",
2248 Expression::DeclareItem(_) => "declare_item",
2249 Expression::Set(_) => "set",
2250 Expression::Heredoc(_) => "heredoc",
2251 Expression::SetItem(_) => "set_item",
2252 Expression::QueryBand(_) => "query_band",
2253 Expression::UserDefinedFunction(_) => "user_defined_function",
2254 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2255 Expression::ProjectionDef(_) => "projection_def",
2256 Expression::TableAlias(_) => "table_alias",
2257 Expression::ByteString(_) => "byte_string",
2258 Expression::HexStringExpr(_) => "hex_string_expr",
2259 Expression::UnicodeString(_) => "unicode_string",
2260 Expression::ColumnPosition(_) => "column_position",
2261 Expression::ColumnDef(_) => "column_def",
2262 Expression::AlterColumn(_) => "alter_column",
2263 Expression::AlterSortKey(_) => "alter_sort_key",
2264 Expression::AlterSet(_) => "alter_set",
2265 Expression::RenameColumn(_) => "rename_column",
2266 Expression::Comprehension(_) => "comprehension",
2267 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2268 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2269 Expression::IndexConstraintOption(_) => "index_constraint_option",
2270 Expression::ColumnConstraint(_) => "column_constraint",
2271 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2272 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2273 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2274 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2275 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2276 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2277 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2278 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2279 Expression::WithOperator(_) => "with_operator",
2280 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2281 "generated_as_identity_column_constraint"
2282 }
2283 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2284 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2285 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2286 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2287 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2288 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2289 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2290 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2291 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2292 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2293 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2294 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2295 Expression::PathColumnConstraint(_) => "path_column_constraint",
2296 Expression::Constraint(_) => "constraint",
2297 Expression::Export(_) => "export",
2298 Expression::Filter(_) => "filter",
2299 Expression::Changes(_) => "changes",
2300 Expression::CopyParameter(_) => "copy_parameter",
2301 Expression::Credentials(_) => "credentials",
2302 Expression::Directory(_) => "directory",
2303 Expression::ForeignKey(_) => "foreign_key",
2304 Expression::ColumnPrefix(_) => "column_prefix",
2305 Expression::PrimaryKey(_) => "primary_key",
2306 Expression::IntoClause(_) => "into_clause",
2307 Expression::JoinHint(_) => "join_hint",
2308 Expression::Opclass(_) => "opclass",
2309 Expression::Index(_) => "index",
2310 Expression::IndexParameters(_) => "index_parameters",
2311 Expression::ConditionalInsert(_) => "conditional_insert",
2312 Expression::MultitableInserts(_) => "multitable_inserts",
2313 Expression::OnConflict(_) => "on_conflict",
2314 Expression::OnCondition(_) => "on_condition",
2315 Expression::Returning(_) => "returning",
2316 Expression::Introducer(_) => "introducer",
2317 Expression::PartitionRange(_) => "partition_range",
2318 Expression::Fetch(_) => "fetch",
2319 Expression::Group(_) => "group",
2320 Expression::Cube(_) => "cube",
2321 Expression::Rollup(_) => "rollup",
2322 Expression::GroupingSets(_) => "grouping_sets",
2323 Expression::LimitOptions(_) => "limit_options",
2324 Expression::Lateral(_) => "lateral",
2325 Expression::TableFromRows(_) => "table_from_rows",
2326 Expression::RowsFrom(_) => "rows_from",
2327 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2328 Expression::WithFill(_) => "with_fill",
2329 Expression::Property(_) => "property",
2330 Expression::GrantPrivilege(_) => "grant_privilege",
2331 Expression::GrantPrincipal(_) => "grant_principal",
2332 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2333 Expression::AlgorithmProperty(_) => "algorithm_property",
2334 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2335 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2336 Expression::BackupProperty(_) => "backup_property",
2337 Expression::BuildProperty(_) => "build_property",
2338 Expression::BlockCompressionProperty(_) => "block_compression_property",
2339 Expression::CharacterSetProperty(_) => "character_set_property",
2340 Expression::ChecksumProperty(_) => "checksum_property",
2341 Expression::CollateProperty(_) => "collate_property",
2342 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2343 Expression::DataDeletionProperty(_) => "data_deletion_property",
2344 Expression::DefinerProperty(_) => "definer_property",
2345 Expression::DistKeyProperty(_) => "dist_key_property",
2346 Expression::DistributedByProperty(_) => "distributed_by_property",
2347 Expression::DistStyleProperty(_) => "dist_style_property",
2348 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2349 Expression::EngineProperty(_) => "engine_property",
2350 Expression::ToTableProperty(_) => "to_table_property",
2351 Expression::ExecuteAsProperty(_) => "execute_as_property",
2352 Expression::ExternalProperty(_) => "external_property",
2353 Expression::FallbackProperty(_) => "fallback_property",
2354 Expression::FileFormatProperty(_) => "file_format_property",
2355 Expression::CredentialsProperty(_) => "credentials_property",
2356 Expression::FreespaceProperty(_) => "freespace_property",
2357 Expression::InheritsProperty(_) => "inherits_property",
2358 Expression::InputModelProperty(_) => "input_model_property",
2359 Expression::OutputModelProperty(_) => "output_model_property",
2360 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2361 Expression::JournalProperty(_) => "journal_property",
2362 Expression::LanguageProperty(_) => "language_property",
2363 Expression::EnviromentProperty(_) => "enviroment_property",
2364 Expression::ClusteredByProperty(_) => "clustered_by_property",
2365 Expression::DictProperty(_) => "dict_property",
2366 Expression::DictRange(_) => "dict_range",
2367 Expression::OnCluster(_) => "on_cluster",
2368 Expression::LikeProperty(_) => "like_property",
2369 Expression::LocationProperty(_) => "location_property",
2370 Expression::LockProperty(_) => "lock_property",
2371 Expression::LockingProperty(_) => "locking_property",
2372 Expression::LogProperty(_) => "log_property",
2373 Expression::MaterializedProperty(_) => "materialized_property",
2374 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2375 Expression::OnProperty(_) => "on_property",
2376 Expression::OnCommitProperty(_) => "on_commit_property",
2377 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2378 Expression::PartitionByProperty(_) => "partition_by_property",
2379 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2380 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2381 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2382 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2383 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2384 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2385 Expression::PartitionList(_) => "partition_list",
2386 Expression::Partition(_) => "partition",
2387 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2388 Expression::UniqueKeyProperty(_) => "unique_key_property",
2389 Expression::RollupProperty(_) => "rollup_property",
2390 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2391 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2392 Expression::RemoteWithConnectionModelProperty(_) => {
2393 "remote_with_connection_model_property"
2394 }
2395 Expression::ReturnsProperty(_) => "returns_property",
2396 Expression::RowFormatProperty(_) => "row_format_property",
2397 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2398 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2399 Expression::QueryTransform(_) => "query_transform",
2400 Expression::SampleProperty(_) => "sample_property",
2401 Expression::SecurityProperty(_) => "security_property",
2402 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2403 Expression::SemanticView(_) => "semantic_view",
2404 Expression::SerdeProperties(_) => "serde_properties",
2405 Expression::SetProperty(_) => "set_property",
2406 Expression::SharingProperty(_) => "sharing_property",
2407 Expression::SetConfigProperty(_) => "set_config_property",
2408 Expression::SettingsProperty(_) => "settings_property",
2409 Expression::SortKeyProperty(_) => "sort_key_property",
2410 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2411 Expression::SqlSecurityProperty(_) => "sql_security_property",
2412 Expression::StabilityProperty(_) => "stability_property",
2413 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2414 Expression::TemporaryProperty(_) => "temporary_property",
2415 Expression::Tags(_) => "tags",
2416 Expression::TransformModelProperty(_) => "transform_model_property",
2417 Expression::TransientProperty(_) => "transient_property",
2418 Expression::UsingTemplateProperty(_) => "using_template_property",
2419 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2420 Expression::VolatileProperty(_) => "volatile_property",
2421 Expression::WithDataProperty(_) => "with_data_property",
2422 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2423 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2424 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2425 Expression::WithProcedureOptions(_) => "with_procedure_options",
2426 Expression::EncodeProperty(_) => "encode_property",
2427 Expression::IncludeProperty(_) => "include_property",
2428 Expression::Properties(_) => "properties",
2429 Expression::OptionsProperty(_) => "options_property",
2430 Expression::InputOutputFormat(_) => "input_output_format",
2431 Expression::Reference(_) => "reference",
2432 Expression::QueryOption(_) => "query_option",
2433 Expression::WithTableHint(_) => "with_table_hint",
2434 Expression::IndexTableHint(_) => "index_table_hint",
2435 Expression::HistoricalData(_) => "historical_data",
2436 Expression::Get(_) => "get",
2437 Expression::SetOperation(_) => "set_operation",
2438 Expression::Var(_) => "var",
2439 Expression::Variadic(_) => "variadic",
2440 Expression::Version(_) => "version",
2441 Expression::Schema(_) => "schema",
2442 Expression::Lock(_) => "lock",
2443 Expression::TableSample(_) => "table_sample",
2444 Expression::Tag(_) => "tag",
2445 Expression::UnpivotColumns(_) => "unpivot_columns",
2446 Expression::WindowSpec(_) => "window_spec",
2447 Expression::SessionParameter(_) => "session_parameter",
2448 Expression::PseudoType(_) => "pseudo_type",
2449 Expression::ObjectIdentifier(_) => "object_identifier",
2450 Expression::Transaction(_) => "transaction",
2451 Expression::Commit(_) => "commit",
2452 Expression::Rollback(_) => "rollback",
2453 Expression::AlterSession(_) => "alter_session",
2454 Expression::Analyze(_) => "analyze",
2455 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2456 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2457 Expression::AnalyzeSample(_) => "analyze_sample",
2458 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2459 Expression::AnalyzeDelete(_) => "analyze_delete",
2460 Expression::AnalyzeWith(_) => "analyze_with",
2461 Expression::AnalyzeValidate(_) => "analyze_validate",
2462 Expression::AddPartition(_) => "add_partition",
2463 Expression::AttachOption(_) => "attach_option",
2464 Expression::DropPartition(_) => "drop_partition",
2465 Expression::ReplacePartition(_) => "replace_partition",
2466 Expression::DPipe(_) => "d_pipe",
2467 Expression::Operator(_) => "operator",
2468 Expression::PivotAny(_) => "pivot_any",
2469 Expression::Aliases(_) => "aliases",
2470 Expression::AtIndex(_) => "at_index",
2471 Expression::FromTimeZone(_) => "from_time_zone",
2472 Expression::FormatPhrase(_) => "format_phrase",
2473 Expression::ForIn(_) => "for_in",
2474 Expression::TimeUnit(_) => "time_unit",
2475 Expression::IntervalOp(_) => "interval_op",
2476 Expression::IntervalSpan(_) => "interval_span",
2477 Expression::HavingMax(_) => "having_max",
2478 Expression::CosineDistance(_) => "cosine_distance",
2479 Expression::DotProduct(_) => "dot_product",
2480 Expression::EuclideanDistance(_) => "euclidean_distance",
2481 Expression::ManhattanDistance(_) => "manhattan_distance",
2482 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2483 Expression::Booland(_) => "booland",
2484 Expression::Boolor(_) => "boolor",
2485 Expression::ParameterizedAgg(_) => "parameterized_agg",
2486 Expression::ArgMax(_) => "arg_max",
2487 Expression::ArgMin(_) => "arg_min",
2488 Expression::ApproxTopK(_) => "approx_top_k",
2489 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2490 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2491 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2492 Expression::ApproxTopSum(_) => "approx_top_sum",
2493 Expression::ApproxQuantiles(_) => "approx_quantiles",
2494 Expression::Minhash(_) => "minhash",
2495 Expression::FarmFingerprint(_) => "farm_fingerprint",
2496 Expression::Float64(_) => "float64",
2497 Expression::Transform(_) => "transform",
2498 Expression::Translate(_) => "translate",
2499 Expression::Grouping(_) => "grouping",
2500 Expression::GroupingId(_) => "grouping_id",
2501 Expression::Anonymous(_) => "anonymous",
2502 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2503 Expression::CombinedAggFunc(_) => "combined_agg_func",
2504 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2505 Expression::HashAgg(_) => "hash_agg",
2506 Expression::Hll(_) => "hll",
2507 Expression::Apply(_) => "apply",
2508 Expression::ToBoolean(_) => "to_boolean",
2509 Expression::List(_) => "list",
2510 Expression::ToMap(_) => "to_map",
2511 Expression::Pad(_) => "pad",
2512 Expression::ToChar(_) => "to_char",
2513 Expression::ToNumber(_) => "to_number",
2514 Expression::ToDouble(_) => "to_double",
2515 Expression::Int64(_) => "int64",
2516 Expression::StringFunc(_) => "string_func",
2517 Expression::ToDecfloat(_) => "to_decfloat",
2518 Expression::TryToDecfloat(_) => "try_to_decfloat",
2519 Expression::ToFile(_) => "to_file",
2520 Expression::Columns(_) => "columns",
2521 Expression::ConvertToCharset(_) => "convert_to_charset",
2522 Expression::ConvertTimezone(_) => "convert_timezone",
2523 Expression::GenerateSeries(_) => "generate_series",
2524 Expression::AIAgg(_) => "a_i_agg",
2525 Expression::AIClassify(_) => "a_i_classify",
2526 Expression::ArrayAll(_) => "array_all",
2527 Expression::ArrayAny(_) => "array_any",
2528 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2529 Expression::StPoint(_) => "st_point",
2530 Expression::StDistance(_) => "st_distance",
2531 Expression::StringToArray(_) => "string_to_array",
2532 Expression::ArraySum(_) => "array_sum",
2533 Expression::ObjectAgg(_) => "object_agg",
2534 Expression::CastToStrType(_) => "cast_to_str_type",
2535 Expression::CheckJson(_) => "check_json",
2536 Expression::CheckXml(_) => "check_xml",
2537 Expression::TranslateCharacters(_) => "translate_characters",
2538 Expression::CurrentSchemas(_) => "current_schemas",
2539 Expression::CurrentDatetime(_) => "current_datetime",
2540 Expression::Localtime(_) => "localtime",
2541 Expression::Localtimestamp(_) => "localtimestamp",
2542 Expression::Systimestamp(_) => "systimestamp",
2543 Expression::CurrentSchema(_) => "current_schema",
2544 Expression::CurrentUser(_) => "current_user",
2545 Expression::UtcTime(_) => "utc_time",
2546 Expression::UtcTimestamp(_) => "utc_timestamp",
2547 Expression::Timestamp(_) => "timestamp",
2548 Expression::DateBin(_) => "date_bin",
2549 Expression::Datetime(_) => "datetime",
2550 Expression::DatetimeAdd(_) => "datetime_add",
2551 Expression::DatetimeSub(_) => "datetime_sub",
2552 Expression::DatetimeDiff(_) => "datetime_diff",
2553 Expression::DatetimeTrunc(_) => "datetime_trunc",
2554 Expression::Dayname(_) => "dayname",
2555 Expression::MakeInterval(_) => "make_interval",
2556 Expression::PreviousDay(_) => "previous_day",
2557 Expression::Elt(_) => "elt",
2558 Expression::TimestampAdd(_) => "timestamp_add",
2559 Expression::TimestampSub(_) => "timestamp_sub",
2560 Expression::TimestampDiff(_) => "timestamp_diff",
2561 Expression::TimeSlice(_) => "time_slice",
2562 Expression::TimeAdd(_) => "time_add",
2563 Expression::TimeSub(_) => "time_sub",
2564 Expression::TimeDiff(_) => "time_diff",
2565 Expression::TimeTrunc(_) => "time_trunc",
2566 Expression::DateFromParts(_) => "date_from_parts",
2567 Expression::TimeFromParts(_) => "time_from_parts",
2568 Expression::DecodeCase(_) => "decode_case",
2569 Expression::Decrypt(_) => "decrypt",
2570 Expression::DecryptRaw(_) => "decrypt_raw",
2571 Expression::Encode(_) => "encode",
2572 Expression::Encrypt(_) => "encrypt",
2573 Expression::EncryptRaw(_) => "encrypt_raw",
2574 Expression::EqualNull(_) => "equal_null",
2575 Expression::ToBinary(_) => "to_binary",
2576 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2577 Expression::Base64DecodeString(_) => "base64_decode_string",
2578 Expression::Base64Encode(_) => "base64_encode",
2579 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2580 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2581 Expression::GapFill(_) => "gap_fill",
2582 Expression::GenerateDateArray(_) => "generate_date_array",
2583 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2584 Expression::GetExtract(_) => "get_extract",
2585 Expression::Getbit(_) => "getbit",
2586 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2587 Expression::HexEncode(_) => "hex_encode",
2588 Expression::Compress(_) => "compress",
2589 Expression::DecompressBinary(_) => "decompress_binary",
2590 Expression::DecompressString(_) => "decompress_string",
2591 Expression::Xor(_) => "xor",
2592 Expression::Nullif(_) => "nullif",
2593 Expression::JSON(_) => "j_s_o_n",
2594 Expression::JSONPath(_) => "j_s_o_n_path",
2595 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2596 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2597 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2598 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2599 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2600 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2601 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2602 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2603 Expression::Format(_) => "format",
2604 Expression::JSONKeys(_) => "j_s_o_n_keys",
2605 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2606 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2607 Expression::JSONObject(_) => "j_s_o_n_object",
2608 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2609 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2610 Expression::JSONArray(_) => "j_s_o_n_array",
2611 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2612 Expression::JSONExists(_) => "j_s_o_n_exists",
2613 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2614 Expression::JSONSchema(_) => "j_s_o_n_schema",
2615 Expression::JSONSet(_) => "j_s_o_n_set",
2616 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2617 Expression::JSONValue(_) => "j_s_o_n_value",
2618 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2619 Expression::JSONRemove(_) => "j_s_o_n_remove",
2620 Expression::JSONTable(_) => "j_s_o_n_table",
2621 Expression::JSONType(_) => "j_s_o_n_type",
2622 Expression::ObjectInsert(_) => "object_insert",
2623 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2624 Expression::OpenJSON(_) => "open_j_s_o_n",
2625 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2626 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2627 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2628 Expression::JSONCast(_) => "j_s_o_n_cast",
2629 Expression::JSONExtract(_) => "j_s_o_n_extract",
2630 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2631 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2632 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2633 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2634 Expression::JSONFormat(_) => "j_s_o_n_format",
2635 Expression::JSONBool(_) => "j_s_o_n_bool",
2636 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2637 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2638 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2639 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2640 Expression::ParseJSON(_) => "parse_j_s_o_n",
2641 Expression::ParseUrl(_) => "parse_url",
2642 Expression::ParseIp(_) => "parse_ip",
2643 Expression::ParseTime(_) => "parse_time",
2644 Expression::ParseDatetime(_) => "parse_datetime",
2645 Expression::Map(_) => "map",
2646 Expression::MapCat(_) => "map_cat",
2647 Expression::MapDelete(_) => "map_delete",
2648 Expression::MapInsert(_) => "map_insert",
2649 Expression::MapPick(_) => "map_pick",
2650 Expression::ScopeResolution(_) => "scope_resolution",
2651 Expression::Slice(_) => "slice",
2652 Expression::VarMap(_) => "var_map",
2653 Expression::MatchAgainst(_) => "match_against",
2654 Expression::MD5Digest(_) => "m_d5_digest",
2655 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2656 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2657 Expression::Monthname(_) => "monthname",
2658 Expression::Ntile(_) => "ntile",
2659 Expression::Normalize(_) => "normalize",
2660 Expression::Normal(_) => "normal",
2661 Expression::Predict(_) => "predict",
2662 Expression::MLTranslate(_) => "m_l_translate",
2663 Expression::FeaturesAtTime(_) => "features_at_time",
2664 Expression::GenerateEmbedding(_) => "generate_embedding",
2665 Expression::MLForecast(_) => "m_l_forecast",
2666 Expression::ModelAttribute(_) => "model_attribute",
2667 Expression::VectorSearch(_) => "vector_search",
2668 Expression::Quantile(_) => "quantile",
2669 Expression::ApproxQuantile(_) => "approx_quantile",
2670 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2671 Expression::Randn(_) => "randn",
2672 Expression::Randstr(_) => "randstr",
2673 Expression::RangeN(_) => "range_n",
2674 Expression::RangeBucket(_) => "range_bucket",
2675 Expression::ReadCSV(_) => "read_c_s_v",
2676 Expression::ReadParquet(_) => "read_parquet",
2677 Expression::Reduce(_) => "reduce",
2678 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2679 Expression::RegexpILike(_) => "regexp_i_like",
2680 Expression::RegexpFullMatch(_) => "regexp_full_match",
2681 Expression::RegexpInstr(_) => "regexp_instr",
2682 Expression::RegexpSplit(_) => "regexp_split",
2683 Expression::RegexpCount(_) => "regexp_count",
2684 Expression::RegrValx(_) => "regr_valx",
2685 Expression::RegrValy(_) => "regr_valy",
2686 Expression::RegrAvgy(_) => "regr_avgy",
2687 Expression::RegrAvgx(_) => "regr_avgx",
2688 Expression::RegrCount(_) => "regr_count",
2689 Expression::RegrIntercept(_) => "regr_intercept",
2690 Expression::RegrR2(_) => "regr_r2",
2691 Expression::RegrSxx(_) => "regr_sxx",
2692 Expression::RegrSxy(_) => "regr_sxy",
2693 Expression::RegrSyy(_) => "regr_syy",
2694 Expression::RegrSlope(_) => "regr_slope",
2695 Expression::SafeAdd(_) => "safe_add",
2696 Expression::SafeDivide(_) => "safe_divide",
2697 Expression::SafeMultiply(_) => "safe_multiply",
2698 Expression::SafeSubtract(_) => "safe_subtract",
2699 Expression::SHA2(_) => "s_h_a2",
2700 Expression::SHA2Digest(_) => "s_h_a2_digest",
2701 Expression::SortArray(_) => "sort_array",
2702 Expression::SplitPart(_) => "split_part",
2703 Expression::SubstringIndex(_) => "substring_index",
2704 Expression::StandardHash(_) => "standard_hash",
2705 Expression::StrPosition(_) => "str_position",
2706 Expression::Search(_) => "search",
2707 Expression::SearchIp(_) => "search_ip",
2708 Expression::StrToDate(_) => "str_to_date",
2709 Expression::DateStrToDate(_) => "date_str_to_date",
2710 Expression::DateToDateStr(_) => "date_to_date_str",
2711 Expression::StrToTime(_) => "str_to_time",
2712 Expression::StrToUnix(_) => "str_to_unix",
2713 Expression::StrToMap(_) => "str_to_map",
2714 Expression::NumberToStr(_) => "number_to_str",
2715 Expression::FromBase(_) => "from_base",
2716 Expression::Stuff(_) => "stuff",
2717 Expression::TimeToStr(_) => "time_to_str",
2718 Expression::TimeStrToTime(_) => "time_str_to_time",
2719 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2720 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2721 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2722 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2723 Expression::Unhex(_) => "unhex",
2724 Expression::Uniform(_) => "uniform",
2725 Expression::UnixToStr(_) => "unix_to_str",
2726 Expression::UnixToTime(_) => "unix_to_time",
2727 Expression::Uuid(_) => "uuid",
2728 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2729 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2730 Expression::Corr(_) => "corr",
2731 Expression::WidthBucket(_) => "width_bucket",
2732 Expression::CovarSamp(_) => "covar_samp",
2733 Expression::CovarPop(_) => "covar_pop",
2734 Expression::Week(_) => "week",
2735 Expression::XMLElement(_) => "x_m_l_element",
2736 Expression::XMLGet(_) => "x_m_l_get",
2737 Expression::XMLTable(_) => "x_m_l_table",
2738 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2739 Expression::Zipf(_) => "zipf",
2740 Expression::Merge(_) => "merge",
2741 Expression::When(_) => "when",
2742 Expression::Whens(_) => "whens",
2743 Expression::NextValueFor(_) => "next_value_for",
2744 Expression::ReturnStmt(_) => "return_stmt",
2745 }
2746 }
2747
2748 pub fn get_this(&self) -> Option<&Expression> {
2750 match self {
2751 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2753 Expression::Upper(f)
2755 | Expression::Lower(f)
2756 | Expression::Length(f)
2757 | Expression::LTrim(f)
2758 | Expression::RTrim(f)
2759 | Expression::Reverse(f)
2760 | Expression::Abs(f)
2761 | Expression::Sqrt(f)
2762 | Expression::Cbrt(f)
2763 | Expression::Ln(f)
2764 | Expression::Exp(f)
2765 | Expression::Sign(f)
2766 | Expression::Date(f)
2767 | Expression::Time(f)
2768 | Expression::Initcap(f)
2769 | Expression::Ascii(f)
2770 | Expression::Chr(f)
2771 | Expression::Soundex(f)
2772 | Expression::ByteLength(f)
2773 | Expression::Hex(f)
2774 | Expression::LowerHex(f)
2775 | Expression::Unicode(f)
2776 | Expression::Typeof(f)
2777 | Expression::Explode(f)
2778 | Expression::ExplodeOuter(f)
2779 | Expression::MapFromEntries(f)
2780 | Expression::MapKeys(f)
2781 | Expression::MapValues(f)
2782 | Expression::ArrayLength(f)
2783 | Expression::ArraySize(f)
2784 | Expression::Cardinality(f)
2785 | Expression::ArrayReverse(f)
2786 | Expression::ArrayDistinct(f)
2787 | Expression::ArrayFlatten(f)
2788 | Expression::ArrayCompact(f)
2789 | Expression::ToArray(f)
2790 | Expression::JsonArrayLength(f)
2791 | Expression::JsonKeys(f)
2792 | Expression::JsonType(f)
2793 | Expression::ParseJson(f)
2794 | Expression::ToJson(f)
2795 | Expression::Radians(f)
2796 | Expression::Degrees(f)
2797 | Expression::Sin(f)
2798 | Expression::Cos(f)
2799 | Expression::Tan(f)
2800 | Expression::Asin(f)
2801 | Expression::Acos(f)
2802 | Expression::Atan(f)
2803 | Expression::IsNan(f)
2804 | Expression::IsInf(f)
2805 | Expression::Year(f)
2806 | Expression::Month(f)
2807 | Expression::Day(f)
2808 | Expression::Hour(f)
2809 | Expression::Minute(f)
2810 | Expression::Second(f)
2811 | Expression::DayOfWeek(f)
2812 | Expression::DayOfWeekIso(f)
2813 | Expression::DayOfMonth(f)
2814 | Expression::DayOfYear(f)
2815 | Expression::WeekOfYear(f)
2816 | Expression::Quarter(f)
2817 | Expression::Epoch(f)
2818 | Expression::EpochMs(f)
2819 | Expression::BitwiseCount(f)
2820 | Expression::DateFromUnixDate(f)
2821 | Expression::UnixDate(f)
2822 | Expression::UnixSeconds(f)
2823 | Expression::UnixMillis(f)
2824 | Expression::UnixMicros(f)
2825 | Expression::TimeStrToDate(f)
2826 | Expression::DateToDi(f)
2827 | Expression::DiToDate(f)
2828 | Expression::TsOrDiToDi(f)
2829 | Expression::TsOrDsToDatetime(f)
2830 | Expression::TsOrDsToTimestamp(f)
2831 | Expression::YearOfWeek(f)
2832 | Expression::YearOfWeekIso(f)
2833 | Expression::SHA(f)
2834 | Expression::SHA1Digest(f)
2835 | Expression::TimeToUnix(f)
2836 | Expression::TimeStrToUnix(f)
2837 | Expression::Int64(f)
2838 | Expression::JSONBool(f)
2839 | Expression::MD5NumberLower64(f)
2840 | Expression::MD5NumberUpper64(f)
2841 | Expression::DateStrToDate(f)
2842 | Expression::DateToDateStr(f) => Some(&f.this),
2843 Expression::Power(f)
2845 | Expression::NullIf(f)
2846 | Expression::IfNull(f)
2847 | Expression::Nvl(f)
2848 | Expression::Contains(f)
2849 | Expression::StartsWith(f)
2850 | Expression::EndsWith(f)
2851 | Expression::Levenshtein(f)
2852 | Expression::ModFunc(f)
2853 | Expression::IntDiv(f)
2854 | Expression::Atan2(f)
2855 | Expression::AddMonths(f)
2856 | Expression::MonthsBetween(f)
2857 | Expression::NextDay(f)
2858 | Expression::UnixToTimeStr(f)
2859 | Expression::ArrayContains(f)
2860 | Expression::ArrayPosition(f)
2861 | Expression::ArrayAppend(f)
2862 | Expression::ArrayPrepend(f)
2863 | Expression::ArrayUnion(f)
2864 | Expression::ArrayExcept(f)
2865 | Expression::ArrayRemove(f)
2866 | Expression::StarMap(f)
2867 | Expression::MapFromArrays(f)
2868 | Expression::MapContainsKey(f)
2869 | Expression::ElementAt(f)
2870 | Expression::JsonMergePatch(f)
2871 | Expression::JSONBContains(f)
2872 | Expression::JSONBExtract(f) => Some(&f.this),
2873 Expression::Sum(af)
2875 | Expression::Avg(af)
2876 | Expression::Min(af)
2877 | Expression::Max(af)
2878 | Expression::ArrayAgg(af)
2879 | Expression::CountIf(af)
2880 | Expression::Stddev(af)
2881 | Expression::StddevPop(af)
2882 | Expression::StddevSamp(af)
2883 | Expression::Variance(af)
2884 | Expression::VarPop(af)
2885 | Expression::VarSamp(af)
2886 | Expression::Median(af)
2887 | Expression::Mode(af)
2888 | Expression::First(af)
2889 | Expression::Last(af)
2890 | Expression::AnyValue(af)
2891 | Expression::ApproxDistinct(af)
2892 | Expression::ApproxCountDistinct(af)
2893 | Expression::LogicalAnd(af)
2894 | Expression::LogicalOr(af)
2895 | Expression::Skewness(af)
2896 | Expression::ArrayConcatAgg(af)
2897 | Expression::ArrayUniqueAgg(af)
2898 | Expression::BoolXorAgg(af)
2899 | Expression::BitwiseAndAgg(af)
2900 | Expression::BitwiseOrAgg(af)
2901 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2902 Expression::And(op)
2904 | Expression::Or(op)
2905 | Expression::Add(op)
2906 | Expression::Sub(op)
2907 | Expression::Mul(op)
2908 | Expression::Div(op)
2909 | Expression::Mod(op)
2910 | Expression::Eq(op)
2911 | Expression::Neq(op)
2912 | Expression::Lt(op)
2913 | Expression::Lte(op)
2914 | Expression::Gt(op)
2915 | Expression::Gte(op)
2916 | Expression::BitwiseAnd(op)
2917 | Expression::BitwiseOr(op)
2918 | Expression::BitwiseXor(op)
2919 | Expression::Concat(op)
2920 | Expression::Adjacent(op)
2921 | Expression::TsMatch(op)
2922 | Expression::PropertyEQ(op)
2923 | Expression::ArrayContainsAll(op)
2924 | Expression::ArrayContainedBy(op)
2925 | Expression::ArrayOverlaps(op)
2926 | Expression::JSONBContainsAllTopKeys(op)
2927 | Expression::JSONBContainsAnyTopKeys(op)
2928 | Expression::JSONBDeleteAtPath(op)
2929 | Expression::ExtendsLeft(op)
2930 | Expression::ExtendsRight(op)
2931 | Expression::Is(op)
2932 | Expression::MemberOf(op)
2933 | Expression::Match(op)
2934 | Expression::NullSafeEq(op)
2935 | Expression::NullSafeNeq(op)
2936 | Expression::Glob(op)
2937 | Expression::BitwiseLeftShift(op)
2938 | Expression::BitwiseRightShift(op) => Some(&op.left),
2939 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2941 Expression::Alias(a) => Some(&a.this),
2943 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2944 Expression::Paren(p) => Some(&p.this),
2945 Expression::Annotated(a) => Some(&a.this),
2946 Expression::Subquery(s) => Some(&s.this),
2947 Expression::Where(w) => Some(&w.this),
2948 Expression::Having(h) => Some(&h.this),
2949 Expression::Qualify(q) => Some(&q.this),
2950 Expression::IsNull(i) => Some(&i.this),
2951 Expression::Exists(e) => Some(&e.this),
2952 Expression::Ordered(o) => Some(&o.this),
2953 Expression::WindowFunction(wf) => Some(&wf.this),
2954 Expression::Cte(cte) => Some(&cte.this),
2955 Expression::Between(b) => Some(&b.this),
2956 Expression::In(i) => Some(&i.this),
2957 Expression::ReturnStmt(e) => Some(e),
2958 _ => None,
2959 }
2960 }
2961
2962 pub fn get_expression(&self) -> Option<&Expression> {
2964 match self {
2965 Expression::And(op)
2967 | Expression::Or(op)
2968 | Expression::Add(op)
2969 | Expression::Sub(op)
2970 | Expression::Mul(op)
2971 | Expression::Div(op)
2972 | Expression::Mod(op)
2973 | Expression::Eq(op)
2974 | Expression::Neq(op)
2975 | Expression::Lt(op)
2976 | Expression::Lte(op)
2977 | Expression::Gt(op)
2978 | Expression::Gte(op)
2979 | Expression::BitwiseAnd(op)
2980 | Expression::BitwiseOr(op)
2981 | Expression::BitwiseXor(op)
2982 | Expression::Concat(op)
2983 | Expression::Adjacent(op)
2984 | Expression::TsMatch(op)
2985 | Expression::PropertyEQ(op)
2986 | Expression::ArrayContainsAll(op)
2987 | Expression::ArrayContainedBy(op)
2988 | Expression::ArrayOverlaps(op)
2989 | Expression::JSONBContainsAllTopKeys(op)
2990 | Expression::JSONBContainsAnyTopKeys(op)
2991 | Expression::JSONBDeleteAtPath(op)
2992 | Expression::ExtendsLeft(op)
2993 | Expression::ExtendsRight(op)
2994 | Expression::Is(op)
2995 | Expression::MemberOf(op)
2996 | Expression::Match(op)
2997 | Expression::NullSafeEq(op)
2998 | Expression::NullSafeNeq(op)
2999 | Expression::Glob(op)
3000 | Expression::BitwiseLeftShift(op)
3001 | Expression::BitwiseRightShift(op) => Some(&op.right),
3002 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3004 Expression::Power(f)
3006 | Expression::NullIf(f)
3007 | Expression::IfNull(f)
3008 | Expression::Nvl(f)
3009 | Expression::Contains(f)
3010 | Expression::StartsWith(f)
3011 | Expression::EndsWith(f)
3012 | Expression::Levenshtein(f)
3013 | Expression::ModFunc(f)
3014 | Expression::IntDiv(f)
3015 | Expression::Atan2(f)
3016 | Expression::AddMonths(f)
3017 | Expression::MonthsBetween(f)
3018 | Expression::NextDay(f)
3019 | Expression::UnixToTimeStr(f)
3020 | Expression::ArrayContains(f)
3021 | Expression::ArrayPosition(f)
3022 | Expression::ArrayAppend(f)
3023 | Expression::ArrayPrepend(f)
3024 | Expression::ArrayUnion(f)
3025 | Expression::ArrayExcept(f)
3026 | Expression::ArrayRemove(f)
3027 | Expression::StarMap(f)
3028 | Expression::MapFromArrays(f)
3029 | Expression::MapContainsKey(f)
3030 | Expression::ElementAt(f)
3031 | Expression::JsonMergePatch(f)
3032 | Expression::JSONBContains(f)
3033 | Expression::JSONBExtract(f) => Some(&f.expression),
3034 _ => None,
3035 }
3036 }
3037
3038 pub fn get_expressions(&self) -> &[Expression] {
3040 match self {
3041 Expression::Select(s) => &s.expressions,
3042 Expression::Function(f) => &f.args,
3043 Expression::AggregateFunction(f) => &f.args,
3044 Expression::From(f) => &f.expressions,
3045 Expression::GroupBy(g) => &g.expressions,
3046 Expression::In(i) => &i.expressions,
3047 Expression::Array(a) => &a.expressions,
3048 Expression::Tuple(t) => &t.expressions,
3049 Expression::Coalesce(f)
3050 | Expression::Greatest(f)
3051 | Expression::Least(f)
3052 | Expression::ArrayConcat(f)
3053 | Expression::ArrayIntersect(f)
3054 | Expression::ArrayZip(f)
3055 | Expression::MapConcat(f)
3056 | Expression::JsonArray(f) => &f.expressions,
3057 _ => &[],
3058 }
3059 }
3060
3061 pub fn get_name(&self) -> &str {
3063 match self {
3064 Expression::Identifier(id) => &id.name,
3065 Expression::Column(col) => &col.name.name,
3066 Expression::Table(t) => &t.name.name,
3067 Expression::Literal(lit) => lit.value_str(),
3068 Expression::Star(_) => "*",
3069 Expression::Function(f) => &f.name,
3070 Expression::AggregateFunction(f) => &f.name,
3071 Expression::Alias(a) => a.this.get_name(),
3072 Expression::Boolean(b) => {
3073 if b.value {
3074 "TRUE"
3075 } else {
3076 "FALSE"
3077 }
3078 }
3079 Expression::Null(_) => "NULL",
3080 _ => "",
3081 }
3082 }
3083
3084 pub fn get_alias(&self) -> &str {
3086 match self {
3087 Expression::Alias(a) => &a.alias.name,
3088 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3089 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3090 _ => "",
3091 }
3092 }
3093
3094 pub fn get_output_name(&self) -> &str {
3096 match self {
3097 Expression::Alias(a) => &a.alias.name,
3098 Expression::Column(c) => &c.name.name,
3099 Expression::Identifier(id) => &id.name,
3100 Expression::Literal(lit) => lit.value_str(),
3101 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3102 Expression::Star(_) => "*",
3103 _ => "",
3104 }
3105 }
3106
3107 pub fn get_comments(&self) -> Vec<&str> {
3109 match self {
3110 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3111 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3112 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3113 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3114 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3115 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3116 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3117 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3118 }
3119 Expression::And(op)
3120 | Expression::Or(op)
3121 | Expression::Add(op)
3122 | Expression::Sub(op)
3123 | Expression::Mul(op)
3124 | Expression::Div(op)
3125 | Expression::Mod(op)
3126 | Expression::Eq(op)
3127 | Expression::Neq(op)
3128 | Expression::Lt(op)
3129 | Expression::Lte(op)
3130 | Expression::Gt(op)
3131 | Expression::Gte(op)
3132 | Expression::Concat(op)
3133 | Expression::BitwiseAnd(op)
3134 | Expression::BitwiseOr(op)
3135 | Expression::BitwiseXor(op) => {
3136 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3137 }
3138 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3139 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3140 _ => Vec::new(),
3141 }
3142 }
3143}
3144
3145impl fmt::Display for Expression {
3146 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3147 match self {
3149 Expression::Literal(lit) => write!(f, "{}", lit),
3150 Expression::Identifier(id) => write!(f, "{}", id),
3151 Expression::Column(col) => write!(f, "{}", col),
3152 Expression::Star(_) => write!(f, "*"),
3153 Expression::Null(_) => write!(f, "NULL"),
3154 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3155 Expression::Select(_) => write!(f, "SELECT ..."),
3156 _ => write!(f, "{:?}", self),
3157 }
3158 }
3159}
3160
3161#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3171#[cfg_attr(feature = "bindings", derive(TS))]
3172#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3173pub enum Literal {
3174 String(String),
3176 Number(String),
3178 HexString(String),
3180 HexNumber(String),
3182 BitString(String),
3183 ByteString(String),
3185 NationalString(String),
3187 Date(String),
3189 Time(String),
3191 Timestamp(String),
3193 Datetime(String),
3195 TripleQuotedString(String, char),
3198 EscapeString(String),
3200 DollarString(String),
3202 RawString(String),
3206}
3207
3208impl Literal {
3209 pub fn value_str(&self) -> &str {
3211 match self {
3212 Literal::String(s)
3213 | Literal::Number(s)
3214 | Literal::HexString(s)
3215 | Literal::HexNumber(s)
3216 | Literal::BitString(s)
3217 | Literal::ByteString(s)
3218 | Literal::NationalString(s)
3219 | Literal::Date(s)
3220 | Literal::Time(s)
3221 | Literal::Timestamp(s)
3222 | Literal::Datetime(s)
3223 | Literal::EscapeString(s)
3224 | Literal::DollarString(s)
3225 | Literal::RawString(s) => s.as_str(),
3226 Literal::TripleQuotedString(s, _) => s.as_str(),
3227 }
3228 }
3229
3230 pub fn is_string(&self) -> bool {
3232 matches!(
3233 self,
3234 Literal::String(_)
3235 | Literal::NationalString(_)
3236 | Literal::EscapeString(_)
3237 | Literal::DollarString(_)
3238 | Literal::RawString(_)
3239 | Literal::TripleQuotedString(_, _)
3240 )
3241 }
3242
3243 pub fn is_number(&self) -> bool {
3245 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3246 }
3247}
3248
3249impl fmt::Display for Literal {
3250 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3251 match self {
3252 Literal::String(s) => write!(f, "'{}'", s),
3253 Literal::Number(n) => write!(f, "{}", n),
3254 Literal::HexString(h) => write!(f, "X'{}'", h),
3255 Literal::HexNumber(h) => write!(f, "0x{}", h),
3256 Literal::BitString(b) => write!(f, "B'{}'", b),
3257 Literal::ByteString(b) => write!(f, "b'{}'", b),
3258 Literal::NationalString(s) => write!(f, "N'{}'", s),
3259 Literal::Date(d) => write!(f, "DATE '{}'", d),
3260 Literal::Time(t) => write!(f, "TIME '{}'", t),
3261 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3262 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3263 Literal::TripleQuotedString(s, q) => {
3264 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3265 }
3266 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3267 Literal::DollarString(s) => write!(f, "$${}$$", s),
3268 Literal::RawString(s) => write!(f, "r'{}'", s),
3269 }
3270 }
3271}
3272
3273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3275#[cfg_attr(feature = "bindings", derive(TS))]
3276pub struct BooleanLiteral {
3277 pub value: bool,
3278}
3279
3280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3282#[cfg_attr(feature = "bindings", derive(TS))]
3283pub struct Null;
3284
3285#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3292#[cfg_attr(feature = "bindings", derive(TS))]
3293pub struct Identifier {
3294 pub name: String,
3296 pub quoted: bool,
3298 #[serde(default)]
3299 pub trailing_comments: Vec<String>,
3300 #[serde(default, skip_serializing_if = "Option::is_none")]
3302 pub span: Option<Span>,
3303}
3304
3305impl Identifier {
3306 pub fn new(name: impl Into<String>) -> Self {
3307 Self {
3308 name: name.into(),
3309 quoted: false,
3310 trailing_comments: Vec::new(),
3311 span: None,
3312 }
3313 }
3314
3315 pub fn quoted(name: impl Into<String>) -> Self {
3316 Self {
3317 name: name.into(),
3318 quoted: true,
3319 trailing_comments: Vec::new(),
3320 span: None,
3321 }
3322 }
3323
3324 pub fn empty() -> Self {
3325 Self {
3326 name: String::new(),
3327 quoted: false,
3328 trailing_comments: Vec::new(),
3329 span: None,
3330 }
3331 }
3332
3333 pub fn is_empty(&self) -> bool {
3334 self.name.is_empty()
3335 }
3336
3337 pub fn with_span(mut self, span: Span) -> Self {
3339 self.span = Some(span);
3340 self
3341 }
3342}
3343
3344impl fmt::Display for Identifier {
3345 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3346 if self.quoted {
3347 write!(f, "\"{}\"", self.name)
3348 } else {
3349 write!(f, "{}", self.name)
3350 }
3351 }
3352}
3353
3354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3360#[cfg_attr(feature = "bindings", derive(TS))]
3361pub struct Column {
3362 pub name: Identifier,
3364 pub table: Option<Identifier>,
3366 #[serde(default)]
3368 pub join_mark: bool,
3369 #[serde(default)]
3371 pub trailing_comments: Vec<String>,
3372 #[serde(default, skip_serializing_if = "Option::is_none")]
3374 pub span: Option<Span>,
3375 #[serde(default, skip_serializing_if = "Option::is_none")]
3377 pub inferred_type: Option<DataType>,
3378}
3379
3380impl fmt::Display for Column {
3381 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3382 if let Some(table) = &self.table {
3383 write!(f, "{}.{}", table, self.name)
3384 } else {
3385 write!(f, "{}", self.name)
3386 }
3387 }
3388}
3389
3390#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3397#[cfg_attr(feature = "bindings", derive(TS))]
3398pub struct TableRef {
3399 pub name: Identifier,
3401 pub schema: Option<Identifier>,
3403 pub catalog: Option<Identifier>,
3405 pub alias: Option<Identifier>,
3407 #[serde(default)]
3409 pub alias_explicit_as: bool,
3410 #[serde(default)]
3412 pub column_aliases: Vec<Identifier>,
3413 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3415 pub leading_comments: Vec<String>,
3416 #[serde(default)]
3418 pub trailing_comments: Vec<String>,
3419 #[serde(default)]
3421 pub when: Option<Box<HistoricalData>>,
3422 #[serde(default)]
3424 pub only: bool,
3425 #[serde(default)]
3427 pub final_: bool,
3428 #[serde(default, skip_serializing_if = "Option::is_none")]
3430 pub table_sample: Option<Box<Sample>>,
3431 #[serde(default)]
3433 pub hints: Vec<Expression>,
3434 #[serde(default, skip_serializing_if = "Option::is_none")]
3437 pub system_time: Option<String>,
3438 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3440 pub partitions: Vec<Identifier>,
3441 #[serde(default, skip_serializing_if = "Option::is_none")]
3444 pub identifier_func: Option<Box<Expression>>,
3445 #[serde(default, skip_serializing_if = "Option::is_none")]
3447 pub changes: Option<Box<Changes>>,
3448 #[serde(default, skip_serializing_if = "Option::is_none")]
3450 pub version: Option<Box<Version>>,
3451 #[serde(default, skip_serializing_if = "Option::is_none")]
3453 pub span: Option<Span>,
3454}
3455
3456impl TableRef {
3457 pub fn new(name: impl Into<String>) -> Self {
3458 Self {
3459 name: Identifier::new(name),
3460 schema: None,
3461 catalog: None,
3462 alias: None,
3463 alias_explicit_as: false,
3464 column_aliases: Vec::new(),
3465 leading_comments: Vec::new(),
3466 trailing_comments: Vec::new(),
3467 when: None,
3468 only: false,
3469 final_: false,
3470 table_sample: None,
3471 hints: Vec::new(),
3472 system_time: None,
3473 partitions: Vec::new(),
3474 identifier_func: None,
3475 changes: None,
3476 version: None,
3477 span: None,
3478 }
3479 }
3480
3481 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3483 let mut t = Self::new(name);
3484 t.schema = Some(Identifier::new(schema));
3485 t
3486 }
3487
3488 pub fn new_with_catalog(
3490 name: impl Into<String>,
3491 schema: impl Into<String>,
3492 catalog: impl Into<String>,
3493 ) -> Self {
3494 let mut t = Self::new(name);
3495 t.schema = Some(Identifier::new(schema));
3496 t.catalog = Some(Identifier::new(catalog));
3497 t
3498 }
3499
3500 pub fn from_identifier(name: Identifier) -> Self {
3502 Self {
3503 name,
3504 schema: None,
3505 catalog: None,
3506 alias: None,
3507 alias_explicit_as: false,
3508 column_aliases: Vec::new(),
3509 leading_comments: Vec::new(),
3510 trailing_comments: Vec::new(),
3511 when: None,
3512 only: false,
3513 final_: false,
3514 table_sample: None,
3515 hints: Vec::new(),
3516 system_time: None,
3517 partitions: Vec::new(),
3518 identifier_func: None,
3519 changes: None,
3520 version: None,
3521 span: None,
3522 }
3523 }
3524
3525 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3526 self.alias = Some(Identifier::new(alias));
3527 self
3528 }
3529
3530 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3531 self.schema = Some(Identifier::new(schema));
3532 self
3533 }
3534}
3535
3536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3541#[cfg_attr(feature = "bindings", derive(TS))]
3542pub struct Star {
3543 pub table: Option<Identifier>,
3545 pub except: Option<Vec<Identifier>>,
3547 pub replace: Option<Vec<Alias>>,
3549 pub rename: Option<Vec<(Identifier, Identifier)>>,
3551 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3553 pub trailing_comments: Vec<String>,
3554 #[serde(default, skip_serializing_if = "Option::is_none")]
3556 pub span: Option<Span>,
3557}
3558
3559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3583#[cfg_attr(feature = "bindings", derive(TS))]
3584pub struct Select {
3585 pub expressions: Vec<Expression>,
3587 pub from: Option<From>,
3589 pub joins: Vec<Join>,
3591 pub lateral_views: Vec<LateralView>,
3592 #[serde(default, skip_serializing_if = "Option::is_none")]
3594 pub prewhere: Option<Expression>,
3595 pub where_clause: Option<Where>,
3596 pub group_by: Option<GroupBy>,
3597 pub having: Option<Having>,
3598 pub qualify: Option<Qualify>,
3599 pub order_by: Option<OrderBy>,
3600 pub distribute_by: Option<DistributeBy>,
3601 pub cluster_by: Option<ClusterBy>,
3602 pub sort_by: Option<SortBy>,
3603 pub limit: Option<Limit>,
3604 pub offset: Option<Offset>,
3605 #[serde(default, skip_serializing_if = "Option::is_none")]
3607 pub limit_by: Option<Vec<Expression>>,
3608 pub fetch: Option<Fetch>,
3609 pub distinct: bool,
3610 pub distinct_on: Option<Vec<Expression>>,
3611 pub top: Option<Top>,
3612 pub with: Option<With>,
3613 pub sample: Option<Sample>,
3614 #[serde(default, skip_serializing_if = "Option::is_none")]
3616 pub settings: Option<Vec<Expression>>,
3617 #[serde(default, skip_serializing_if = "Option::is_none")]
3619 pub format: Option<Expression>,
3620 pub windows: Option<Vec<NamedWindow>>,
3621 pub hint: Option<Hint>,
3622 pub connect: Option<Connect>,
3624 pub into: Option<SelectInto>,
3626 #[serde(default)]
3628 pub locks: Vec<Lock>,
3629 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3631 pub for_xml: Vec<Expression>,
3632 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3634 pub for_json: Vec<Expression>,
3635 #[serde(default)]
3637 pub leading_comments: Vec<String>,
3638 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3641 pub post_select_comments: Vec<String>,
3642 #[serde(default, skip_serializing_if = "Option::is_none")]
3644 pub kind: Option<String>,
3645 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3647 pub operation_modifiers: Vec<String>,
3648 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3650 pub qualify_after_window: bool,
3651 #[serde(default, skip_serializing_if = "Option::is_none")]
3653 pub option: Option<String>,
3654 #[serde(default, skip_serializing_if = "Option::is_none")]
3657 pub exclude: Option<Vec<Expression>>,
3658}
3659
3660impl Select {
3661 pub fn new() -> Self {
3662 Self {
3663 expressions: Vec::new(),
3664 from: None,
3665 joins: Vec::new(),
3666 lateral_views: Vec::new(),
3667 prewhere: None,
3668 where_clause: None,
3669 group_by: None,
3670 having: None,
3671 qualify: None,
3672 order_by: None,
3673 distribute_by: None,
3674 cluster_by: None,
3675 sort_by: None,
3676 limit: None,
3677 offset: None,
3678 limit_by: None,
3679 fetch: None,
3680 distinct: false,
3681 distinct_on: None,
3682 top: None,
3683 with: None,
3684 sample: None,
3685 settings: None,
3686 format: None,
3687 windows: None,
3688 hint: None,
3689 connect: None,
3690 into: None,
3691 locks: Vec::new(),
3692 for_xml: Vec::new(),
3693 for_json: Vec::new(),
3694 leading_comments: Vec::new(),
3695 post_select_comments: Vec::new(),
3696 kind: None,
3697 operation_modifiers: Vec::new(),
3698 qualify_after_window: false,
3699 option: None,
3700 exclude: None,
3701 }
3702 }
3703
3704 pub fn column(mut self, expr: Expression) -> Self {
3706 self.expressions.push(expr);
3707 self
3708 }
3709
3710 pub fn from(mut self, table: Expression) -> Self {
3712 self.from = Some(From {
3713 expressions: vec![table],
3714 });
3715 self
3716 }
3717
3718 pub fn where_(mut self, condition: Expression) -> Self {
3720 self.where_clause = Some(Where { this: condition });
3721 self
3722 }
3723
3724 pub fn distinct(mut self) -> Self {
3726 self.distinct = true;
3727 self
3728 }
3729
3730 pub fn join(mut self, join: Join) -> Self {
3732 self.joins.push(join);
3733 self
3734 }
3735
3736 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3738 self.order_by = Some(OrderBy {
3739 expressions,
3740 siblings: false,
3741 comments: Vec::new(),
3742 });
3743 self
3744 }
3745
3746 pub fn limit(mut self, n: Expression) -> Self {
3748 self.limit = Some(Limit {
3749 this: n,
3750 percent: false,
3751 comments: Vec::new(),
3752 });
3753 self
3754 }
3755
3756 pub fn offset(mut self, n: Expression) -> Self {
3758 self.offset = Some(Offset {
3759 this: n,
3760 rows: None,
3761 });
3762 self
3763 }
3764}
3765
3766impl Default for Select {
3767 fn default() -> Self {
3768 Self::new()
3769 }
3770}
3771
3772#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3778#[cfg_attr(feature = "bindings", derive(TS))]
3779pub struct Union {
3780 pub left: Expression,
3782 pub right: Expression,
3784 pub all: bool,
3786 #[serde(default)]
3788 pub distinct: bool,
3789 pub with: Option<With>,
3791 pub order_by: Option<OrderBy>,
3793 pub limit: Option<Box<Expression>>,
3795 pub offset: Option<Box<Expression>>,
3797 #[serde(default, skip_serializing_if = "Option::is_none")]
3799 pub distribute_by: Option<DistributeBy>,
3800 #[serde(default, skip_serializing_if = "Option::is_none")]
3802 pub sort_by: Option<SortBy>,
3803 #[serde(default, skip_serializing_if = "Option::is_none")]
3805 pub cluster_by: Option<ClusterBy>,
3806 #[serde(default)]
3808 pub by_name: bool,
3809 #[serde(default, skip_serializing_if = "Option::is_none")]
3811 pub side: Option<String>,
3812 #[serde(default, skip_serializing_if = "Option::is_none")]
3814 pub kind: Option<String>,
3815 #[serde(default)]
3817 pub corresponding: bool,
3818 #[serde(default)]
3820 pub strict: bool,
3821 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3823 pub on_columns: Vec<Expression>,
3824}
3825
3826impl Drop for Union {
3829 fn drop(&mut self) {
3830 loop {
3831 if let Expression::Union(ref mut inner) = self.left {
3832 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3833 let old_left = std::mem::replace(&mut self.left, next_left);
3834 drop(old_left);
3835 } else {
3836 break;
3837 }
3838 }
3839 }
3840}
3841
3842#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3847#[cfg_attr(feature = "bindings", derive(TS))]
3848pub struct Intersect {
3849 pub left: Expression,
3851 pub right: Expression,
3853 pub all: bool,
3855 #[serde(default)]
3857 pub distinct: bool,
3858 pub with: Option<With>,
3860 pub order_by: Option<OrderBy>,
3862 pub limit: Option<Box<Expression>>,
3864 pub offset: Option<Box<Expression>>,
3866 #[serde(default, skip_serializing_if = "Option::is_none")]
3868 pub distribute_by: Option<DistributeBy>,
3869 #[serde(default, skip_serializing_if = "Option::is_none")]
3871 pub sort_by: Option<SortBy>,
3872 #[serde(default, skip_serializing_if = "Option::is_none")]
3874 pub cluster_by: Option<ClusterBy>,
3875 #[serde(default)]
3877 pub by_name: bool,
3878 #[serde(default, skip_serializing_if = "Option::is_none")]
3880 pub side: Option<String>,
3881 #[serde(default, skip_serializing_if = "Option::is_none")]
3883 pub kind: Option<String>,
3884 #[serde(default)]
3886 pub corresponding: bool,
3887 #[serde(default)]
3889 pub strict: bool,
3890 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3892 pub on_columns: Vec<Expression>,
3893}
3894
3895impl Drop for Intersect {
3896 fn drop(&mut self) {
3897 loop {
3898 if let Expression::Intersect(ref mut inner) = self.left {
3899 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3900 let old_left = std::mem::replace(&mut self.left, next_left);
3901 drop(old_left);
3902 } else {
3903 break;
3904 }
3905 }
3906 }
3907}
3908
3909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3914#[cfg_attr(feature = "bindings", derive(TS))]
3915pub struct Except {
3916 pub left: Expression,
3918 pub right: Expression,
3920 pub all: bool,
3922 #[serde(default)]
3924 pub distinct: bool,
3925 pub with: Option<With>,
3927 pub order_by: Option<OrderBy>,
3929 pub limit: Option<Box<Expression>>,
3931 pub offset: Option<Box<Expression>>,
3933 #[serde(default, skip_serializing_if = "Option::is_none")]
3935 pub distribute_by: Option<DistributeBy>,
3936 #[serde(default, skip_serializing_if = "Option::is_none")]
3938 pub sort_by: Option<SortBy>,
3939 #[serde(default, skip_serializing_if = "Option::is_none")]
3941 pub cluster_by: Option<ClusterBy>,
3942 #[serde(default)]
3944 pub by_name: bool,
3945 #[serde(default, skip_serializing_if = "Option::is_none")]
3947 pub side: Option<String>,
3948 #[serde(default, skip_serializing_if = "Option::is_none")]
3950 pub kind: Option<String>,
3951 #[serde(default)]
3953 pub corresponding: bool,
3954 #[serde(default)]
3956 pub strict: bool,
3957 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3959 pub on_columns: Vec<Expression>,
3960}
3961
3962impl Drop for Except {
3963 fn drop(&mut self) {
3964 loop {
3965 if let Expression::Except(ref mut inner) = self.left {
3966 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3967 let old_left = std::mem::replace(&mut self.left, next_left);
3968 drop(old_left);
3969 } else {
3970 break;
3971 }
3972 }
3973 }
3974}
3975
3976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3978#[cfg_attr(feature = "bindings", derive(TS))]
3979pub struct SelectInto {
3980 pub this: Expression,
3982 #[serde(default)]
3984 pub temporary: bool,
3985 #[serde(default)]
3987 pub unlogged: bool,
3988 #[serde(default)]
3990 pub bulk_collect: bool,
3991 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3993 pub expressions: Vec<Expression>,
3994}
3995
3996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4006#[cfg_attr(feature = "bindings", derive(TS))]
4007pub struct Subquery {
4008 pub this: Expression,
4010 pub alias: Option<Identifier>,
4012 pub column_aliases: Vec<Identifier>,
4014 #[serde(default)]
4016 pub alias_explicit_as: bool,
4017 #[serde(skip_serializing_if = "Option::is_none", default)]
4019 pub alias_keyword: Option<String>,
4020 pub order_by: Option<OrderBy>,
4022 pub limit: Option<Limit>,
4024 pub offset: Option<Offset>,
4026 #[serde(default, skip_serializing_if = "Option::is_none")]
4028 pub distribute_by: Option<DistributeBy>,
4029 #[serde(default, skip_serializing_if = "Option::is_none")]
4031 pub sort_by: Option<SortBy>,
4032 #[serde(default, skip_serializing_if = "Option::is_none")]
4034 pub cluster_by: Option<ClusterBy>,
4035 #[serde(default)]
4037 pub lateral: bool,
4038 #[serde(default)]
4042 pub modifiers_inside: bool,
4043 #[serde(default)]
4045 pub trailing_comments: Vec<String>,
4046 #[serde(default, skip_serializing_if = "Option::is_none")]
4048 pub inferred_type: Option<DataType>,
4049}
4050
4051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4056#[cfg_attr(feature = "bindings", derive(TS))]
4057pub struct PipeOperator {
4058 pub this: Expression,
4060 pub expression: Expression,
4062}
4063
4064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4066#[cfg_attr(feature = "bindings", derive(TS))]
4067pub struct Values {
4068 pub expressions: Vec<Tuple>,
4070 pub alias: Option<Identifier>,
4072 pub column_aliases: Vec<Identifier>,
4074}
4075
4076#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4086#[cfg_attr(feature = "bindings", derive(TS))]
4087pub struct Pivot {
4088 pub this: Expression,
4090 #[serde(default)]
4093 pub expressions: Vec<Expression>,
4094 #[serde(default)]
4096 pub fields: Vec<Expression>,
4097 #[serde(default)]
4099 pub using: Vec<Expression>,
4100 #[serde(default)]
4102 pub group: Option<Box<Expression>>,
4103 #[serde(default)]
4105 pub unpivot: bool,
4106 #[serde(default)]
4108 pub into: Option<Box<Expression>>,
4109 #[serde(default)]
4111 pub alias: Option<Identifier>,
4112 #[serde(default)]
4114 pub include_nulls: Option<bool>,
4115 #[serde(default)]
4117 pub default_on_null: Option<Box<Expression>>,
4118 #[serde(default, skip_serializing_if = "Option::is_none")]
4120 pub with: Option<With>,
4121}
4122
4123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4125#[cfg_attr(feature = "bindings", derive(TS))]
4126pub struct Unpivot {
4127 pub this: Expression,
4128 pub value_column: Identifier,
4129 pub name_column: Identifier,
4130 pub columns: Vec<Expression>,
4131 pub alias: Option<Identifier>,
4132 #[serde(default)]
4134 pub value_column_parenthesized: bool,
4135 #[serde(default)]
4137 pub include_nulls: Option<bool>,
4138 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4140 pub extra_value_columns: Vec<Identifier>,
4141}
4142
4143#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4146#[cfg_attr(feature = "bindings", derive(TS))]
4147pub struct PivotAlias {
4148 pub this: Expression,
4149 pub alias: Expression,
4150}
4151
4152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4154#[cfg_attr(feature = "bindings", derive(TS))]
4155pub struct PreWhere {
4156 pub this: Expression,
4157}
4158
4159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4161#[cfg_attr(feature = "bindings", derive(TS))]
4162pub struct Stream {
4163 pub this: Expression,
4164 #[serde(skip_serializing_if = "Option::is_none")]
4165 pub on: Option<Expression>,
4166 #[serde(skip_serializing_if = "Option::is_none")]
4167 pub show_initial_rows: Option<bool>,
4168}
4169
4170#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4172#[cfg_attr(feature = "bindings", derive(TS))]
4173pub struct UsingData {
4174 pub this: Expression,
4175}
4176
4177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4179#[cfg_attr(feature = "bindings", derive(TS))]
4180pub struct XmlNamespace {
4181 pub this: Expression,
4182 #[serde(skip_serializing_if = "Option::is_none")]
4183 pub alias: Option<Identifier>,
4184}
4185
4186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4188#[cfg_attr(feature = "bindings", derive(TS))]
4189pub struct RowFormat {
4190 pub delimited: bool,
4191 pub fields_terminated_by: Option<String>,
4192 pub collection_items_terminated_by: Option<String>,
4193 pub map_keys_terminated_by: Option<String>,
4194 pub lines_terminated_by: Option<String>,
4195 pub null_defined_as: Option<String>,
4196}
4197
4198#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4200#[cfg_attr(feature = "bindings", derive(TS))]
4201pub struct DirectoryInsert {
4202 pub local: bool,
4203 pub path: String,
4204 pub row_format: Option<RowFormat>,
4205 #[serde(default)]
4207 pub stored_as: Option<String>,
4208}
4209
4210#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4212#[cfg_attr(feature = "bindings", derive(TS))]
4213pub struct Insert {
4214 pub table: TableRef,
4215 pub columns: Vec<Identifier>,
4216 pub values: Vec<Vec<Expression>>,
4217 pub query: Option<Expression>,
4218 pub overwrite: bool,
4220 pub partition: Vec<(Identifier, Option<Expression>)>,
4222 #[serde(default)]
4224 pub directory: Option<DirectoryInsert>,
4225 #[serde(default)]
4227 pub returning: Vec<Expression>,
4228 #[serde(default)]
4230 pub output: Option<OutputClause>,
4231 #[serde(default)]
4233 pub on_conflict: Option<Box<Expression>>,
4234 #[serde(default)]
4236 pub leading_comments: Vec<String>,
4237 #[serde(default)]
4239 pub if_exists: bool,
4240 #[serde(default)]
4242 pub with: Option<With>,
4243 #[serde(default)]
4245 pub ignore: bool,
4246 #[serde(default)]
4248 pub source_alias: Option<Identifier>,
4249 #[serde(default)]
4251 pub alias: Option<Identifier>,
4252 #[serde(default)]
4254 pub alias_explicit_as: bool,
4255 #[serde(default)]
4257 pub default_values: bool,
4258 #[serde(default)]
4260 pub by_name: bool,
4261 #[serde(default, skip_serializing_if = "Option::is_none")]
4263 pub conflict_action: Option<String>,
4264 #[serde(default)]
4266 pub is_replace: bool,
4267 #[serde(default, skip_serializing_if = "Option::is_none")]
4269 pub hint: Option<Hint>,
4270 #[serde(default)]
4272 pub replace_where: Option<Box<Expression>>,
4273 #[serde(default)]
4275 pub source: Option<Box<Expression>>,
4276 #[serde(default, skip_serializing_if = "Option::is_none")]
4278 pub function_target: Option<Box<Expression>>,
4279 #[serde(default, skip_serializing_if = "Option::is_none")]
4281 pub partition_by: Option<Box<Expression>>,
4282 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4284 pub settings: Vec<Expression>,
4285}
4286
4287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4289#[cfg_attr(feature = "bindings", derive(TS))]
4290pub struct OutputClause {
4291 pub columns: Vec<Expression>,
4293 #[serde(default)]
4295 pub into_table: Option<Expression>,
4296}
4297
4298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4300#[cfg_attr(feature = "bindings", derive(TS))]
4301pub struct Update {
4302 pub table: TableRef,
4303 #[serde(default)]
4304 pub hint: Option<Hint>,
4305 #[serde(default)]
4307 pub extra_tables: Vec<TableRef>,
4308 #[serde(default)]
4310 pub table_joins: Vec<Join>,
4311 pub set: Vec<(Identifier, Expression)>,
4312 pub from_clause: Option<From>,
4313 #[serde(default)]
4315 pub from_joins: Vec<Join>,
4316 pub where_clause: Option<Where>,
4317 #[serde(default)]
4319 pub returning: Vec<Expression>,
4320 #[serde(default)]
4322 pub output: Option<OutputClause>,
4323 #[serde(default)]
4325 pub with: Option<With>,
4326 #[serde(default)]
4328 pub leading_comments: Vec<String>,
4329 #[serde(default)]
4331 pub limit: Option<Expression>,
4332 #[serde(default)]
4334 pub order_by: Option<OrderBy>,
4335 #[serde(default)]
4337 pub from_before_set: bool,
4338}
4339
4340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4342#[cfg_attr(feature = "bindings", derive(TS))]
4343pub struct Delete {
4344 pub table: TableRef,
4345 #[serde(default)]
4346 pub hint: Option<Hint>,
4347 #[serde(default, skip_serializing_if = "Option::is_none")]
4349 pub on_cluster: Option<OnCluster>,
4350 pub alias: Option<Identifier>,
4352 #[serde(default)]
4354 pub alias_explicit_as: bool,
4355 pub using: Vec<TableRef>,
4357 pub where_clause: Option<Where>,
4358 #[serde(default)]
4360 pub output: Option<OutputClause>,
4361 #[serde(default)]
4363 pub leading_comments: Vec<String>,
4364 #[serde(default)]
4366 pub with: Option<With>,
4367 #[serde(default)]
4369 pub limit: Option<Expression>,
4370 #[serde(default)]
4372 pub order_by: Option<OrderBy>,
4373 #[serde(default)]
4375 pub returning: Vec<Expression>,
4376 #[serde(default)]
4379 pub tables: Vec<TableRef>,
4380 #[serde(default)]
4383 pub tables_from_using: bool,
4384 #[serde(default)]
4386 pub joins: Vec<Join>,
4387 #[serde(default)]
4389 pub force_index: Option<String>,
4390 #[serde(default)]
4392 pub no_from: bool,
4393}
4394
4395#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4397#[cfg_attr(feature = "bindings", derive(TS))]
4398pub struct CopyStmt {
4399 pub this: Expression,
4401 pub kind: bool,
4403 pub files: Vec<Expression>,
4405 #[serde(default)]
4407 pub params: Vec<CopyParameter>,
4408 #[serde(default)]
4410 pub credentials: Option<Box<Credentials>>,
4411 #[serde(default)]
4413 pub is_into: bool,
4414 #[serde(default)]
4416 pub with_wrapped: bool,
4417}
4418
4419#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4421#[cfg_attr(feature = "bindings", derive(TS))]
4422pub struct CopyParameter {
4423 pub name: String,
4424 pub value: Option<Expression>,
4425 pub values: Vec<Expression>,
4426 #[serde(default)]
4428 pub eq: bool,
4429}
4430
4431#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4433#[cfg_attr(feature = "bindings", derive(TS))]
4434pub struct Credentials {
4435 pub credentials: Vec<(String, String)>,
4436 pub encryption: Option<String>,
4437 pub storage: Option<String>,
4438}
4439
4440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4442#[cfg_attr(feature = "bindings", derive(TS))]
4443pub struct PutStmt {
4444 pub source: String,
4446 #[serde(default)]
4448 pub source_quoted: bool,
4449 pub target: Expression,
4451 #[serde(default)]
4453 pub params: Vec<CopyParameter>,
4454}
4455
4456#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4458#[cfg_attr(feature = "bindings", derive(TS))]
4459pub struct StageReference {
4460 pub name: String,
4462 #[serde(default)]
4464 pub path: Option<String>,
4465 #[serde(default)]
4467 pub file_format: Option<Expression>,
4468 #[serde(default)]
4470 pub pattern: Option<String>,
4471 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4473 pub quoted: bool,
4474}
4475
4476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4478#[cfg_attr(feature = "bindings", derive(TS))]
4479pub struct HistoricalData {
4480 pub this: Box<Expression>,
4482 pub kind: String,
4484 pub expression: Box<Expression>,
4486}
4487
4488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4493#[cfg_attr(feature = "bindings", derive(TS))]
4494pub struct Alias {
4495 pub this: Expression,
4497 pub alias: Identifier,
4499 #[serde(default)]
4501 pub column_aliases: Vec<Identifier>,
4502 #[serde(default)]
4504 pub alias_explicit_as: bool,
4505 #[serde(skip_serializing_if = "Option::is_none", default)]
4507 pub alias_keyword: Option<String>,
4508 #[serde(default)]
4510 pub pre_alias_comments: Vec<String>,
4511 #[serde(default)]
4513 pub trailing_comments: Vec<String>,
4514 #[serde(default, skip_serializing_if = "Option::is_none")]
4516 pub inferred_type: Option<DataType>,
4517}
4518
4519impl Alias {
4520 pub fn new(this: Expression, alias: Identifier) -> Self {
4522 Self {
4523 this,
4524 alias,
4525 column_aliases: Vec::new(),
4526 alias_explicit_as: false,
4527 alias_keyword: None,
4528 pre_alias_comments: Vec::new(),
4529 trailing_comments: Vec::new(),
4530 inferred_type: None,
4531 }
4532 }
4533
4534 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4536 Self {
4537 this,
4538 alias: Identifier::empty(),
4539 column_aliases,
4540 alias_explicit_as: false,
4541 alias_keyword: None,
4542 pre_alias_comments: Vec::new(),
4543 trailing_comments: Vec::new(),
4544 inferred_type: None,
4545 }
4546 }
4547}
4548
4549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4556#[cfg_attr(feature = "bindings", derive(TS))]
4557pub struct Cast {
4558 pub this: Expression,
4560 pub to: DataType,
4562 #[serde(default)]
4563 pub trailing_comments: Vec<String>,
4564 #[serde(default)]
4566 pub double_colon_syntax: bool,
4567 #[serde(skip_serializing_if = "Option::is_none", default)]
4569 pub format: Option<Box<Expression>>,
4570 #[serde(skip_serializing_if = "Option::is_none", default)]
4572 pub default: Option<Box<Expression>>,
4573 #[serde(default, skip_serializing_if = "Option::is_none")]
4575 pub inferred_type: Option<DataType>,
4576}
4577
4578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4580#[cfg_attr(feature = "bindings", derive(TS))]
4581pub struct CollationExpr {
4582 pub this: Expression,
4583 pub collation: String,
4584 #[serde(default)]
4586 pub quoted: bool,
4587 #[serde(default)]
4589 pub double_quoted: bool,
4590}
4591
4592#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4598#[cfg_attr(feature = "bindings", derive(TS))]
4599pub struct Case {
4600 pub operand: Option<Expression>,
4602 pub whens: Vec<(Expression, Expression)>,
4604 pub else_: Option<Expression>,
4606 #[serde(default)]
4608 #[serde(skip_serializing_if = "Vec::is_empty")]
4609 pub comments: Vec<String>,
4610 #[serde(default, skip_serializing_if = "Option::is_none")]
4612 pub inferred_type: Option<DataType>,
4613}
4614
4615#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4623#[cfg_attr(feature = "bindings", derive(TS))]
4624pub struct BinaryOp {
4625 pub left: Expression,
4626 pub right: Expression,
4627 #[serde(default)]
4629 pub left_comments: Vec<String>,
4630 #[serde(default)]
4632 pub operator_comments: Vec<String>,
4633 #[serde(default)]
4635 pub trailing_comments: Vec<String>,
4636 #[serde(default, skip_serializing_if = "Option::is_none")]
4638 pub inferred_type: Option<DataType>,
4639}
4640
4641impl BinaryOp {
4642 pub fn new(left: Expression, right: Expression) -> Self {
4643 Self {
4644 left,
4645 right,
4646 left_comments: Vec::new(),
4647 operator_comments: Vec::new(),
4648 trailing_comments: Vec::new(),
4649 inferred_type: None,
4650 }
4651 }
4652}
4653
4654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4656#[cfg_attr(feature = "bindings", derive(TS))]
4657pub struct LikeOp {
4658 pub left: Expression,
4659 pub right: Expression,
4660 #[serde(default)]
4662 pub escape: Option<Expression>,
4663 #[serde(default)]
4665 pub quantifier: Option<String>,
4666 #[serde(default, skip_serializing_if = "Option::is_none")]
4668 pub inferred_type: Option<DataType>,
4669}
4670
4671impl LikeOp {
4672 pub fn new(left: Expression, right: Expression) -> Self {
4673 Self {
4674 left,
4675 right,
4676 escape: None,
4677 quantifier: None,
4678 inferred_type: None,
4679 }
4680 }
4681
4682 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4683 Self {
4684 left,
4685 right,
4686 escape: Some(escape),
4687 quantifier: None,
4688 inferred_type: None,
4689 }
4690 }
4691}
4692
4693#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4697#[cfg_attr(feature = "bindings", derive(TS))]
4698pub struct UnaryOp {
4699 pub this: Expression,
4701 #[serde(default, skip_serializing_if = "Option::is_none")]
4703 pub inferred_type: Option<DataType>,
4704}
4705
4706impl UnaryOp {
4707 pub fn new(this: Expression) -> Self {
4708 Self {
4709 this,
4710 inferred_type: None,
4711 }
4712 }
4713}
4714
4715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4720#[cfg_attr(feature = "bindings", derive(TS))]
4721pub struct In {
4722 pub this: Expression,
4724 pub expressions: Vec<Expression>,
4726 pub query: Option<Expression>,
4728 pub not: bool,
4730 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4731 pub global: bool,
4732 #[serde(default, skip_serializing_if = "Option::is_none")]
4734 pub unnest: Option<Box<Expression>>,
4735 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4739 pub is_field: bool,
4740}
4741
4742#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4744#[cfg_attr(feature = "bindings", derive(TS))]
4745pub struct Between {
4746 pub this: Expression,
4748 pub low: Expression,
4750 pub high: Expression,
4752 pub not: bool,
4754 #[serde(default)]
4756 pub symmetric: Option<bool>,
4757}
4758
4759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4761#[cfg_attr(feature = "bindings", derive(TS))]
4762pub struct IsNull {
4763 pub this: Expression,
4764 pub not: bool,
4765 #[serde(default)]
4767 pub postfix_form: bool,
4768}
4769
4770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4772#[cfg_attr(feature = "bindings", derive(TS))]
4773pub struct IsTrueFalse {
4774 pub this: Expression,
4775 pub not: bool,
4776}
4777
4778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4781#[cfg_attr(feature = "bindings", derive(TS))]
4782pub struct IsJson {
4783 pub this: Expression,
4784 pub json_type: Option<String>,
4786 pub unique_keys: Option<JsonUniqueKeys>,
4788 pub negated: bool,
4790}
4791
4792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4794#[cfg_attr(feature = "bindings", derive(TS))]
4795pub enum JsonUniqueKeys {
4796 With,
4798 Without,
4800 Shorthand,
4802}
4803
4804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4806#[cfg_attr(feature = "bindings", derive(TS))]
4807pub struct Exists {
4808 pub this: Expression,
4810 pub not: bool,
4812}
4813
4814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4821#[cfg_attr(feature = "bindings", derive(TS))]
4822pub struct Function {
4823 pub name: String,
4825 pub args: Vec<Expression>,
4827 pub distinct: bool,
4829 #[serde(default)]
4830 pub trailing_comments: Vec<String>,
4831 #[serde(default)]
4833 pub use_bracket_syntax: bool,
4834 #[serde(default)]
4836 pub no_parens: bool,
4837 #[serde(default)]
4839 pub quoted: bool,
4840 #[serde(default, skip_serializing_if = "Option::is_none")]
4842 pub span: Option<Span>,
4843 #[serde(default, skip_serializing_if = "Option::is_none")]
4845 pub inferred_type: Option<DataType>,
4846}
4847
4848impl Default for Function {
4849 fn default() -> Self {
4850 Self {
4851 name: String::new(),
4852 args: Vec::new(),
4853 distinct: false,
4854 trailing_comments: Vec::new(),
4855 use_bracket_syntax: false,
4856 no_parens: false,
4857 quoted: false,
4858 span: None,
4859 inferred_type: None,
4860 }
4861 }
4862}
4863
4864impl Function {
4865 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4866 Self {
4867 name: name.into(),
4868 args,
4869 distinct: false,
4870 trailing_comments: Vec::new(),
4871 use_bracket_syntax: false,
4872 no_parens: false,
4873 quoted: false,
4874 span: None,
4875 inferred_type: None,
4876 }
4877 }
4878}
4879
4880#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4887#[cfg_attr(feature = "bindings", derive(TS))]
4888pub struct AggregateFunction {
4889 pub name: String,
4891 pub args: Vec<Expression>,
4893 pub distinct: bool,
4895 pub filter: Option<Expression>,
4897 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4899 pub order_by: Vec<Ordered>,
4900 #[serde(default, skip_serializing_if = "Option::is_none")]
4902 pub limit: Option<Box<Expression>>,
4903 #[serde(default, skip_serializing_if = "Option::is_none")]
4905 pub ignore_nulls: Option<bool>,
4906 #[serde(default, skip_serializing_if = "Option::is_none")]
4908 pub inferred_type: Option<DataType>,
4909}
4910
4911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4918#[cfg_attr(feature = "bindings", derive(TS))]
4919pub struct WindowFunction {
4920 pub this: Expression,
4922 pub over: Over,
4924 #[serde(default, skip_serializing_if = "Option::is_none")]
4926 pub keep: Option<Keep>,
4927 #[serde(default, skip_serializing_if = "Option::is_none")]
4929 pub inferred_type: Option<DataType>,
4930}
4931
4932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4935#[cfg_attr(feature = "bindings", derive(TS))]
4936pub struct Keep {
4937 pub first: bool,
4939 pub order_by: Vec<Ordered>,
4941}
4942
4943#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4945#[cfg_attr(feature = "bindings", derive(TS))]
4946pub struct WithinGroup {
4947 pub this: Expression,
4949 pub order_by: Vec<Ordered>,
4951}
4952
4953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4958#[cfg_attr(feature = "bindings", derive(TS))]
4959pub struct From {
4960 pub expressions: Vec<Expression>,
4962}
4963
4964#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4970#[cfg_attr(feature = "bindings", derive(TS))]
4971pub struct Join {
4972 pub this: Expression,
4974 pub on: Option<Expression>,
4976 pub using: Vec<Identifier>,
4978 pub kind: JoinKind,
4980 pub use_inner_keyword: bool,
4982 pub use_outer_keyword: bool,
4984 pub deferred_condition: bool,
4986 #[serde(default, skip_serializing_if = "Option::is_none")]
4988 pub join_hint: Option<String>,
4989 #[serde(default, skip_serializing_if = "Option::is_none")]
4991 pub match_condition: Option<Expression>,
4992 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4994 pub pivots: Vec<Expression>,
4995 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4997 pub comments: Vec<String>,
4998 #[serde(default)]
5002 pub nesting_group: usize,
5003 #[serde(default)]
5005 pub directed: bool,
5006}
5007
5008#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5015#[cfg_attr(feature = "bindings", derive(TS))]
5016pub enum JoinKind {
5017 Inner,
5018 Left,
5019 Right,
5020 Full,
5021 Outer, Cross,
5023 Natural,
5024 NaturalLeft,
5025 NaturalRight,
5026 NaturalFull,
5027 Semi,
5028 Anti,
5029 LeftSemi,
5031 LeftAnti,
5032 RightSemi,
5033 RightAnti,
5034 CrossApply,
5036 OuterApply,
5037 AsOf,
5039 AsOfLeft,
5040 AsOfRight,
5041 Lateral,
5043 LeftLateral,
5044 Straight,
5046 Implicit,
5048 Array,
5050 LeftArray,
5051 Paste,
5053 Positional,
5055}
5056
5057impl Default for JoinKind {
5058 fn default() -> Self {
5059 JoinKind::Inner
5060 }
5061}
5062
5063#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5066#[cfg_attr(feature = "bindings", derive(TS))]
5067pub struct JoinedTable {
5068 pub left: Expression,
5070 pub joins: Vec<Join>,
5072 pub lateral_views: Vec<LateralView>,
5074 pub alias: Option<Identifier>,
5076}
5077
5078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5080#[cfg_attr(feature = "bindings", derive(TS))]
5081pub struct Where {
5082 pub this: Expression,
5084}
5085
5086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5091#[cfg_attr(feature = "bindings", derive(TS))]
5092pub struct GroupBy {
5093 pub expressions: Vec<Expression>,
5095 #[serde(default)]
5097 pub all: Option<bool>,
5098 #[serde(default)]
5100 pub totals: bool,
5101 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5103 pub comments: Vec<String>,
5104}
5105
5106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5108#[cfg_attr(feature = "bindings", derive(TS))]
5109pub struct Having {
5110 pub this: Expression,
5112 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5114 pub comments: Vec<String>,
5115}
5116
5117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5119#[cfg_attr(feature = "bindings", derive(TS))]
5120pub struct OrderBy {
5121 pub expressions: Vec<Ordered>,
5123 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5125 pub siblings: bool,
5126 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5128 pub comments: Vec<String>,
5129}
5130
5131#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5138#[cfg_attr(feature = "bindings", derive(TS))]
5139pub struct Ordered {
5140 pub this: Expression,
5142 pub desc: bool,
5144 pub nulls_first: Option<bool>,
5146 #[serde(default)]
5148 pub explicit_asc: bool,
5149 #[serde(default, skip_serializing_if = "Option::is_none")]
5151 pub with_fill: Option<Box<WithFill>>,
5152}
5153
5154impl Ordered {
5155 pub fn asc(expr: Expression) -> Self {
5156 Self {
5157 this: expr,
5158 desc: false,
5159 nulls_first: None,
5160 explicit_asc: false,
5161 with_fill: None,
5162 }
5163 }
5164
5165 pub fn desc(expr: Expression) -> Self {
5166 Self {
5167 this: expr,
5168 desc: true,
5169 nulls_first: None,
5170 explicit_asc: false,
5171 with_fill: None,
5172 }
5173 }
5174}
5175
5176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5179#[cfg_attr(feature = "bindings", derive(TS))]
5180#[cfg_attr(feature = "bindings", ts(export))]
5181pub struct DistributeBy {
5182 pub expressions: Vec<Expression>,
5183}
5184
5185#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5188#[cfg_attr(feature = "bindings", derive(TS))]
5189#[cfg_attr(feature = "bindings", ts(export))]
5190pub struct ClusterBy {
5191 pub expressions: Vec<Ordered>,
5192}
5193
5194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5197#[cfg_attr(feature = "bindings", derive(TS))]
5198#[cfg_attr(feature = "bindings", ts(export))]
5199pub struct SortBy {
5200 pub expressions: Vec<Ordered>,
5201}
5202
5203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5206#[cfg_attr(feature = "bindings", derive(TS))]
5207#[cfg_attr(feature = "bindings", ts(export))]
5208pub struct LateralView {
5209 pub this: Expression,
5211 pub table_alias: Option<Identifier>,
5213 pub column_aliases: Vec<Identifier>,
5215 pub outer: bool,
5217}
5218
5219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5221#[cfg_attr(feature = "bindings", derive(TS))]
5222#[cfg_attr(feature = "bindings", ts(export))]
5223pub struct Hint {
5224 pub expressions: Vec<HintExpression>,
5225}
5226
5227#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5229#[cfg_attr(feature = "bindings", derive(TS))]
5230#[cfg_attr(feature = "bindings", ts(export))]
5231pub enum HintExpression {
5232 Function { name: String, args: Vec<Expression> },
5234 Identifier(String),
5236 Raw(String),
5238}
5239
5240#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5242#[cfg_attr(feature = "bindings", derive(TS))]
5243#[cfg_attr(feature = "bindings", ts(export))]
5244pub enum PseudocolumnType {
5245 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5252
5253impl PseudocolumnType {
5254 pub fn as_str(&self) -> &'static str {
5255 match self {
5256 PseudocolumnType::Rownum => "ROWNUM",
5257 PseudocolumnType::Rowid => "ROWID",
5258 PseudocolumnType::Level => "LEVEL",
5259 PseudocolumnType::Sysdate => "SYSDATE",
5260 PseudocolumnType::ObjectId => "OBJECT_ID",
5261 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5262 }
5263 }
5264
5265 pub fn from_str(s: &str) -> Option<Self> {
5266 match s.to_uppercase().as_str() {
5267 "ROWNUM" => Some(PseudocolumnType::Rownum),
5268 "ROWID" => Some(PseudocolumnType::Rowid),
5269 "LEVEL" => Some(PseudocolumnType::Level),
5270 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5271 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5272 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5273 _ => None,
5274 }
5275 }
5276}
5277
5278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5281#[cfg_attr(feature = "bindings", derive(TS))]
5282#[cfg_attr(feature = "bindings", ts(export))]
5283pub struct Pseudocolumn {
5284 pub kind: PseudocolumnType,
5285}
5286
5287impl Pseudocolumn {
5288 pub fn rownum() -> Self {
5289 Self {
5290 kind: PseudocolumnType::Rownum,
5291 }
5292 }
5293
5294 pub fn rowid() -> Self {
5295 Self {
5296 kind: PseudocolumnType::Rowid,
5297 }
5298 }
5299
5300 pub fn level() -> Self {
5301 Self {
5302 kind: PseudocolumnType::Level,
5303 }
5304 }
5305}
5306
5307#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5309#[cfg_attr(feature = "bindings", derive(TS))]
5310#[cfg_attr(feature = "bindings", ts(export))]
5311pub struct Connect {
5312 pub start: Option<Expression>,
5314 pub connect: Expression,
5316 pub nocycle: bool,
5318}
5319
5320#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5322#[cfg_attr(feature = "bindings", derive(TS))]
5323#[cfg_attr(feature = "bindings", ts(export))]
5324pub struct Prior {
5325 pub this: Expression,
5326}
5327
5328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5330#[cfg_attr(feature = "bindings", derive(TS))]
5331#[cfg_attr(feature = "bindings", ts(export))]
5332pub struct ConnectByRoot {
5333 pub this: Expression,
5334}
5335
5336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5338#[cfg_attr(feature = "bindings", derive(TS))]
5339#[cfg_attr(feature = "bindings", ts(export))]
5340pub struct MatchRecognize {
5341 pub this: Option<Box<Expression>>,
5343 pub partition_by: Option<Vec<Expression>>,
5345 pub order_by: Option<Vec<Ordered>>,
5347 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5349 pub rows: Option<MatchRecognizeRows>,
5351 pub after: Option<MatchRecognizeAfter>,
5353 pub pattern: Option<String>,
5355 pub define: Option<Vec<(Identifier, Expression)>>,
5357 pub alias: Option<Identifier>,
5359 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5361 pub alias_explicit_as: bool,
5362}
5363
5364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5366#[cfg_attr(feature = "bindings", derive(TS))]
5367#[cfg_attr(feature = "bindings", ts(export))]
5368pub struct MatchRecognizeMeasure {
5369 pub this: Expression,
5371 pub window_frame: Option<MatchRecognizeSemantics>,
5373}
5374
5375#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5377#[cfg_attr(feature = "bindings", derive(TS))]
5378#[cfg_attr(feature = "bindings", ts(export))]
5379pub enum MatchRecognizeSemantics {
5380 Running,
5381 Final,
5382}
5383
5384#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5386#[cfg_attr(feature = "bindings", derive(TS))]
5387#[cfg_attr(feature = "bindings", ts(export))]
5388pub enum MatchRecognizeRows {
5389 OneRowPerMatch,
5390 AllRowsPerMatch,
5391 AllRowsPerMatchShowEmptyMatches,
5392 AllRowsPerMatchOmitEmptyMatches,
5393 AllRowsPerMatchWithUnmatchedRows,
5394}
5395
5396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5398#[cfg_attr(feature = "bindings", derive(TS))]
5399#[cfg_attr(feature = "bindings", ts(export))]
5400pub enum MatchRecognizeAfter {
5401 PastLastRow,
5402 ToNextRow,
5403 ToFirst(Identifier),
5404 ToLast(Identifier),
5405}
5406
5407#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5409#[cfg_attr(feature = "bindings", derive(TS))]
5410pub struct Limit {
5411 pub this: Expression,
5413 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5415 pub percent: bool,
5416 #[serde(default)]
5418 #[serde(skip_serializing_if = "Vec::is_empty")]
5419 pub comments: Vec<String>,
5420}
5421
5422#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5424#[cfg_attr(feature = "bindings", derive(TS))]
5425pub struct Offset {
5426 pub this: Expression,
5427 #[serde(skip_serializing_if = "Option::is_none", default)]
5429 pub rows: Option<bool>,
5430}
5431
5432#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5434#[cfg_attr(feature = "bindings", derive(TS))]
5435pub struct Top {
5436 pub this: Expression,
5437 pub percent: bool,
5438 pub with_ties: bool,
5439 #[serde(default)]
5441 pub parenthesized: bool,
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5446#[cfg_attr(feature = "bindings", derive(TS))]
5447pub struct Fetch {
5448 pub direction: String,
5450 pub count: Option<Expression>,
5452 pub percent: bool,
5454 pub rows: bool,
5456 pub with_ties: bool,
5458}
5459
5460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5466#[cfg_attr(feature = "bindings", derive(TS))]
5467pub struct Qualify {
5468 pub this: Expression,
5470}
5471
5472#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5474#[cfg_attr(feature = "bindings", derive(TS))]
5475pub struct Sample {
5476 pub method: SampleMethod,
5477 pub size: Expression,
5478 pub seed: Option<Expression>,
5479 #[serde(default)]
5481 pub offset: Option<Expression>,
5482 pub unit_after_size: bool,
5484 #[serde(default)]
5486 pub use_sample_keyword: bool,
5487 #[serde(default)]
5489 pub explicit_method: bool,
5490 #[serde(default)]
5492 pub method_before_size: bool,
5493 #[serde(default)]
5495 pub use_seed_keyword: bool,
5496 pub bucket_numerator: Option<Box<Expression>>,
5498 pub bucket_denominator: Option<Box<Expression>>,
5500 pub bucket_field: Option<Box<Expression>>,
5502 #[serde(default)]
5504 pub is_using_sample: bool,
5505 #[serde(default)]
5507 pub is_percent: bool,
5508 #[serde(default)]
5510 pub suppress_method_output: bool,
5511}
5512
5513#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5515#[cfg_attr(feature = "bindings", derive(TS))]
5516pub enum SampleMethod {
5517 Bernoulli,
5518 System,
5519 Block,
5520 Row,
5521 Percent,
5522 Bucket,
5524 Reservoir,
5526}
5527
5528#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5530#[cfg_attr(feature = "bindings", derive(TS))]
5531pub struct NamedWindow {
5532 pub name: Identifier,
5533 pub spec: Over,
5534}
5535
5536#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5542#[cfg_attr(feature = "bindings", derive(TS))]
5543pub struct With {
5544 pub ctes: Vec<Cte>,
5546 pub recursive: bool,
5548 #[serde(default)]
5550 pub leading_comments: Vec<String>,
5551 #[serde(default, skip_serializing_if = "Option::is_none")]
5553 pub search: Option<Box<Expression>>,
5554}
5555
5556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5563#[cfg_attr(feature = "bindings", derive(TS))]
5564pub struct Cte {
5565 pub alias: Identifier,
5567 pub this: Expression,
5569 pub columns: Vec<Identifier>,
5571 pub materialized: Option<bool>,
5573 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5575 pub key_expressions: Vec<Identifier>,
5576 #[serde(default)]
5578 pub alias_first: bool,
5579 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5581 pub comments: Vec<String>,
5582}
5583
5584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5586#[cfg_attr(feature = "bindings", derive(TS))]
5587pub struct WindowSpec {
5588 pub partition_by: Vec<Expression>,
5589 pub order_by: Vec<Ordered>,
5590 pub frame: Option<WindowFrame>,
5591}
5592
5593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5595#[cfg_attr(feature = "bindings", derive(TS))]
5596pub struct Over {
5597 pub window_name: Option<Identifier>,
5599 pub partition_by: Vec<Expression>,
5600 pub order_by: Vec<Ordered>,
5601 pub frame: Option<WindowFrame>,
5602 pub alias: Option<Identifier>,
5603}
5604
5605#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5607#[cfg_attr(feature = "bindings", derive(TS))]
5608pub struct WindowFrame {
5609 pub kind: WindowFrameKind,
5610 pub start: WindowFrameBound,
5611 pub end: Option<WindowFrameBound>,
5612 pub exclude: Option<WindowFrameExclude>,
5613 #[serde(default, skip_serializing_if = "Option::is_none")]
5615 pub kind_text: Option<String>,
5616 #[serde(default, skip_serializing_if = "Option::is_none")]
5618 pub start_side_text: Option<String>,
5619 #[serde(default, skip_serializing_if = "Option::is_none")]
5621 pub end_side_text: Option<String>,
5622}
5623
5624#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5625#[cfg_attr(feature = "bindings", derive(TS))]
5626pub enum WindowFrameKind {
5627 Rows,
5628 Range,
5629 Groups,
5630}
5631
5632#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5634#[cfg_attr(feature = "bindings", derive(TS))]
5635pub enum WindowFrameExclude {
5636 CurrentRow,
5637 Group,
5638 Ties,
5639 NoOthers,
5640}
5641
5642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5643#[cfg_attr(feature = "bindings", derive(TS))]
5644pub enum WindowFrameBound {
5645 CurrentRow,
5646 UnboundedPreceding,
5647 UnboundedFollowing,
5648 Preceding(Box<Expression>),
5649 Following(Box<Expression>),
5650 BarePreceding,
5652 BareFollowing,
5654 Value(Box<Expression>),
5656}
5657
5658#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5660#[cfg_attr(feature = "bindings", derive(TS))]
5661pub struct StructField {
5662 pub name: String,
5663 pub data_type: DataType,
5664 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5665 pub options: Vec<Expression>,
5666 #[serde(default, skip_serializing_if = "Option::is_none")]
5667 pub comment: Option<String>,
5668}
5669
5670impl StructField {
5671 pub fn new(name: String, data_type: DataType) -> Self {
5673 Self {
5674 name,
5675 data_type,
5676 options: Vec::new(),
5677 comment: None,
5678 }
5679 }
5680
5681 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5683 Self {
5684 name,
5685 data_type,
5686 options,
5687 comment: None,
5688 }
5689 }
5690
5691 pub fn with_options_and_comment(
5693 name: String,
5694 data_type: DataType,
5695 options: Vec<Expression>,
5696 comment: Option<String>,
5697 ) -> Self {
5698 Self {
5699 name,
5700 data_type,
5701 options,
5702 comment,
5703 }
5704 }
5705}
5706
5707#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5719#[cfg_attr(feature = "bindings", derive(TS))]
5720#[serde(tag = "data_type", rename_all = "snake_case")]
5721pub enum DataType {
5722 Boolean,
5724 TinyInt {
5725 length: Option<u32>,
5726 },
5727 SmallInt {
5728 length: Option<u32>,
5729 },
5730 Int {
5734 length: Option<u32>,
5735 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5736 integer_spelling: bool,
5737 },
5738 BigInt {
5739 length: Option<u32>,
5740 },
5741 Float {
5745 precision: Option<u32>,
5746 scale: Option<u32>,
5747 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5748 real_spelling: bool,
5749 },
5750 Double {
5751 precision: Option<u32>,
5752 scale: Option<u32>,
5753 },
5754 Decimal {
5755 precision: Option<u32>,
5756 scale: Option<u32>,
5757 },
5758
5759 Char {
5761 length: Option<u32>,
5762 },
5763 VarChar {
5766 length: Option<u32>,
5767 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5768 parenthesized_length: bool,
5769 },
5770 String {
5772 length: Option<u32>,
5773 },
5774 Text,
5775 TextWithLength {
5777 length: u32,
5778 },
5779
5780 Binary {
5782 length: Option<u32>,
5783 },
5784 VarBinary {
5785 length: Option<u32>,
5786 },
5787 Blob,
5788
5789 Bit {
5791 length: Option<u32>,
5792 },
5793 VarBit {
5794 length: Option<u32>,
5795 },
5796
5797 Date,
5799 Time {
5800 precision: Option<u32>,
5801 #[serde(default)]
5802 timezone: bool,
5803 },
5804 Timestamp {
5805 precision: Option<u32>,
5806 timezone: bool,
5807 },
5808 Interval {
5809 unit: Option<String>,
5810 #[serde(default, skip_serializing_if = "Option::is_none")]
5812 to: Option<String>,
5813 },
5814
5815 Json,
5817 JsonB,
5818
5819 Uuid,
5821
5822 Array {
5824 element_type: Box<DataType>,
5825 #[serde(default, skip_serializing_if = "Option::is_none")]
5827 dimension: Option<u32>,
5828 },
5829
5830 List {
5833 element_type: Box<DataType>,
5834 },
5835
5836 Struct {
5840 fields: Vec<StructField>,
5841 nested: bool,
5842 },
5843 Map {
5844 key_type: Box<DataType>,
5845 value_type: Box<DataType>,
5846 },
5847
5848 Enum {
5850 values: Vec<String>,
5851 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5852 assignments: Vec<Option<String>>,
5853 },
5854
5855 Set {
5857 values: Vec<String>,
5858 },
5859
5860 Union {
5862 fields: Vec<(String, DataType)>,
5863 },
5864
5865 Vector {
5867 #[serde(default)]
5868 element_type: Option<Box<DataType>>,
5869 dimension: Option<u32>,
5870 },
5871
5872 Object {
5875 fields: Vec<(String, DataType, bool)>,
5876 modifier: Option<String>,
5877 },
5878
5879 Nullable {
5881 inner: Box<DataType>,
5882 },
5883
5884 Custom {
5886 name: String,
5887 },
5888
5889 Geometry {
5891 subtype: Option<String>,
5892 srid: Option<u32>,
5893 },
5894 Geography {
5895 subtype: Option<String>,
5896 srid: Option<u32>,
5897 },
5898
5899 CharacterSet {
5902 name: String,
5903 },
5904
5905 Unknown,
5907}
5908
5909#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5911#[cfg_attr(feature = "bindings", derive(TS))]
5912#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
5913pub struct Array {
5914 pub expressions: Vec<Expression>,
5915}
5916
5917#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5919#[cfg_attr(feature = "bindings", derive(TS))]
5920pub struct Struct {
5921 pub fields: Vec<(Option<String>, Expression)>,
5922}
5923
5924#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5926#[cfg_attr(feature = "bindings", derive(TS))]
5927pub struct Tuple {
5928 pub expressions: Vec<Expression>,
5929}
5930
5931#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5933#[cfg_attr(feature = "bindings", derive(TS))]
5934pub struct Interval {
5935 pub this: Option<Expression>,
5937 pub unit: Option<IntervalUnitSpec>,
5939}
5940
5941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5943#[cfg_attr(feature = "bindings", derive(TS))]
5944#[serde(tag = "type", rename_all = "snake_case")]
5945pub enum IntervalUnitSpec {
5946 Simple {
5948 unit: IntervalUnit,
5949 use_plural: bool,
5951 },
5952 Span(IntervalSpan),
5954 ExprSpan(IntervalSpanExpr),
5957 Expr(Box<Expression>),
5959}
5960
5961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5963#[cfg_attr(feature = "bindings", derive(TS))]
5964pub struct IntervalSpan {
5965 pub this: IntervalUnit,
5967 pub expression: IntervalUnit,
5969}
5970
5971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5974#[cfg_attr(feature = "bindings", derive(TS))]
5975pub struct IntervalSpanExpr {
5976 pub this: Box<Expression>,
5978 pub expression: Box<Expression>,
5980}
5981
5982#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
5983#[cfg_attr(feature = "bindings", derive(TS))]
5984pub enum IntervalUnit {
5985 Year,
5986 Quarter,
5987 Month,
5988 Week,
5989 Day,
5990 Hour,
5991 Minute,
5992 Second,
5993 Millisecond,
5994 Microsecond,
5995 Nanosecond,
5996}
5997
5998#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6000#[cfg_attr(feature = "bindings", derive(TS))]
6001pub struct Command {
6002 pub this: String,
6004}
6005
6006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6009#[cfg_attr(feature = "bindings", derive(TS))]
6010pub struct ExecuteStatement {
6011 pub this: Expression,
6013 #[serde(default)]
6015 pub parameters: Vec<ExecuteParameter>,
6016 #[serde(default, skip_serializing_if = "Option::is_none")]
6018 pub suffix: Option<String>,
6019}
6020
6021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6023#[cfg_attr(feature = "bindings", derive(TS))]
6024pub struct ExecuteParameter {
6025 pub name: String,
6027 pub value: Expression,
6029 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6031 pub positional: bool,
6032 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6034 pub output: bool,
6035}
6036
6037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6040#[cfg_attr(feature = "bindings", derive(TS))]
6041pub struct Kill {
6042 pub this: Expression,
6044 pub kind: Option<String>,
6046}
6047
6048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6050#[cfg_attr(feature = "bindings", derive(TS))]
6051pub struct CreateTask {
6052 pub or_replace: bool,
6053 pub if_not_exists: bool,
6054 pub name: String,
6056 pub properties: String,
6058 pub body: Expression,
6060}
6061
6062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6064#[cfg_attr(feature = "bindings", derive(TS))]
6065pub struct Raw {
6066 pub sql: String,
6067}
6068
6069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6075#[cfg_attr(feature = "bindings", derive(TS))]
6076pub struct UnaryFunc {
6077 pub this: Expression,
6078 #[serde(skip_serializing_if = "Option::is_none", default)]
6080 pub original_name: Option<String>,
6081 #[serde(default, skip_serializing_if = "Option::is_none")]
6083 pub inferred_type: Option<DataType>,
6084}
6085
6086impl UnaryFunc {
6087 pub fn new(this: Expression) -> Self {
6089 Self {
6090 this,
6091 original_name: None,
6092 inferred_type: None,
6093 }
6094 }
6095
6096 pub fn with_name(this: Expression, name: String) -> Self {
6098 Self {
6099 this,
6100 original_name: Some(name),
6101 inferred_type: None,
6102 }
6103 }
6104}
6105
6106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6110#[cfg_attr(feature = "bindings", derive(TS))]
6111pub struct CharFunc {
6112 pub args: Vec<Expression>,
6113 #[serde(skip_serializing_if = "Option::is_none", default)]
6114 pub charset: Option<String>,
6115 #[serde(skip_serializing_if = "Option::is_none", default)]
6117 pub name: Option<String>,
6118}
6119
6120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6122#[cfg_attr(feature = "bindings", derive(TS))]
6123pub struct BinaryFunc {
6124 pub this: Expression,
6125 pub expression: Expression,
6126 #[serde(skip_serializing_if = "Option::is_none", default)]
6128 pub original_name: Option<String>,
6129 #[serde(default, skip_serializing_if = "Option::is_none")]
6131 pub inferred_type: Option<DataType>,
6132}
6133
6134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6136#[cfg_attr(feature = "bindings", derive(TS))]
6137pub struct VarArgFunc {
6138 pub expressions: Vec<Expression>,
6139 #[serde(skip_serializing_if = "Option::is_none", default)]
6141 pub original_name: Option<String>,
6142 #[serde(default, skip_serializing_if = "Option::is_none")]
6144 pub inferred_type: Option<DataType>,
6145}
6146
6147#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6149#[cfg_attr(feature = "bindings", derive(TS))]
6150pub struct ConcatWs {
6151 pub separator: Expression,
6152 pub expressions: Vec<Expression>,
6153}
6154
6155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6157#[cfg_attr(feature = "bindings", derive(TS))]
6158pub struct SubstringFunc {
6159 pub this: Expression,
6160 pub start: Expression,
6161 pub length: Option<Expression>,
6162 #[serde(default)]
6164 pub from_for_syntax: bool,
6165}
6166
6167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6169#[cfg_attr(feature = "bindings", derive(TS))]
6170pub struct OverlayFunc {
6171 pub this: Expression,
6172 pub replacement: Expression,
6173 pub from: Expression,
6174 pub length: Option<Expression>,
6175}
6176
6177#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6179#[cfg_attr(feature = "bindings", derive(TS))]
6180pub struct TrimFunc {
6181 pub this: Expression,
6182 pub characters: Option<Expression>,
6183 pub position: TrimPosition,
6184 #[serde(default)]
6186 pub sql_standard_syntax: bool,
6187 #[serde(default)]
6189 pub position_explicit: bool,
6190}
6191
6192#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
6193#[cfg_attr(feature = "bindings", derive(TS))]
6194pub enum TrimPosition {
6195 Both,
6196 Leading,
6197 Trailing,
6198}
6199
6200#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6202#[cfg_attr(feature = "bindings", derive(TS))]
6203pub struct ReplaceFunc {
6204 pub this: Expression,
6205 pub old: Expression,
6206 pub new: Expression,
6207}
6208
6209#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6211#[cfg_attr(feature = "bindings", derive(TS))]
6212pub struct LeftRightFunc {
6213 pub this: Expression,
6214 pub length: Expression,
6215}
6216
6217#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6219#[cfg_attr(feature = "bindings", derive(TS))]
6220pub struct RepeatFunc {
6221 pub this: Expression,
6222 pub times: Expression,
6223}
6224
6225#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6227#[cfg_attr(feature = "bindings", derive(TS))]
6228pub struct PadFunc {
6229 pub this: Expression,
6230 pub length: Expression,
6231 pub fill: Option<Expression>,
6232}
6233
6234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6236#[cfg_attr(feature = "bindings", derive(TS))]
6237pub struct SplitFunc {
6238 pub this: Expression,
6239 pub delimiter: Expression,
6240}
6241
6242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6244#[cfg_attr(feature = "bindings", derive(TS))]
6245pub struct RegexpFunc {
6246 pub this: Expression,
6247 pub pattern: Expression,
6248 pub flags: Option<Expression>,
6249}
6250
6251#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6253#[cfg_attr(feature = "bindings", derive(TS))]
6254pub struct RegexpReplaceFunc {
6255 pub this: Expression,
6256 pub pattern: Expression,
6257 pub replacement: Expression,
6258 pub flags: Option<Expression>,
6259}
6260
6261#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6263#[cfg_attr(feature = "bindings", derive(TS))]
6264pub struct RegexpExtractFunc {
6265 pub this: Expression,
6266 pub pattern: Expression,
6267 pub group: Option<Expression>,
6268}
6269
6270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6272#[cfg_attr(feature = "bindings", derive(TS))]
6273pub struct RoundFunc {
6274 pub this: Expression,
6275 pub decimals: Option<Expression>,
6276}
6277
6278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6280#[cfg_attr(feature = "bindings", derive(TS))]
6281pub struct FloorFunc {
6282 pub this: Expression,
6283 pub scale: Option<Expression>,
6284 #[serde(skip_serializing_if = "Option::is_none", default)]
6286 pub to: Option<Expression>,
6287}
6288
6289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6291#[cfg_attr(feature = "bindings", derive(TS))]
6292pub struct CeilFunc {
6293 pub this: Expression,
6294 #[serde(skip_serializing_if = "Option::is_none", default)]
6295 pub decimals: Option<Expression>,
6296 #[serde(skip_serializing_if = "Option::is_none", default)]
6298 pub to: Option<Expression>,
6299}
6300
6301#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6303#[cfg_attr(feature = "bindings", derive(TS))]
6304pub struct LogFunc {
6305 pub this: Expression,
6306 pub base: Option<Expression>,
6307}
6308
6309#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6311#[cfg_attr(feature = "bindings", derive(TS))]
6312pub struct CurrentDate;
6313
6314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6316#[cfg_attr(feature = "bindings", derive(TS))]
6317pub struct CurrentTime {
6318 pub precision: Option<u32>,
6319}
6320
6321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6323#[cfg_attr(feature = "bindings", derive(TS))]
6324pub struct CurrentTimestamp {
6325 pub precision: Option<u32>,
6326 #[serde(default)]
6328 pub sysdate: bool,
6329}
6330
6331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6333#[cfg_attr(feature = "bindings", derive(TS))]
6334pub struct CurrentTimestampLTZ {
6335 pub precision: Option<u32>,
6336}
6337
6338#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6340#[cfg_attr(feature = "bindings", derive(TS))]
6341pub struct AtTimeZone {
6342 pub this: Expression,
6344 pub zone: Expression,
6346}
6347
6348#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6350#[cfg_attr(feature = "bindings", derive(TS))]
6351pub struct DateAddFunc {
6352 pub this: Expression,
6353 pub interval: Expression,
6354 pub unit: IntervalUnit,
6355}
6356
6357#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6359#[cfg_attr(feature = "bindings", derive(TS))]
6360pub struct DateDiffFunc {
6361 pub this: Expression,
6362 pub expression: Expression,
6363 pub unit: Option<IntervalUnit>,
6364}
6365
6366#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6368#[cfg_attr(feature = "bindings", derive(TS))]
6369pub struct DateTruncFunc {
6370 pub this: Expression,
6371 pub unit: DateTimeField,
6372}
6373
6374#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6376#[cfg_attr(feature = "bindings", derive(TS))]
6377pub struct ExtractFunc {
6378 pub this: Expression,
6379 pub field: DateTimeField,
6380}
6381
6382#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6383#[cfg_attr(feature = "bindings", derive(TS))]
6384pub enum DateTimeField {
6385 Year,
6386 Month,
6387 Day,
6388 Hour,
6389 Minute,
6390 Second,
6391 Millisecond,
6392 Microsecond,
6393 DayOfWeek,
6394 DayOfYear,
6395 Week,
6396 WeekWithModifier(String),
6398 Quarter,
6399 Epoch,
6400 Timezone,
6401 TimezoneHour,
6402 TimezoneMinute,
6403 Date,
6404 Time,
6405 Custom(String),
6407}
6408
6409#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6411#[cfg_attr(feature = "bindings", derive(TS))]
6412pub struct ToDateFunc {
6413 pub this: Expression,
6414 pub format: Option<Expression>,
6415}
6416
6417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6419#[cfg_attr(feature = "bindings", derive(TS))]
6420pub struct ToTimestampFunc {
6421 pub this: Expression,
6422 pub format: Option<Expression>,
6423}
6424
6425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6427#[cfg_attr(feature = "bindings", derive(TS))]
6428pub struct IfFunc {
6429 pub condition: Expression,
6430 pub true_value: Expression,
6431 pub false_value: Option<Expression>,
6432 #[serde(skip_serializing_if = "Option::is_none", default)]
6434 pub original_name: Option<String>,
6435 #[serde(default, skip_serializing_if = "Option::is_none")]
6437 pub inferred_type: Option<DataType>,
6438}
6439
6440#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6442#[cfg_attr(feature = "bindings", derive(TS))]
6443pub struct Nvl2Func {
6444 pub this: Expression,
6445 pub true_value: Expression,
6446 pub false_value: Expression,
6447 #[serde(default, skip_serializing_if = "Option::is_none")]
6449 pub inferred_type: Option<DataType>,
6450}
6451
6452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6458#[cfg_attr(feature = "bindings", derive(TS))]
6459pub struct AggFunc {
6460 pub this: Expression,
6461 pub distinct: bool,
6462 pub filter: Option<Expression>,
6463 pub order_by: Vec<Ordered>,
6464 #[serde(skip_serializing_if = "Option::is_none", default)]
6466 pub name: Option<String>,
6467 #[serde(skip_serializing_if = "Option::is_none", default)]
6469 pub ignore_nulls: Option<bool>,
6470 #[serde(skip_serializing_if = "Option::is_none", default)]
6473 pub having_max: Option<(Box<Expression>, bool)>,
6474 #[serde(skip_serializing_if = "Option::is_none", default)]
6476 pub limit: Option<Box<Expression>>,
6477 #[serde(default, skip_serializing_if = "Option::is_none")]
6479 pub inferred_type: Option<DataType>,
6480}
6481
6482#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6484#[cfg_attr(feature = "bindings", derive(TS))]
6485pub struct CountFunc {
6486 pub this: Option<Expression>,
6487 pub star: bool,
6488 pub distinct: bool,
6489 pub filter: Option<Expression>,
6490 #[serde(default, skip_serializing_if = "Option::is_none")]
6492 pub ignore_nulls: Option<bool>,
6493 #[serde(default, skip_serializing_if = "Option::is_none")]
6495 pub original_name: Option<String>,
6496 #[serde(default, skip_serializing_if = "Option::is_none")]
6498 pub inferred_type: Option<DataType>,
6499}
6500
6501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6503#[cfg_attr(feature = "bindings", derive(TS))]
6504pub struct GroupConcatFunc {
6505 pub this: Expression,
6506 pub separator: Option<Expression>,
6507 pub order_by: Option<Vec<Ordered>>,
6508 pub distinct: bool,
6509 pub filter: Option<Expression>,
6510 #[serde(default, skip_serializing_if = "Option::is_none")]
6512 pub limit: Option<Box<Expression>>,
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 StringAggFunc {
6522 pub this: Expression,
6523 #[serde(default)]
6524 pub separator: Option<Expression>,
6525 #[serde(default)]
6526 pub order_by: Option<Vec<Ordered>>,
6527 #[serde(default)]
6528 pub distinct: bool,
6529 #[serde(default)]
6530 pub filter: Option<Expression>,
6531 #[serde(default, skip_serializing_if = "Option::is_none")]
6533 pub limit: Option<Box<Expression>>,
6534 #[serde(default, skip_serializing_if = "Option::is_none")]
6536 pub inferred_type: Option<DataType>,
6537}
6538
6539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6541#[cfg_attr(feature = "bindings", derive(TS))]
6542pub struct ListAggFunc {
6543 pub this: Expression,
6544 pub separator: Option<Expression>,
6545 pub on_overflow: Option<ListAggOverflow>,
6546 pub order_by: Option<Vec<Ordered>>,
6547 pub distinct: bool,
6548 pub filter: Option<Expression>,
6549 #[serde(default, skip_serializing_if = "Option::is_none")]
6551 pub inferred_type: Option<DataType>,
6552}
6553
6554#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6556#[cfg_attr(feature = "bindings", derive(TS))]
6557pub enum ListAggOverflow {
6558 Error,
6559 Truncate {
6560 filler: Option<Expression>,
6561 with_count: bool,
6562 },
6563}
6564
6565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6567#[cfg_attr(feature = "bindings", derive(TS))]
6568pub struct SumIfFunc {
6569 pub this: Expression,
6570 pub condition: Expression,
6571 pub filter: Option<Expression>,
6572 #[serde(default, skip_serializing_if = "Option::is_none")]
6574 pub inferred_type: Option<DataType>,
6575}
6576
6577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6579#[cfg_attr(feature = "bindings", derive(TS))]
6580pub struct ApproxPercentileFunc {
6581 pub this: Expression,
6582 pub percentile: Expression,
6583 pub accuracy: Option<Expression>,
6584 pub filter: Option<Expression>,
6585}
6586
6587#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6589#[cfg_attr(feature = "bindings", derive(TS))]
6590pub struct PercentileFunc {
6591 pub this: Expression,
6592 pub percentile: Expression,
6593 pub order_by: Option<Vec<Ordered>>,
6594 pub filter: Option<Expression>,
6595}
6596
6597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6603#[cfg_attr(feature = "bindings", derive(TS))]
6604pub struct RowNumber;
6605
6606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6608#[cfg_attr(feature = "bindings", derive(TS))]
6609pub struct Rank {
6610 #[serde(default, skip_serializing_if = "Option::is_none")]
6612 pub order_by: Option<Vec<Ordered>>,
6613 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6615 pub args: Vec<Expression>,
6616}
6617
6618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6620#[cfg_attr(feature = "bindings", derive(TS))]
6621pub struct DenseRank {
6622 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6624 pub args: Vec<Expression>,
6625}
6626
6627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6629#[cfg_attr(feature = "bindings", derive(TS))]
6630pub struct NTileFunc {
6631 #[serde(default, skip_serializing_if = "Option::is_none")]
6633 pub num_buckets: Option<Expression>,
6634 #[serde(default, skip_serializing_if = "Option::is_none")]
6636 pub order_by: Option<Vec<Ordered>>,
6637}
6638
6639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6641#[cfg_attr(feature = "bindings", derive(TS))]
6642pub struct LeadLagFunc {
6643 pub this: Expression,
6644 pub offset: Option<Expression>,
6645 pub default: Option<Expression>,
6646 #[serde(default, skip_serializing_if = "Option::is_none")]
6648 pub ignore_nulls: Option<bool>,
6649}
6650
6651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6653#[cfg_attr(feature = "bindings", derive(TS))]
6654pub struct ValueFunc {
6655 pub this: Expression,
6656 #[serde(default, skip_serializing_if = "Option::is_none")]
6658 pub ignore_nulls: Option<bool>,
6659 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6661 pub order_by: Vec<Ordered>,
6662}
6663
6664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6666#[cfg_attr(feature = "bindings", derive(TS))]
6667pub struct NthValueFunc {
6668 pub this: Expression,
6669 pub offset: Expression,
6670 #[serde(default, skip_serializing_if = "Option::is_none")]
6672 pub ignore_nulls: Option<bool>,
6673 #[serde(default, skip_serializing_if = "Option::is_none")]
6676 pub from_first: Option<bool>,
6677}
6678
6679#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6681#[cfg_attr(feature = "bindings", derive(TS))]
6682pub struct PercentRank {
6683 #[serde(default, skip_serializing_if = "Option::is_none")]
6685 pub order_by: Option<Vec<Ordered>>,
6686 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6688 pub args: Vec<Expression>,
6689}
6690
6691#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6693#[cfg_attr(feature = "bindings", derive(TS))]
6694pub struct CumeDist {
6695 #[serde(default, skip_serializing_if = "Option::is_none")]
6697 pub order_by: Option<Vec<Ordered>>,
6698 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6700 pub args: Vec<Expression>,
6701}
6702
6703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6709#[cfg_attr(feature = "bindings", derive(TS))]
6710pub struct PositionFunc {
6711 pub substring: Expression,
6712 pub string: Expression,
6713 pub start: Option<Expression>,
6714}
6715
6716#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6722#[cfg_attr(feature = "bindings", derive(TS))]
6723pub struct Random;
6724
6725#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6727#[cfg_attr(feature = "bindings", derive(TS))]
6728pub struct Rand {
6729 pub seed: Option<Box<Expression>>,
6730 #[serde(default)]
6732 pub lower: Option<Box<Expression>>,
6733 #[serde(default)]
6735 pub upper: Option<Box<Expression>>,
6736}
6737
6738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6740#[cfg_attr(feature = "bindings", derive(TS))]
6741pub struct TruncateFunc {
6742 pub this: Expression,
6743 pub decimals: Option<Expression>,
6744}
6745
6746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6748#[cfg_attr(feature = "bindings", derive(TS))]
6749pub struct Pi;
6750
6751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6757#[cfg_attr(feature = "bindings", derive(TS))]
6758pub struct DecodeFunc {
6759 pub this: Expression,
6760 pub search_results: Vec<(Expression, Expression)>,
6761 pub default: Option<Expression>,
6762}
6763
6764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6770#[cfg_attr(feature = "bindings", derive(TS))]
6771pub struct DateFormatFunc {
6772 pub this: Expression,
6773 pub format: Expression,
6774}
6775
6776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6778#[cfg_attr(feature = "bindings", derive(TS))]
6779pub struct FromUnixtimeFunc {
6780 pub this: Expression,
6781 pub format: Option<Expression>,
6782}
6783
6784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6786#[cfg_attr(feature = "bindings", derive(TS))]
6787pub struct UnixTimestampFunc {
6788 pub this: Option<Expression>,
6789 pub format: Option<Expression>,
6790}
6791
6792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6794#[cfg_attr(feature = "bindings", derive(TS))]
6795pub struct MakeDateFunc {
6796 pub year: Expression,
6797 pub month: Expression,
6798 pub day: Expression,
6799}
6800
6801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6803#[cfg_attr(feature = "bindings", derive(TS))]
6804pub struct MakeTimestampFunc {
6805 pub year: Expression,
6806 pub month: Expression,
6807 pub day: Expression,
6808 pub hour: Expression,
6809 pub minute: Expression,
6810 pub second: Expression,
6811 pub timezone: Option<Expression>,
6812}
6813
6814#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6816#[cfg_attr(feature = "bindings", derive(TS))]
6817pub struct LastDayFunc {
6818 pub this: Expression,
6819 #[serde(skip_serializing_if = "Option::is_none", default)]
6821 pub unit: Option<DateTimeField>,
6822}
6823
6824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6830#[cfg_attr(feature = "bindings", derive(TS))]
6831pub struct ArrayConstructor {
6832 pub expressions: Vec<Expression>,
6833 pub bracket_notation: bool,
6834 pub use_list_keyword: bool,
6836}
6837
6838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6840#[cfg_attr(feature = "bindings", derive(TS))]
6841pub struct ArraySortFunc {
6842 pub this: Expression,
6843 pub comparator: Option<Expression>,
6844 pub desc: bool,
6845 pub nulls_first: Option<bool>,
6846}
6847
6848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6850#[cfg_attr(feature = "bindings", derive(TS))]
6851pub struct ArrayJoinFunc {
6852 pub this: Expression,
6853 pub separator: Expression,
6854 pub null_replacement: Option<Expression>,
6855}
6856
6857#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6859#[cfg_attr(feature = "bindings", derive(TS))]
6860pub struct UnnestFunc {
6861 pub this: Expression,
6862 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6864 pub expressions: Vec<Expression>,
6865 pub with_ordinality: bool,
6866 pub alias: Option<Identifier>,
6867 #[serde(default, skip_serializing_if = "Option::is_none")]
6869 pub offset_alias: Option<Identifier>,
6870}
6871
6872#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6874#[cfg_attr(feature = "bindings", derive(TS))]
6875pub struct ArrayFilterFunc {
6876 pub this: Expression,
6877 pub filter: Expression,
6878}
6879
6880#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6882#[cfg_attr(feature = "bindings", derive(TS))]
6883pub struct ArrayTransformFunc {
6884 pub this: Expression,
6885 pub transform: Expression,
6886}
6887
6888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6890#[cfg_attr(feature = "bindings", derive(TS))]
6891pub struct SequenceFunc {
6892 pub start: Expression,
6893 pub stop: Expression,
6894 pub step: Option<Expression>,
6895}
6896
6897#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6903#[cfg_attr(feature = "bindings", derive(TS))]
6904pub struct StructConstructor {
6905 pub fields: Vec<(Option<Identifier>, Expression)>,
6906}
6907
6908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6910#[cfg_attr(feature = "bindings", derive(TS))]
6911pub struct StructExtractFunc {
6912 pub this: Expression,
6913 pub field: Identifier,
6914}
6915
6916#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6918#[cfg_attr(feature = "bindings", derive(TS))]
6919pub struct NamedStructFunc {
6920 pub pairs: Vec<(Expression, Expression)>,
6921}
6922
6923#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6929#[cfg_attr(feature = "bindings", derive(TS))]
6930pub struct MapConstructor {
6931 pub keys: Vec<Expression>,
6932 pub values: Vec<Expression>,
6933 #[serde(default)]
6935 pub curly_brace_syntax: bool,
6936 #[serde(default)]
6938 pub with_map_keyword: bool,
6939}
6940
6941#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6943#[cfg_attr(feature = "bindings", derive(TS))]
6944pub struct TransformFunc {
6945 pub this: Expression,
6946 pub transform: Expression,
6947}
6948
6949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6952#[cfg_attr(feature = "bindings", derive(TS))]
6953pub struct FunctionEmits {
6954 pub this: Expression,
6956 pub emits: Expression,
6958}
6959
6960#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6966#[cfg_attr(feature = "bindings", derive(TS))]
6967pub struct JsonExtractFunc {
6968 pub this: Expression,
6969 pub path: Expression,
6970 pub returning: Option<DataType>,
6971 #[serde(default)]
6973 pub arrow_syntax: bool,
6974 #[serde(default)]
6976 pub hash_arrow_syntax: bool,
6977 #[serde(default)]
6979 pub wrapper_option: Option<String>,
6980 #[serde(default)]
6982 pub quotes_option: Option<String>,
6983 #[serde(default)]
6985 pub on_scalar_string: bool,
6986 #[serde(default)]
6988 pub on_error: Option<String>,
6989}
6990
6991#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6993#[cfg_attr(feature = "bindings", derive(TS))]
6994pub struct JsonPathFunc {
6995 pub this: Expression,
6996 pub paths: Vec<Expression>,
6997}
6998
6999#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7001#[cfg_attr(feature = "bindings", derive(TS))]
7002pub struct JsonObjectFunc {
7003 pub pairs: Vec<(Expression, Expression)>,
7004 pub null_handling: Option<JsonNullHandling>,
7005 #[serde(default)]
7006 pub with_unique_keys: bool,
7007 #[serde(default)]
7008 pub returning_type: Option<DataType>,
7009 #[serde(default)]
7010 pub format_json: bool,
7011 #[serde(default)]
7012 pub encoding: Option<String>,
7013 #[serde(default)]
7015 pub star: bool,
7016}
7017
7018#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7020#[cfg_attr(feature = "bindings", derive(TS))]
7021pub enum JsonNullHandling {
7022 NullOnNull,
7023 AbsentOnNull,
7024}
7025
7026#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7028#[cfg_attr(feature = "bindings", derive(TS))]
7029pub struct JsonModifyFunc {
7030 pub this: Expression,
7031 pub path_values: Vec<(Expression, Expression)>,
7032}
7033
7034#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7036#[cfg_attr(feature = "bindings", derive(TS))]
7037pub struct JsonArrayAggFunc {
7038 pub this: Expression,
7039 pub order_by: Option<Vec<Ordered>>,
7040 pub null_handling: Option<JsonNullHandling>,
7041 pub filter: Option<Expression>,
7042}
7043
7044#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7046#[cfg_attr(feature = "bindings", derive(TS))]
7047pub struct JsonObjectAggFunc {
7048 pub key: Expression,
7049 pub value: Expression,
7050 pub null_handling: Option<JsonNullHandling>,
7051 pub filter: Option<Expression>,
7052}
7053
7054#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7060#[cfg_attr(feature = "bindings", derive(TS))]
7061pub struct ConvertFunc {
7062 pub this: Expression,
7063 pub to: DataType,
7064 pub style: Option<Expression>,
7065}
7066
7067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7073#[cfg_attr(feature = "bindings", derive(TS))]
7074pub struct LambdaExpr {
7075 pub parameters: Vec<Identifier>,
7076 pub body: Expression,
7077 #[serde(default)]
7079 pub colon: bool,
7080 #[serde(default)]
7083 pub parameter_types: Vec<Option<DataType>>,
7084}
7085
7086#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7088#[cfg_attr(feature = "bindings", derive(TS))]
7089pub struct Parameter {
7090 pub name: Option<String>,
7091 pub index: Option<u32>,
7092 pub style: ParameterStyle,
7093 #[serde(default)]
7095 pub quoted: bool,
7096 #[serde(default)]
7098 pub string_quoted: bool,
7099 #[serde(default)]
7101 pub expression: Option<String>,
7102}
7103
7104#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7106#[cfg_attr(feature = "bindings", derive(TS))]
7107pub enum ParameterStyle {
7108 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7118
7119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7121#[cfg_attr(feature = "bindings", derive(TS))]
7122pub struct Placeholder {
7123 pub index: Option<u32>,
7124}
7125
7126#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7128#[cfg_attr(feature = "bindings", derive(TS))]
7129pub struct NamedArgument {
7130 pub name: Identifier,
7131 pub value: Expression,
7132 pub separator: NamedArgSeparator,
7134}
7135
7136#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7138#[cfg_attr(feature = "bindings", derive(TS))]
7139pub enum NamedArgSeparator {
7140 DArrow,
7142 ColonEq,
7144 Eq,
7146}
7147
7148#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7151#[cfg_attr(feature = "bindings", derive(TS))]
7152pub struct TableArgument {
7153 pub prefix: String,
7155 pub this: Expression,
7157}
7158
7159#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7161#[cfg_attr(feature = "bindings", derive(TS))]
7162pub struct SqlComment {
7163 pub text: String,
7164 pub is_block: bool,
7165}
7166
7167#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7173#[cfg_attr(feature = "bindings", derive(TS))]
7174pub struct SimilarToExpr {
7175 pub this: Expression,
7176 pub pattern: Expression,
7177 pub escape: Option<Expression>,
7178 pub not: bool,
7179}
7180
7181#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7183#[cfg_attr(feature = "bindings", derive(TS))]
7184pub struct QuantifiedExpr {
7185 pub this: Expression,
7186 pub subquery: Expression,
7187 pub op: Option<QuantifiedOp>,
7188}
7189
7190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7192#[cfg_attr(feature = "bindings", derive(TS))]
7193pub enum QuantifiedOp {
7194 Eq,
7195 Neq,
7196 Lt,
7197 Lte,
7198 Gt,
7199 Gte,
7200}
7201
7202#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7207#[cfg_attr(feature = "bindings", derive(TS))]
7208pub struct OverlapsExpr {
7209 #[serde(skip_serializing_if = "Option::is_none")]
7211 pub this: Option<Expression>,
7212 #[serde(skip_serializing_if = "Option::is_none")]
7214 pub expression: Option<Expression>,
7215 #[serde(skip_serializing_if = "Option::is_none")]
7217 pub left_start: Option<Expression>,
7218 #[serde(skip_serializing_if = "Option::is_none")]
7220 pub left_end: Option<Expression>,
7221 #[serde(skip_serializing_if = "Option::is_none")]
7223 pub right_start: Option<Expression>,
7224 #[serde(skip_serializing_if = "Option::is_none")]
7226 pub right_end: Option<Expression>,
7227}
7228
7229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7235#[cfg_attr(feature = "bindings", derive(TS))]
7236pub struct Subscript {
7237 pub this: Expression,
7238 pub index: Expression,
7239}
7240
7241#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7243#[cfg_attr(feature = "bindings", derive(TS))]
7244pub struct DotAccess {
7245 pub this: Expression,
7246 pub field: Identifier,
7247}
7248
7249#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7251#[cfg_attr(feature = "bindings", derive(TS))]
7252pub struct MethodCall {
7253 pub this: Expression,
7254 pub method: Identifier,
7255 pub args: Vec<Expression>,
7256}
7257
7258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7260#[cfg_attr(feature = "bindings", derive(TS))]
7261pub struct ArraySlice {
7262 pub this: Expression,
7263 pub start: Option<Expression>,
7264 pub end: Option<Expression>,
7265}
7266
7267#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7273#[cfg_attr(feature = "bindings", derive(TS))]
7274pub enum OnCommit {
7275 PreserveRows,
7277 DeleteRows,
7279}
7280
7281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7283#[cfg_attr(feature = "bindings", derive(TS))]
7284pub struct CreateTable {
7285 pub name: TableRef,
7286 #[serde(default, skip_serializing_if = "Option::is_none")]
7288 pub on_cluster: Option<OnCluster>,
7289 pub columns: Vec<ColumnDef>,
7290 pub constraints: Vec<TableConstraint>,
7291 pub if_not_exists: bool,
7292 pub temporary: bool,
7293 pub or_replace: bool,
7294 #[serde(default, skip_serializing_if = "Option::is_none")]
7296 pub table_modifier: Option<String>,
7297 pub as_select: Option<Expression>,
7298 #[serde(default)]
7300 pub as_select_parenthesized: bool,
7301 #[serde(default)]
7303 pub on_commit: Option<OnCommit>,
7304 #[serde(default)]
7306 pub clone_source: Option<TableRef>,
7307 #[serde(default, skip_serializing_if = "Option::is_none")]
7309 pub clone_at_clause: Option<Expression>,
7310 #[serde(default)]
7312 pub is_copy: bool,
7313 #[serde(default)]
7315 pub shallow_clone: bool,
7316 #[serde(default)]
7318 pub deep_clone: bool,
7319 #[serde(default)]
7321 pub leading_comments: Vec<String>,
7322 #[serde(default)]
7324 pub with_properties: Vec<(String, String)>,
7325 #[serde(default)]
7327 pub teradata_post_name_options: Vec<String>,
7328 #[serde(default)]
7330 pub with_data: Option<bool>,
7331 #[serde(default)]
7333 pub with_statistics: Option<bool>,
7334 #[serde(default)]
7336 pub teradata_indexes: Vec<TeradataIndex>,
7337 #[serde(default)]
7339 pub with_cte: Option<With>,
7340 #[serde(default)]
7342 pub properties: Vec<Expression>,
7343 #[serde(default, skip_serializing_if = "Option::is_none")]
7345 pub partition_of: Option<Expression>,
7346 #[serde(default)]
7348 pub post_table_properties: Vec<Expression>,
7349 #[serde(default)]
7351 pub mysql_table_options: Vec<(String, String)>,
7352 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7354 pub inherits: Vec<TableRef>,
7355 #[serde(default, skip_serializing_if = "Option::is_none")]
7357 pub on_property: Option<OnProperty>,
7358 #[serde(default)]
7360 pub copy_grants: bool,
7361 #[serde(default, skip_serializing_if = "Option::is_none")]
7363 pub using_template: Option<Box<Expression>>,
7364 #[serde(default, skip_serializing_if = "Option::is_none")]
7366 pub rollup: Option<RollupProperty>,
7367 #[serde(default, skip_serializing_if = "Option::is_none")]
7369 pub uuid: Option<String>,
7370 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7374 pub with_partition_columns: Vec<ColumnDef>,
7375 #[serde(default, skip_serializing_if = "Option::is_none")]
7378 pub with_connection: Option<TableRef>,
7379}
7380
7381#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7383#[cfg_attr(feature = "bindings", derive(TS))]
7384pub struct TeradataIndex {
7385 pub kind: TeradataIndexKind,
7387 pub name: Option<String>,
7389 pub columns: Vec<String>,
7391}
7392
7393#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7395#[cfg_attr(feature = "bindings", derive(TS))]
7396pub enum TeradataIndexKind {
7397 NoPrimary,
7399 Primary,
7401 PrimaryAmp,
7403 Unique,
7405 UniquePrimary,
7407 Secondary,
7409}
7410
7411impl CreateTable {
7412 pub fn new(name: impl Into<String>) -> Self {
7413 Self {
7414 name: TableRef::new(name),
7415 on_cluster: None,
7416 columns: Vec::new(),
7417 constraints: Vec::new(),
7418 if_not_exists: false,
7419 temporary: false,
7420 or_replace: false,
7421 table_modifier: None,
7422 as_select: None,
7423 as_select_parenthesized: false,
7424 on_commit: None,
7425 clone_source: None,
7426 clone_at_clause: None,
7427 shallow_clone: false,
7428 deep_clone: false,
7429 is_copy: false,
7430 leading_comments: Vec::new(),
7431 with_properties: Vec::new(),
7432 teradata_post_name_options: Vec::new(),
7433 with_data: None,
7434 with_statistics: None,
7435 teradata_indexes: Vec::new(),
7436 with_cte: None,
7437 properties: Vec::new(),
7438 partition_of: None,
7439 post_table_properties: Vec::new(),
7440 mysql_table_options: Vec::new(),
7441 inherits: Vec::new(),
7442 on_property: None,
7443 copy_grants: false,
7444 using_template: None,
7445 rollup: None,
7446 uuid: None,
7447 with_partition_columns: Vec::new(),
7448 with_connection: None,
7449 }
7450 }
7451}
7452
7453#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
7455#[cfg_attr(feature = "bindings", derive(TS))]
7456pub enum SortOrder {
7457 Asc,
7458 Desc,
7459}
7460
7461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7463#[cfg_attr(feature = "bindings", derive(TS))]
7464pub enum ConstraintType {
7465 NotNull,
7466 Null,
7467 PrimaryKey,
7468 Unique,
7469 Default,
7470 AutoIncrement,
7471 Collate,
7472 Comment,
7473 References,
7474 Check,
7475 GeneratedAsIdentity,
7476 Tags,
7478 ComputedColumn,
7480 GeneratedAsRow,
7482 OnUpdate,
7484 Path,
7486 Encode,
7488}
7489
7490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7492#[cfg_attr(feature = "bindings", derive(TS))]
7493pub struct ColumnDef {
7494 pub name: Identifier,
7495 pub data_type: DataType,
7496 pub nullable: Option<bool>,
7497 pub default: Option<Expression>,
7498 pub primary_key: bool,
7499 #[serde(default)]
7501 pub primary_key_order: Option<SortOrder>,
7502 pub unique: bool,
7503 #[serde(default)]
7505 pub unique_nulls_not_distinct: bool,
7506 pub auto_increment: bool,
7507 pub comment: Option<String>,
7508 pub constraints: Vec<ColumnConstraint>,
7509 #[serde(default)]
7511 pub constraint_order: Vec<ConstraintType>,
7512 #[serde(default)]
7514 pub format: Option<String>,
7515 #[serde(default)]
7517 pub title: Option<String>,
7518 #[serde(default)]
7520 pub inline_length: Option<u64>,
7521 #[serde(default)]
7523 pub compress: Option<Vec<Expression>>,
7524 #[serde(default)]
7526 pub character_set: Option<String>,
7527 #[serde(default)]
7529 pub uppercase: bool,
7530 #[serde(default)]
7532 pub casespecific: Option<bool>,
7533 #[serde(default)]
7535 pub auto_increment_start: Option<Box<Expression>>,
7536 #[serde(default)]
7538 pub auto_increment_increment: Option<Box<Expression>>,
7539 #[serde(default)]
7541 pub auto_increment_order: Option<bool>,
7542 #[serde(default)]
7544 pub unsigned: bool,
7545 #[serde(default)]
7547 pub zerofill: bool,
7548 #[serde(default, skip_serializing_if = "Option::is_none")]
7550 pub on_update: Option<Expression>,
7551 #[serde(default, skip_serializing_if = "Option::is_none")]
7553 pub visible: Option<bool>,
7554 #[serde(default, skip_serializing_if = "Option::is_none")]
7556 pub unique_constraint_name: Option<String>,
7557 #[serde(default, skip_serializing_if = "Option::is_none")]
7559 pub not_null_constraint_name: Option<String>,
7560 #[serde(default, skip_serializing_if = "Option::is_none")]
7562 pub primary_key_constraint_name: Option<String>,
7563 #[serde(default, skip_serializing_if = "Option::is_none")]
7565 pub check_constraint_name: Option<String>,
7566 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7568 pub options: Vec<Expression>,
7569 #[serde(default)]
7571 pub no_type: bool,
7572 #[serde(default, skip_serializing_if = "Option::is_none")]
7574 pub encoding: Option<String>,
7575 #[serde(default, skip_serializing_if = "Option::is_none")]
7577 pub codec: Option<String>,
7578 #[serde(default, skip_serializing_if = "Option::is_none")]
7580 pub ephemeral: Option<Option<Box<Expression>>>,
7581 #[serde(default, skip_serializing_if = "Option::is_none")]
7583 pub materialized_expr: Option<Box<Expression>>,
7584 #[serde(default, skip_serializing_if = "Option::is_none")]
7586 pub alias_expr: Option<Box<Expression>>,
7587 #[serde(default, skip_serializing_if = "Option::is_none")]
7589 pub ttl_expr: Option<Box<Expression>>,
7590 #[serde(default)]
7592 pub not_for_replication: bool,
7593}
7594
7595impl ColumnDef {
7596 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7597 Self {
7598 name: Identifier::new(name),
7599 data_type,
7600 nullable: None,
7601 default: None,
7602 primary_key: false,
7603 primary_key_order: None,
7604 unique: false,
7605 unique_nulls_not_distinct: false,
7606 auto_increment: false,
7607 comment: None,
7608 constraints: Vec::new(),
7609 constraint_order: Vec::new(),
7610 format: None,
7611 title: None,
7612 inline_length: None,
7613 compress: None,
7614 character_set: None,
7615 uppercase: false,
7616 casespecific: None,
7617 auto_increment_start: None,
7618 auto_increment_increment: None,
7619 auto_increment_order: None,
7620 unsigned: false,
7621 zerofill: false,
7622 on_update: None,
7623 visible: None,
7624 unique_constraint_name: None,
7625 not_null_constraint_name: None,
7626 primary_key_constraint_name: None,
7627 check_constraint_name: None,
7628 options: Vec::new(),
7629 no_type: false,
7630 encoding: None,
7631 codec: None,
7632 ephemeral: None,
7633 materialized_expr: None,
7634 alias_expr: None,
7635 ttl_expr: None,
7636 not_for_replication: false,
7637 }
7638 }
7639}
7640
7641#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7643#[cfg_attr(feature = "bindings", derive(TS))]
7644pub enum ColumnConstraint {
7645 NotNull,
7646 Null,
7647 Unique,
7648 PrimaryKey,
7649 Default(Expression),
7650 Check(Expression),
7651 References(ForeignKeyRef),
7652 GeneratedAsIdentity(GeneratedAsIdentity),
7653 Collate(Identifier),
7654 Comment(String),
7655 Tags(Tags),
7657 ComputedColumn(ComputedColumn),
7660 GeneratedAsRow(GeneratedAsRow),
7662 Path(Expression),
7664}
7665
7666#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7668#[cfg_attr(feature = "bindings", derive(TS))]
7669pub struct ComputedColumn {
7670 pub expression: Box<Expression>,
7672 #[serde(default)]
7674 pub persisted: bool,
7675 #[serde(default)]
7677 pub not_null: bool,
7678 #[serde(default)]
7681 pub persistence_kind: Option<String>,
7682 #[serde(default, skip_serializing_if = "Option::is_none")]
7684 pub data_type: Option<DataType>,
7685}
7686
7687#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7689#[cfg_attr(feature = "bindings", derive(TS))]
7690pub struct GeneratedAsRow {
7691 pub start: bool,
7693 #[serde(default)]
7695 pub hidden: bool,
7696}
7697
7698#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7700#[cfg_attr(feature = "bindings", derive(TS))]
7701pub struct GeneratedAsIdentity {
7702 pub always: bool,
7704 pub on_null: bool,
7706 pub start: Option<Box<Expression>>,
7708 pub increment: Option<Box<Expression>>,
7710 pub minvalue: Option<Box<Expression>>,
7712 pub maxvalue: Option<Box<Expression>>,
7714 pub cycle: Option<bool>,
7716}
7717
7718#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
7720#[cfg_attr(feature = "bindings", derive(TS))]
7721pub struct ConstraintModifiers {
7722 pub enforced: Option<bool>,
7724 pub deferrable: Option<bool>,
7726 pub initially_deferred: Option<bool>,
7728 pub norely: bool,
7730 pub rely: bool,
7732 #[serde(default)]
7734 pub using: Option<String>,
7735 #[serde(default)]
7737 pub using_before_columns: bool,
7738 #[serde(default, skip_serializing_if = "Option::is_none")]
7740 pub comment: Option<String>,
7741 #[serde(default, skip_serializing_if = "Option::is_none")]
7743 pub visible: Option<bool>,
7744 #[serde(default, skip_serializing_if = "Option::is_none")]
7746 pub engine_attribute: Option<String>,
7747 #[serde(default, skip_serializing_if = "Option::is_none")]
7749 pub with_parser: Option<String>,
7750 #[serde(default)]
7752 pub not_valid: bool,
7753 #[serde(default, skip_serializing_if = "Option::is_none")]
7755 pub clustered: Option<String>,
7756 #[serde(default, skip_serializing_if = "Option::is_none")]
7758 pub on_conflict: Option<String>,
7759 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7761 pub with_options: Vec<(String, String)>,
7762 #[serde(default, skip_serializing_if = "Option::is_none")]
7764 pub on_filegroup: Option<Identifier>,
7765}
7766
7767#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7769#[cfg_attr(feature = "bindings", derive(TS))]
7770pub enum TableConstraint {
7771 PrimaryKey {
7772 name: Option<Identifier>,
7773 columns: Vec<Identifier>,
7774 #[serde(default)]
7776 include_columns: Vec<Identifier>,
7777 #[serde(default)]
7778 modifiers: ConstraintModifiers,
7779 #[serde(default)]
7781 has_constraint_keyword: bool,
7782 },
7783 Unique {
7784 name: Option<Identifier>,
7785 columns: Vec<Identifier>,
7786 #[serde(default)]
7788 columns_parenthesized: bool,
7789 #[serde(default)]
7790 modifiers: ConstraintModifiers,
7791 #[serde(default)]
7793 has_constraint_keyword: bool,
7794 #[serde(default)]
7796 nulls_not_distinct: bool,
7797 },
7798 ForeignKey {
7799 name: Option<Identifier>,
7800 columns: Vec<Identifier>,
7801 #[serde(default)]
7802 references: Option<ForeignKeyRef>,
7803 #[serde(default)]
7805 on_delete: Option<ReferentialAction>,
7806 #[serde(default)]
7808 on_update: Option<ReferentialAction>,
7809 #[serde(default)]
7810 modifiers: ConstraintModifiers,
7811 },
7812 Check {
7813 name: Option<Identifier>,
7814 expression: Expression,
7815 #[serde(default)]
7816 modifiers: ConstraintModifiers,
7817 },
7818 Assume {
7820 name: Option<Identifier>,
7821 expression: Expression,
7822 },
7823 Default {
7825 name: Option<Identifier>,
7826 expression: Expression,
7827 column: Identifier,
7828 },
7829 Index {
7831 name: Option<Identifier>,
7832 columns: Vec<Identifier>,
7833 #[serde(default)]
7835 kind: Option<String>,
7836 #[serde(default)]
7837 modifiers: ConstraintModifiers,
7838 #[serde(default)]
7840 use_key_keyword: bool,
7841 #[serde(default, skip_serializing_if = "Option::is_none")]
7843 expression: Option<Box<Expression>>,
7844 #[serde(default, skip_serializing_if = "Option::is_none")]
7846 index_type: Option<Box<Expression>>,
7847 #[serde(default, skip_serializing_if = "Option::is_none")]
7849 granularity: Option<Box<Expression>>,
7850 },
7851 Projection {
7853 name: Identifier,
7854 expression: Expression,
7855 },
7856 Like {
7858 source: TableRef,
7859 options: Vec<(LikeOptionAction, String)>,
7861 },
7862 PeriodForSystemTime {
7864 start_col: Identifier,
7865 end_col: Identifier,
7866 },
7867 Exclude {
7870 name: Option<Identifier>,
7871 #[serde(default)]
7873 using: Option<String>,
7874 elements: Vec<ExcludeElement>,
7876 #[serde(default)]
7878 include_columns: Vec<Identifier>,
7879 #[serde(default)]
7881 where_clause: Option<Box<Expression>>,
7882 #[serde(default)]
7884 with_params: Vec<(String, String)>,
7885 #[serde(default)]
7887 using_index_tablespace: Option<String>,
7888 #[serde(default)]
7889 modifiers: ConstraintModifiers,
7890 },
7891 Tags(Tags),
7893 InitiallyDeferred {
7897 deferred: bool,
7899 },
7900}
7901
7902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7904#[cfg_attr(feature = "bindings", derive(TS))]
7905pub struct ExcludeElement {
7906 pub expression: String,
7908 pub operator: String,
7910}
7911
7912#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7914#[cfg_attr(feature = "bindings", derive(TS))]
7915pub enum LikeOptionAction {
7916 Including,
7917 Excluding,
7918}
7919
7920#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7922#[cfg_attr(feature = "bindings", derive(TS))]
7923pub enum MatchType {
7924 Full,
7925 Partial,
7926 Simple,
7927}
7928
7929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7931#[cfg_attr(feature = "bindings", derive(TS))]
7932pub struct ForeignKeyRef {
7933 pub table: TableRef,
7934 pub columns: Vec<Identifier>,
7935 pub on_delete: Option<ReferentialAction>,
7936 pub on_update: Option<ReferentialAction>,
7937 #[serde(default)]
7939 pub on_update_first: bool,
7940 #[serde(default)]
7942 pub match_type: Option<MatchType>,
7943 #[serde(default)]
7945 pub match_after_actions: bool,
7946 #[serde(default)]
7948 pub constraint_name: Option<String>,
7949 #[serde(default)]
7951 pub deferrable: Option<bool>,
7952 #[serde(default)]
7954 pub has_foreign_key_keywords: bool,
7955}
7956
7957#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
7959#[cfg_attr(feature = "bindings", derive(TS))]
7960pub enum ReferentialAction {
7961 Cascade,
7962 SetNull,
7963 SetDefault,
7964 Restrict,
7965 NoAction,
7966}
7967
7968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7970#[cfg_attr(feature = "bindings", derive(TS))]
7971pub struct DropTable {
7972 pub names: Vec<TableRef>,
7973 pub if_exists: bool,
7974 pub cascade: bool,
7975 #[serde(default)]
7977 pub cascade_constraints: bool,
7978 #[serde(default)]
7980 pub purge: bool,
7981 #[serde(default)]
7983 pub leading_comments: Vec<String>,
7984 #[serde(default, skip_serializing_if = "Option::is_none")]
7987 pub object_id_args: Option<String>,
7988 #[serde(default)]
7990 pub sync: bool,
7991 #[serde(default)]
7993 pub iceberg: bool,
7994 #[serde(default)]
7996 pub restrict: bool,
7997}
7998
7999impl DropTable {
8000 pub fn new(name: impl Into<String>) -> Self {
8001 Self {
8002 names: vec![TableRef::new(name)],
8003 if_exists: false,
8004 cascade: false,
8005 cascade_constraints: false,
8006 purge: false,
8007 leading_comments: Vec::new(),
8008 object_id_args: None,
8009 sync: false,
8010 iceberg: false,
8011 restrict: false,
8012 }
8013 }
8014}
8015
8016#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8018#[cfg_attr(feature = "bindings", derive(TS))]
8019pub struct Undrop {
8020 pub kind: String,
8022 pub name: TableRef,
8024 #[serde(default)]
8026 pub if_exists: bool,
8027}
8028
8029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8031#[cfg_attr(feature = "bindings", derive(TS))]
8032pub struct AlterTable {
8033 pub name: TableRef,
8034 pub actions: Vec<AlterTableAction>,
8035 #[serde(default)]
8037 pub if_exists: bool,
8038 #[serde(default, skip_serializing_if = "Option::is_none")]
8040 pub algorithm: Option<String>,
8041 #[serde(default, skip_serializing_if = "Option::is_none")]
8043 pub lock: Option<String>,
8044 #[serde(default, skip_serializing_if = "Option::is_none")]
8046 pub with_check: Option<String>,
8047 #[serde(default, skip_serializing_if = "Option::is_none")]
8049 pub partition: Option<Vec<(Identifier, Expression)>>,
8050 #[serde(default, skip_serializing_if = "Option::is_none")]
8052 pub on_cluster: Option<OnCluster>,
8053 #[serde(default, skip_serializing_if = "Option::is_none")]
8055 pub table_modifier: Option<String>,
8056}
8057
8058impl AlterTable {
8059 pub fn new(name: impl Into<String>) -> Self {
8060 Self {
8061 name: TableRef::new(name),
8062 actions: Vec::new(),
8063 if_exists: false,
8064 algorithm: None,
8065 lock: None,
8066 with_check: None,
8067 partition: None,
8068 on_cluster: None,
8069 table_modifier: None,
8070 }
8071 }
8072}
8073
8074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8076#[cfg_attr(feature = "bindings", derive(TS))]
8077pub enum ColumnPosition {
8078 First,
8079 After(Identifier),
8080}
8081
8082#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8084#[cfg_attr(feature = "bindings", derive(TS))]
8085pub enum AlterTableAction {
8086 AddColumn {
8087 column: ColumnDef,
8088 if_not_exists: bool,
8089 position: Option<ColumnPosition>,
8090 },
8091 DropColumn {
8092 name: Identifier,
8093 if_exists: bool,
8094 cascade: bool,
8095 },
8096 RenameColumn {
8097 old_name: Identifier,
8098 new_name: Identifier,
8099 if_exists: bool,
8100 },
8101 AlterColumn {
8102 name: Identifier,
8103 action: AlterColumnAction,
8104 #[serde(default)]
8106 use_modify_keyword: bool,
8107 },
8108 RenameTable(TableRef),
8109 AddConstraint(TableConstraint),
8110 DropConstraint {
8111 name: Identifier,
8112 if_exists: bool,
8113 },
8114 DropForeignKey {
8116 name: Identifier,
8117 },
8118 DropPartition {
8120 partitions: Vec<Vec<(Identifier, Expression)>>,
8122 if_exists: bool,
8123 },
8124 AddPartition {
8126 partition: Expression,
8128 if_not_exists: bool,
8129 location: Option<Expression>,
8130 },
8131 Delete {
8133 where_clause: Expression,
8134 },
8135 SwapWith(TableRef),
8137 SetProperty {
8139 properties: Vec<(String, Expression)>,
8140 },
8141 UnsetProperty {
8143 properties: Vec<String>,
8144 },
8145 ClusterBy {
8147 expressions: Vec<Expression>,
8148 },
8149 SetTag {
8151 expressions: Vec<(String, Expression)>,
8152 },
8153 UnsetTag {
8155 names: Vec<String>,
8156 },
8157 SetOptions {
8159 expressions: Vec<Expression>,
8160 },
8161 AlterIndex {
8163 name: Identifier,
8164 visible: bool,
8165 },
8166 SetAttribute {
8168 attribute: String,
8169 },
8170 SetStageFileFormat {
8172 options: Option<Expression>,
8173 },
8174 SetStageCopyOptions {
8176 options: Option<Expression>,
8177 },
8178 AddColumns {
8180 columns: Vec<ColumnDef>,
8181 cascade: bool,
8182 },
8183 DropColumns {
8185 names: Vec<Identifier>,
8186 },
8187 ChangeColumn {
8190 old_name: Identifier,
8191 new_name: Identifier,
8192 #[serde(default, skip_serializing_if = "Option::is_none")]
8193 data_type: Option<DataType>,
8194 comment: Option<String>,
8195 #[serde(default)]
8196 cascade: bool,
8197 },
8198 AlterSortKey {
8201 this: Option<String>,
8203 expressions: Vec<Expression>,
8205 compound: bool,
8207 },
8208 AlterDistStyle {
8212 style: String,
8214 distkey: Option<Identifier>,
8216 },
8217 SetTableProperties {
8219 properties: Vec<(Expression, Expression)>,
8220 },
8221 SetLocation {
8223 location: String,
8224 },
8225 SetFileFormat {
8227 format: String,
8228 },
8229 ReplacePartition {
8231 partition: Expression,
8232 source: Option<Box<Expression>>,
8233 },
8234 Raw {
8236 sql: String,
8237 },
8238}
8239
8240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8242#[cfg_attr(feature = "bindings", derive(TS))]
8243pub enum AlterColumnAction {
8244 SetDataType {
8245 data_type: DataType,
8246 using: Option<Expression>,
8248 #[serde(default, skip_serializing_if = "Option::is_none")]
8250 collate: Option<String>,
8251 },
8252 SetDefault(Expression),
8253 DropDefault,
8254 SetNotNull,
8255 DropNotNull,
8256 Comment(String),
8258 SetVisible,
8260 SetInvisible,
8262}
8263
8264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8266#[cfg_attr(feature = "bindings", derive(TS))]
8267pub struct CreateIndex {
8268 pub name: Identifier,
8269 pub table: TableRef,
8270 pub columns: Vec<IndexColumn>,
8271 pub unique: bool,
8272 pub if_not_exists: bool,
8273 pub using: Option<String>,
8274 #[serde(default)]
8276 pub clustered: Option<String>,
8277 #[serde(default)]
8279 pub concurrently: bool,
8280 #[serde(default)]
8282 pub where_clause: Option<Box<Expression>>,
8283 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8285 pub include_columns: Vec<Identifier>,
8286 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8288 pub with_options: Vec<(String, String)>,
8289 #[serde(default)]
8291 pub on_filegroup: Option<String>,
8292}
8293
8294impl CreateIndex {
8295 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8296 Self {
8297 name: Identifier::new(name),
8298 table: TableRef::new(table),
8299 columns: Vec::new(),
8300 unique: false,
8301 if_not_exists: false,
8302 using: None,
8303 clustered: None,
8304 concurrently: false,
8305 where_clause: None,
8306 include_columns: Vec::new(),
8307 with_options: Vec::new(),
8308 on_filegroup: None,
8309 }
8310 }
8311}
8312
8313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8315#[cfg_attr(feature = "bindings", derive(TS))]
8316pub struct IndexColumn {
8317 pub column: Identifier,
8318 pub desc: bool,
8319 #[serde(default)]
8321 pub asc: bool,
8322 pub nulls_first: Option<bool>,
8323 #[serde(default, skip_serializing_if = "Option::is_none")]
8325 pub opclass: Option<String>,
8326}
8327
8328#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8330#[cfg_attr(feature = "bindings", derive(TS))]
8331pub struct DropIndex {
8332 pub name: Identifier,
8333 pub table: Option<TableRef>,
8334 pub if_exists: bool,
8335 #[serde(default)]
8337 pub concurrently: bool,
8338}
8339
8340impl DropIndex {
8341 pub fn new(name: impl Into<String>) -> Self {
8342 Self {
8343 name: Identifier::new(name),
8344 table: None,
8345 if_exists: false,
8346 concurrently: false,
8347 }
8348 }
8349}
8350
8351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8353#[cfg_attr(feature = "bindings", derive(TS))]
8354pub struct ViewColumn {
8355 pub name: Identifier,
8356 pub comment: Option<String>,
8357 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8359 pub options: Vec<Expression>,
8360}
8361
8362impl ViewColumn {
8363 pub fn new(name: impl Into<String>) -> Self {
8364 Self {
8365 name: Identifier::new(name),
8366 comment: None,
8367 options: Vec::new(),
8368 }
8369 }
8370
8371 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8372 Self {
8373 name: Identifier::new(name),
8374 comment: Some(comment.into()),
8375 options: Vec::new(),
8376 }
8377 }
8378}
8379
8380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8382#[cfg_attr(feature = "bindings", derive(TS))]
8383pub struct CreateView {
8384 pub name: TableRef,
8385 pub columns: Vec<ViewColumn>,
8386 pub query: Expression,
8387 pub or_replace: bool,
8388 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8390 pub or_alter: bool,
8391 pub if_not_exists: bool,
8392 pub materialized: bool,
8393 pub temporary: bool,
8394 #[serde(default)]
8396 pub secure: bool,
8397 #[serde(skip_serializing_if = "Option::is_none")]
8399 pub algorithm: Option<String>,
8400 #[serde(skip_serializing_if = "Option::is_none")]
8402 pub definer: Option<String>,
8403 #[serde(skip_serializing_if = "Option::is_none")]
8405 pub security: Option<FunctionSecurity>,
8406 #[serde(default = "default_true")]
8408 pub security_sql_style: bool,
8409 #[serde(default)]
8411 pub security_after_name: bool,
8412 #[serde(default)]
8414 pub query_parenthesized: bool,
8415 #[serde(skip_serializing_if = "Option::is_none")]
8417 pub locking_mode: Option<String>,
8418 #[serde(skip_serializing_if = "Option::is_none")]
8420 pub locking_access: Option<String>,
8421 #[serde(default)]
8423 pub copy_grants: bool,
8424 #[serde(skip_serializing_if = "Option::is_none", default)]
8426 pub comment: Option<String>,
8427 #[serde(skip_serializing_if = "Option::is_none", default)]
8429 pub row_access_policy: Option<String>,
8430 #[serde(default)]
8432 pub tags: Vec<(String, String)>,
8433 #[serde(default)]
8435 pub options: Vec<Expression>,
8436 #[serde(skip_serializing_if = "Option::is_none", default)]
8438 pub build: Option<String>,
8439 #[serde(skip_serializing_if = "Option::is_none", default)]
8441 pub refresh: Option<Box<RefreshTriggerProperty>>,
8442 #[serde(skip_serializing_if = "Option::is_none", default)]
8445 pub schema: Option<Box<Schema>>,
8446 #[serde(skip_serializing_if = "Option::is_none", default)]
8448 pub unique_key: Option<Box<UniqueKeyProperty>>,
8449 #[serde(default)]
8451 pub no_schema_binding: bool,
8452 #[serde(skip_serializing_if = "Option::is_none", default)]
8454 pub auto_refresh: Option<bool>,
8455 #[serde(skip_serializing_if = "Option::is_none", default)]
8457 pub clickhouse_population: Option<String>,
8458 #[serde(default, skip_serializing_if = "Option::is_none")]
8460 pub on_cluster: Option<OnCluster>,
8461 #[serde(default, skip_serializing_if = "Option::is_none")]
8463 pub to_table: Option<TableRef>,
8464 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8466 pub table_properties: Vec<Expression>,
8467}
8468
8469impl CreateView {
8470 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8471 Self {
8472 name: TableRef::new(name),
8473 columns: Vec::new(),
8474 query,
8475 or_replace: false,
8476 or_alter: false,
8477 if_not_exists: false,
8478 materialized: false,
8479 temporary: false,
8480 secure: false,
8481 algorithm: None,
8482 definer: None,
8483 security: None,
8484 security_sql_style: true,
8485 security_after_name: false,
8486 query_parenthesized: false,
8487 locking_mode: None,
8488 locking_access: None,
8489 copy_grants: false,
8490 comment: None,
8491 row_access_policy: None,
8492 tags: Vec::new(),
8493 options: Vec::new(),
8494 build: None,
8495 refresh: None,
8496 schema: None,
8497 unique_key: None,
8498 no_schema_binding: false,
8499 auto_refresh: None,
8500 clickhouse_population: None,
8501 on_cluster: None,
8502 to_table: None,
8503 table_properties: Vec::new(),
8504 }
8505 }
8506}
8507
8508#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8510#[cfg_attr(feature = "bindings", derive(TS))]
8511pub struct DropView {
8512 pub name: TableRef,
8513 pub if_exists: bool,
8514 pub materialized: bool,
8515}
8516
8517impl DropView {
8518 pub fn new(name: impl Into<String>) -> Self {
8519 Self {
8520 name: TableRef::new(name),
8521 if_exists: false,
8522 materialized: false,
8523 }
8524 }
8525}
8526
8527#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8529#[cfg_attr(feature = "bindings", derive(TS))]
8530pub struct Truncate {
8531 #[serde(default)]
8533 pub target: TruncateTarget,
8534 #[serde(default)]
8536 pub if_exists: bool,
8537 pub table: TableRef,
8538 #[serde(default, skip_serializing_if = "Option::is_none")]
8540 pub on_cluster: Option<OnCluster>,
8541 pub cascade: bool,
8542 #[serde(default)]
8544 pub extra_tables: Vec<TruncateTableEntry>,
8545 #[serde(default)]
8547 pub identity: Option<TruncateIdentity>,
8548 #[serde(default)]
8550 pub restrict: bool,
8551 #[serde(default, skip_serializing_if = "Option::is_none")]
8553 pub partition: Option<Box<Expression>>,
8554}
8555
8556#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8558#[cfg_attr(feature = "bindings", derive(TS))]
8559pub struct TruncateTableEntry {
8560 pub table: TableRef,
8561 #[serde(default)]
8563 pub star: bool,
8564}
8565
8566#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8568#[cfg_attr(feature = "bindings", derive(TS))]
8569pub enum TruncateTarget {
8570 Table,
8571 Database,
8572}
8573
8574impl Default for TruncateTarget {
8575 fn default() -> Self {
8576 TruncateTarget::Table
8577 }
8578}
8579
8580#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8582#[cfg_attr(feature = "bindings", derive(TS))]
8583pub enum TruncateIdentity {
8584 Restart,
8585 Continue,
8586}
8587
8588impl Truncate {
8589 pub fn new(table: impl Into<String>) -> Self {
8590 Self {
8591 target: TruncateTarget::Table,
8592 if_exists: false,
8593 table: TableRef::new(table),
8594 on_cluster: None,
8595 cascade: false,
8596 extra_tables: Vec::new(),
8597 identity: None,
8598 restrict: false,
8599 partition: None,
8600 }
8601 }
8602}
8603
8604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8606#[cfg_attr(feature = "bindings", derive(TS))]
8607pub struct Use {
8608 pub kind: Option<UseKind>,
8610 pub this: Identifier,
8612}
8613
8614#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
8616#[cfg_attr(feature = "bindings", derive(TS))]
8617pub enum UseKind {
8618 Database,
8619 Schema,
8620 Role,
8621 Warehouse,
8622 Catalog,
8623 SecondaryRoles,
8625}
8626
8627#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8629#[cfg_attr(feature = "bindings", derive(TS))]
8630pub struct SetStatement {
8631 pub items: Vec<SetItem>,
8633}
8634
8635#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8637#[cfg_attr(feature = "bindings", derive(TS))]
8638pub struct SetItem {
8639 pub name: Expression,
8641 pub value: Expression,
8643 pub kind: Option<String>,
8645 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8647 pub no_equals: bool,
8648}
8649
8650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8652#[cfg_attr(feature = "bindings", derive(TS))]
8653pub struct Cache {
8654 pub table: Identifier,
8656 pub lazy: bool,
8658 pub options: Vec<(Expression, Expression)>,
8660 pub query: Option<Expression>,
8662}
8663
8664#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8666#[cfg_attr(feature = "bindings", derive(TS))]
8667pub struct Uncache {
8668 pub table: Identifier,
8670 pub if_exists: bool,
8672}
8673
8674#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8676#[cfg_attr(feature = "bindings", derive(TS))]
8677pub struct LoadData {
8678 pub local: bool,
8680 pub inpath: String,
8682 pub overwrite: bool,
8684 pub table: Expression,
8686 pub partition: Vec<(Identifier, Expression)>,
8688 pub input_format: Option<String>,
8690 pub serde: Option<String>,
8692}
8693
8694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8696#[cfg_attr(feature = "bindings", derive(TS))]
8697pub struct Pragma {
8698 pub schema: Option<Identifier>,
8700 pub name: Identifier,
8702 pub value: Option<Expression>,
8704 pub args: Vec<Expression>,
8706 #[serde(default)]
8708 pub use_assignment_syntax: bool,
8709}
8710
8711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8714#[cfg_attr(feature = "bindings", derive(TS))]
8715pub struct Privilege {
8716 pub name: String,
8718 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8720 pub columns: Vec<String>,
8721}
8722
8723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8725#[cfg_attr(feature = "bindings", derive(TS))]
8726pub struct GrantPrincipal {
8727 pub name: Identifier,
8729 pub is_role: bool,
8731 #[serde(default)]
8733 pub is_group: bool,
8734 #[serde(default)]
8736 pub is_share: bool,
8737}
8738
8739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8741#[cfg_attr(feature = "bindings", derive(TS))]
8742pub struct Grant {
8743 pub privileges: Vec<Privilege>,
8745 pub kind: Option<String>,
8747 pub securable: Identifier,
8749 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8751 pub function_params: Vec<String>,
8752 pub principals: Vec<GrantPrincipal>,
8754 pub grant_option: bool,
8756 #[serde(default, skip_serializing_if = "Option::is_none")]
8758 pub as_principal: Option<Identifier>,
8759}
8760
8761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8763#[cfg_attr(feature = "bindings", derive(TS))]
8764pub struct Revoke {
8765 pub privileges: Vec<Privilege>,
8767 pub kind: Option<String>,
8769 pub securable: Identifier,
8771 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8773 pub function_params: Vec<String>,
8774 pub principals: Vec<GrantPrincipal>,
8776 pub grant_option: bool,
8778 pub cascade: bool,
8780 #[serde(default)]
8782 pub restrict: bool,
8783}
8784
8785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8787#[cfg_attr(feature = "bindings", derive(TS))]
8788pub struct Comment {
8789 pub this: Expression,
8791 pub kind: String,
8793 pub expression: Expression,
8795 pub exists: bool,
8797 pub materialized: bool,
8799}
8800
8801#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8807#[cfg_attr(feature = "bindings", derive(TS))]
8808pub struct AlterView {
8809 pub name: TableRef,
8810 pub actions: Vec<AlterViewAction>,
8811 #[serde(default, skip_serializing_if = "Option::is_none")]
8813 pub algorithm: Option<String>,
8814 #[serde(default, skip_serializing_if = "Option::is_none")]
8816 pub definer: Option<String>,
8817 #[serde(default, skip_serializing_if = "Option::is_none")]
8819 pub sql_security: Option<String>,
8820 #[serde(default, skip_serializing_if = "Option::is_none")]
8822 pub with_option: Option<String>,
8823 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8825 pub columns: Vec<ViewColumn>,
8826}
8827
8828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8830#[cfg_attr(feature = "bindings", derive(TS))]
8831pub enum AlterViewAction {
8832 Rename(TableRef),
8834 OwnerTo(Identifier),
8836 SetSchema(Identifier),
8838 SetAuthorization(String),
8840 AlterColumn {
8842 name: Identifier,
8843 action: AlterColumnAction,
8844 },
8845 AsSelect(Box<Expression>),
8847 SetTblproperties(Vec<(String, String)>),
8849 UnsetTblproperties(Vec<String>),
8851}
8852
8853impl AlterView {
8854 pub fn new(name: impl Into<String>) -> Self {
8855 Self {
8856 name: TableRef::new(name),
8857 actions: Vec::new(),
8858 algorithm: None,
8859 definer: None,
8860 sql_security: None,
8861 with_option: None,
8862 columns: Vec::new(),
8863 }
8864 }
8865}
8866
8867#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8869#[cfg_attr(feature = "bindings", derive(TS))]
8870pub struct AlterIndex {
8871 pub name: Identifier,
8872 pub table: Option<TableRef>,
8873 pub actions: Vec<AlterIndexAction>,
8874}
8875
8876#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8878#[cfg_attr(feature = "bindings", derive(TS))]
8879pub enum AlterIndexAction {
8880 Rename(Identifier),
8882 SetTablespace(Identifier),
8884 Visible(bool),
8886}
8887
8888impl AlterIndex {
8889 pub fn new(name: impl Into<String>) -> Self {
8890 Self {
8891 name: Identifier::new(name),
8892 table: None,
8893 actions: Vec::new(),
8894 }
8895 }
8896}
8897
8898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8900#[cfg_attr(feature = "bindings", derive(TS))]
8901pub struct CreateSchema {
8902 pub name: Vec<Identifier>,
8904 pub if_not_exists: bool,
8905 pub authorization: Option<Identifier>,
8906 #[serde(default)]
8908 pub clone_from: Option<Vec<Identifier>>,
8909 #[serde(default)]
8911 pub at_clause: Option<Expression>,
8912 #[serde(default)]
8914 pub properties: Vec<Expression>,
8915 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8917 pub leading_comments: Vec<String>,
8918}
8919
8920impl CreateSchema {
8921 pub fn new(name: impl Into<String>) -> Self {
8922 Self {
8923 name: vec![Identifier::new(name)],
8924 if_not_exists: false,
8925 authorization: None,
8926 clone_from: None,
8927 at_clause: None,
8928 properties: Vec::new(),
8929 leading_comments: Vec::new(),
8930 }
8931 }
8932}
8933
8934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8936#[cfg_attr(feature = "bindings", derive(TS))]
8937pub struct DropSchema {
8938 pub name: Identifier,
8939 pub if_exists: bool,
8940 pub cascade: bool,
8941}
8942
8943impl DropSchema {
8944 pub fn new(name: impl Into<String>) -> Self {
8945 Self {
8946 name: Identifier::new(name),
8947 if_exists: false,
8948 cascade: false,
8949 }
8950 }
8951}
8952
8953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8955#[cfg_attr(feature = "bindings", derive(TS))]
8956pub struct DropNamespace {
8957 pub name: Identifier,
8958 pub if_exists: bool,
8959 pub cascade: bool,
8960}
8961
8962impl DropNamespace {
8963 pub fn new(name: impl Into<String>) -> Self {
8964 Self {
8965 name: Identifier::new(name),
8966 if_exists: false,
8967 cascade: false,
8968 }
8969 }
8970}
8971
8972#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8974#[cfg_attr(feature = "bindings", derive(TS))]
8975pub struct CreateDatabase {
8976 pub name: Identifier,
8977 pub if_not_exists: bool,
8978 pub options: Vec<DatabaseOption>,
8979 #[serde(default)]
8981 pub clone_from: Option<Identifier>,
8982 #[serde(default)]
8984 pub at_clause: Option<Expression>,
8985}
8986
8987#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8989#[cfg_attr(feature = "bindings", derive(TS))]
8990pub enum DatabaseOption {
8991 CharacterSet(String),
8992 Collate(String),
8993 Owner(Identifier),
8994 Template(Identifier),
8995 Encoding(String),
8996 Location(String),
8997}
8998
8999impl CreateDatabase {
9000 pub fn new(name: impl Into<String>) -> Self {
9001 Self {
9002 name: Identifier::new(name),
9003 if_not_exists: false,
9004 options: Vec::new(),
9005 clone_from: None,
9006 at_clause: None,
9007 }
9008 }
9009}
9010
9011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9013#[cfg_attr(feature = "bindings", derive(TS))]
9014pub struct DropDatabase {
9015 pub name: Identifier,
9016 pub if_exists: bool,
9017 #[serde(default)]
9019 pub sync: bool,
9020}
9021
9022impl DropDatabase {
9023 pub fn new(name: impl Into<String>) -> Self {
9024 Self {
9025 name: Identifier::new(name),
9026 if_exists: false,
9027 sync: false,
9028 }
9029 }
9030}
9031
9032#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9034#[cfg_attr(feature = "bindings", derive(TS))]
9035pub struct CreateFunction {
9036 pub name: TableRef,
9037 pub parameters: Vec<FunctionParameter>,
9038 pub return_type: Option<DataType>,
9039 pub body: Option<FunctionBody>,
9040 pub or_replace: bool,
9041 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9043 pub or_alter: bool,
9044 pub if_not_exists: bool,
9045 pub temporary: bool,
9046 pub language: Option<String>,
9047 pub deterministic: Option<bool>,
9048 pub returns_null_on_null_input: Option<bool>,
9049 pub security: Option<FunctionSecurity>,
9050 #[serde(default = "default_true")]
9052 pub has_parens: bool,
9053 #[serde(default)]
9055 pub sql_data_access: Option<SqlDataAccess>,
9056 #[serde(default, skip_serializing_if = "Option::is_none")]
9058 pub returns_table_body: Option<String>,
9059 #[serde(default)]
9061 pub language_first: bool,
9062 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9064 pub set_options: Vec<FunctionSetOption>,
9065 #[serde(default)]
9067 pub strict: bool,
9068 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9070 pub options: Vec<Expression>,
9071 #[serde(default)]
9073 pub is_table_function: bool,
9074 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9076 pub property_order: Vec<FunctionPropertyKind>,
9077 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9079 pub using_resources: Vec<FunctionUsingResource>,
9080 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9082 pub environment: Vec<Expression>,
9083 #[serde(default, skip_serializing_if = "Option::is_none")]
9085 pub handler: Option<String>,
9086 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9088 pub handler_uses_eq: bool,
9089 #[serde(default, skip_serializing_if = "Option::is_none")]
9091 pub runtime_version: Option<String>,
9092 #[serde(default, skip_serializing_if = "Option::is_none")]
9094 pub packages: Option<Vec<String>>,
9095 #[serde(default, skip_serializing_if = "Option::is_none")]
9097 pub parameter_style: Option<String>,
9098}
9099
9100#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9102#[cfg_attr(feature = "bindings", derive(TS))]
9103pub struct FunctionSetOption {
9104 pub name: String,
9105 pub value: FunctionSetValue,
9106}
9107
9108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9110#[cfg_attr(feature = "bindings", derive(TS))]
9111pub enum FunctionSetValue {
9112 Value { value: String, use_to: bool },
9114 FromCurrent,
9116}
9117
9118#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9120#[cfg_attr(feature = "bindings", derive(TS))]
9121pub enum SqlDataAccess {
9122 NoSql,
9124 ContainsSql,
9126 ReadsSqlData,
9128 ModifiesSqlData,
9130}
9131
9132#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9134#[cfg_attr(feature = "bindings", derive(TS))]
9135pub enum FunctionPropertyKind {
9136 Set,
9138 As,
9140 Using,
9142 Language,
9144 Determinism,
9146 NullInput,
9148 Security,
9150 SqlDataAccess,
9152 Options,
9154 Environment,
9156 Handler,
9158 RuntimeVersion,
9160 Packages,
9162 ParameterStyle,
9164}
9165
9166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9168#[cfg_attr(feature = "bindings", derive(TS))]
9169pub struct FunctionUsingResource {
9170 pub kind: String,
9171 pub uri: String,
9172}
9173
9174#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9176#[cfg_attr(feature = "bindings", derive(TS))]
9177pub struct FunctionParameter {
9178 pub name: Option<Identifier>,
9179 pub data_type: DataType,
9180 pub mode: Option<ParameterMode>,
9181 pub default: Option<Expression>,
9182 #[serde(default, skip_serializing_if = "Option::is_none")]
9184 pub mode_text: Option<String>,
9185}
9186
9187#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9189#[cfg_attr(feature = "bindings", derive(TS))]
9190pub enum ParameterMode {
9191 In,
9192 Out,
9193 InOut,
9194 Variadic,
9195}
9196
9197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9199#[cfg_attr(feature = "bindings", derive(TS))]
9200pub enum FunctionBody {
9201 Block(String),
9203 StringLiteral(String),
9205 Expression(Expression),
9207 External(String),
9209 Return(Expression),
9211 Statements(Vec<Expression>),
9213 DollarQuoted {
9216 content: String,
9217 tag: Option<String>,
9218 },
9219 RawBlock(String),
9221}
9222
9223#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9225#[cfg_attr(feature = "bindings", derive(TS))]
9226pub enum FunctionSecurity {
9227 Definer,
9228 Invoker,
9229 None,
9231}
9232
9233impl CreateFunction {
9234 pub fn new(name: impl Into<String>) -> Self {
9235 Self {
9236 name: TableRef::new(name),
9237 parameters: Vec::new(),
9238 return_type: None,
9239 body: None,
9240 or_replace: false,
9241 or_alter: false,
9242 if_not_exists: false,
9243 temporary: false,
9244 language: None,
9245 deterministic: None,
9246 returns_null_on_null_input: None,
9247 security: None,
9248 has_parens: true,
9249 sql_data_access: None,
9250 returns_table_body: None,
9251 language_first: false,
9252 set_options: Vec::new(),
9253 strict: false,
9254 options: Vec::new(),
9255 is_table_function: false,
9256 property_order: Vec::new(),
9257 using_resources: Vec::new(),
9258 environment: Vec::new(),
9259 handler: None,
9260 handler_uses_eq: false,
9261 runtime_version: None,
9262 packages: None,
9263 parameter_style: None,
9264 }
9265 }
9266}
9267
9268#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9270#[cfg_attr(feature = "bindings", derive(TS))]
9271pub struct DropFunction {
9272 pub name: TableRef,
9273 pub parameters: Option<Vec<DataType>>,
9274 pub if_exists: bool,
9275 pub cascade: bool,
9276}
9277
9278impl DropFunction {
9279 pub fn new(name: impl Into<String>) -> Self {
9280 Self {
9281 name: TableRef::new(name),
9282 parameters: None,
9283 if_exists: false,
9284 cascade: false,
9285 }
9286 }
9287}
9288
9289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9291#[cfg_attr(feature = "bindings", derive(TS))]
9292pub struct CreateProcedure {
9293 pub name: TableRef,
9294 pub parameters: Vec<FunctionParameter>,
9295 pub body: Option<FunctionBody>,
9296 pub or_replace: bool,
9297 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9299 pub or_alter: bool,
9300 pub if_not_exists: bool,
9301 pub language: Option<String>,
9302 pub security: Option<FunctionSecurity>,
9303 #[serde(default)]
9305 pub return_type: Option<DataType>,
9306 #[serde(default)]
9308 pub execute_as: Option<String>,
9309 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9311 pub with_options: Vec<String>,
9312 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9314 pub has_parens: bool,
9315 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9317 pub use_proc_keyword: bool,
9318}
9319
9320impl CreateProcedure {
9321 pub fn new(name: impl Into<String>) -> Self {
9322 Self {
9323 name: TableRef::new(name),
9324 parameters: Vec::new(),
9325 body: None,
9326 or_replace: false,
9327 or_alter: false,
9328 if_not_exists: false,
9329 language: None,
9330 security: None,
9331 return_type: None,
9332 execute_as: None,
9333 with_options: Vec::new(),
9334 has_parens: true,
9335 use_proc_keyword: false,
9336 }
9337 }
9338}
9339
9340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9342#[cfg_attr(feature = "bindings", derive(TS))]
9343pub struct DropProcedure {
9344 pub name: TableRef,
9345 pub parameters: Option<Vec<DataType>>,
9346 pub if_exists: bool,
9347 pub cascade: bool,
9348}
9349
9350impl DropProcedure {
9351 pub fn new(name: impl Into<String>) -> Self {
9352 Self {
9353 name: TableRef::new(name),
9354 parameters: None,
9355 if_exists: false,
9356 cascade: false,
9357 }
9358 }
9359}
9360
9361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9363#[cfg_attr(feature = "bindings", derive(TS))]
9364pub enum SeqPropKind {
9365 Start,
9366 Increment,
9367 Minvalue,
9368 Maxvalue,
9369 Cache,
9370 NoCache,
9371 Cycle,
9372 NoCycle,
9373 OwnedBy,
9374 Order,
9375 NoOrder,
9376 Comment,
9377 Sharing,
9379 Keep,
9381 NoKeep,
9383 Scale,
9385 NoScale,
9387 Shard,
9389 NoShard,
9391 Session,
9393 Global,
9395 NoCacheWord,
9397 NoCycleWord,
9399 NoMinvalueWord,
9401 NoMaxvalueWord,
9403}
9404
9405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9407#[cfg_attr(feature = "bindings", derive(TS))]
9408pub struct CreateSynonym {
9409 pub name: TableRef,
9411 pub target: TableRef,
9413}
9414
9415#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9417#[cfg_attr(feature = "bindings", derive(TS))]
9418pub struct CreateSequence {
9419 pub name: TableRef,
9420 pub if_not_exists: bool,
9421 pub temporary: bool,
9422 #[serde(default)]
9423 pub or_replace: bool,
9424 #[serde(default, skip_serializing_if = "Option::is_none")]
9426 pub as_type: Option<DataType>,
9427 pub increment: Option<i64>,
9428 pub minvalue: Option<SequenceBound>,
9429 pub maxvalue: Option<SequenceBound>,
9430 pub start: Option<i64>,
9431 pub cache: Option<i64>,
9432 pub cycle: bool,
9433 pub owned_by: Option<TableRef>,
9434 #[serde(default)]
9436 pub owned_by_none: bool,
9437 #[serde(default)]
9439 pub order: Option<bool>,
9440 #[serde(default)]
9442 pub comment: Option<String>,
9443 #[serde(default, skip_serializing_if = "Option::is_none")]
9445 pub sharing: Option<String>,
9446 #[serde(default, skip_serializing_if = "Option::is_none")]
9448 pub scale_modifier: Option<String>,
9449 #[serde(default, skip_serializing_if = "Option::is_none")]
9451 pub shard_modifier: Option<String>,
9452 #[serde(default)]
9454 pub property_order: Vec<SeqPropKind>,
9455}
9456
9457#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9459#[cfg_attr(feature = "bindings", derive(TS))]
9460pub enum SequenceBound {
9461 Value(i64),
9462 None,
9463}
9464
9465impl CreateSequence {
9466 pub fn new(name: impl Into<String>) -> Self {
9467 Self {
9468 name: TableRef::new(name),
9469 if_not_exists: false,
9470 temporary: false,
9471 or_replace: false,
9472 as_type: None,
9473 increment: None,
9474 minvalue: None,
9475 maxvalue: None,
9476 start: None,
9477 cache: None,
9478 cycle: false,
9479 owned_by: None,
9480 owned_by_none: false,
9481 order: None,
9482 comment: None,
9483 sharing: None,
9484 scale_modifier: None,
9485 shard_modifier: None,
9486 property_order: Vec::new(),
9487 }
9488 }
9489}
9490
9491#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9493#[cfg_attr(feature = "bindings", derive(TS))]
9494pub struct DropSequence {
9495 pub name: TableRef,
9496 pub if_exists: bool,
9497 pub cascade: bool,
9498}
9499
9500impl DropSequence {
9501 pub fn new(name: impl Into<String>) -> Self {
9502 Self {
9503 name: TableRef::new(name),
9504 if_exists: false,
9505 cascade: false,
9506 }
9507 }
9508}
9509
9510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9512#[cfg_attr(feature = "bindings", derive(TS))]
9513pub struct AlterSequence {
9514 pub name: TableRef,
9515 pub if_exists: bool,
9516 pub increment: Option<i64>,
9517 pub minvalue: Option<SequenceBound>,
9518 pub maxvalue: Option<SequenceBound>,
9519 pub start: Option<i64>,
9520 pub restart: Option<Option<i64>>,
9521 pub cache: Option<i64>,
9522 pub cycle: Option<bool>,
9523 pub owned_by: Option<Option<TableRef>>,
9524}
9525
9526impl AlterSequence {
9527 pub fn new(name: impl Into<String>) -> Self {
9528 Self {
9529 name: TableRef::new(name),
9530 if_exists: false,
9531 increment: None,
9532 minvalue: None,
9533 maxvalue: None,
9534 start: None,
9535 restart: None,
9536 cache: None,
9537 cycle: None,
9538 owned_by: None,
9539 }
9540 }
9541}
9542
9543#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9545#[cfg_attr(feature = "bindings", derive(TS))]
9546pub struct CreateTrigger {
9547 pub name: Identifier,
9548 pub table: TableRef,
9549 pub timing: TriggerTiming,
9550 pub events: Vec<TriggerEvent>,
9551 #[serde(default, skip_serializing_if = "Option::is_none")]
9552 pub for_each: Option<TriggerForEach>,
9553 pub when: Option<Expression>,
9554 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9556 pub when_paren: bool,
9557 pub body: TriggerBody,
9558 pub or_replace: bool,
9559 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9561 pub or_alter: bool,
9562 pub constraint: bool,
9563 pub deferrable: Option<bool>,
9564 pub initially_deferred: Option<bool>,
9565 pub referencing: Option<TriggerReferencing>,
9566}
9567
9568#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9570#[cfg_attr(feature = "bindings", derive(TS))]
9571pub enum TriggerTiming {
9572 Before,
9573 After,
9574 InsteadOf,
9575}
9576
9577#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9579#[cfg_attr(feature = "bindings", derive(TS))]
9580pub enum TriggerEvent {
9581 Insert,
9582 Update(Option<Vec<Identifier>>),
9583 Delete,
9584 Truncate,
9585}
9586
9587#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
9589#[cfg_attr(feature = "bindings", derive(TS))]
9590pub enum TriggerForEach {
9591 Row,
9592 Statement,
9593}
9594
9595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9597#[cfg_attr(feature = "bindings", derive(TS))]
9598pub enum TriggerBody {
9599 Execute {
9601 function: TableRef,
9602 args: Vec<Expression>,
9603 },
9604 Block(String),
9606}
9607
9608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9610#[cfg_attr(feature = "bindings", derive(TS))]
9611pub struct TriggerReferencing {
9612 pub old_table: Option<Identifier>,
9613 pub new_table: Option<Identifier>,
9614 pub old_row: Option<Identifier>,
9615 pub new_row: Option<Identifier>,
9616}
9617
9618impl CreateTrigger {
9619 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9620 Self {
9621 name: Identifier::new(name),
9622 table: TableRef::new(table),
9623 timing: TriggerTiming::Before,
9624 events: Vec::new(),
9625 for_each: Some(TriggerForEach::Row),
9626 when: None,
9627 when_paren: false,
9628 body: TriggerBody::Execute {
9629 function: TableRef::new(""),
9630 args: Vec::new(),
9631 },
9632 or_replace: false,
9633 or_alter: false,
9634 constraint: false,
9635 deferrable: None,
9636 initially_deferred: None,
9637 referencing: None,
9638 }
9639 }
9640}
9641
9642#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9644#[cfg_attr(feature = "bindings", derive(TS))]
9645pub struct DropTrigger {
9646 pub name: Identifier,
9647 pub table: Option<TableRef>,
9648 pub if_exists: bool,
9649 pub cascade: bool,
9650}
9651
9652impl DropTrigger {
9653 pub fn new(name: impl Into<String>) -> Self {
9654 Self {
9655 name: Identifier::new(name),
9656 table: None,
9657 if_exists: false,
9658 cascade: false,
9659 }
9660 }
9661}
9662
9663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9665#[cfg_attr(feature = "bindings", derive(TS))]
9666pub struct CreateType {
9667 pub name: TableRef,
9668 pub definition: TypeDefinition,
9669 pub if_not_exists: bool,
9670}
9671
9672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9674#[cfg_attr(feature = "bindings", derive(TS))]
9675pub enum TypeDefinition {
9676 Enum(Vec<String>),
9678 Composite(Vec<TypeAttribute>),
9680 Range {
9682 subtype: DataType,
9683 subtype_diff: Option<String>,
9684 canonical: Option<String>,
9685 },
9686 Base {
9688 input: String,
9689 output: String,
9690 internallength: Option<i32>,
9691 },
9692 Domain {
9694 base_type: DataType,
9695 default: Option<Expression>,
9696 constraints: Vec<DomainConstraint>,
9697 },
9698}
9699
9700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9702#[cfg_attr(feature = "bindings", derive(TS))]
9703pub struct TypeAttribute {
9704 pub name: Identifier,
9705 pub data_type: DataType,
9706 pub collate: Option<Identifier>,
9707}
9708
9709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9711#[cfg_attr(feature = "bindings", derive(TS))]
9712pub struct DomainConstraint {
9713 pub name: Option<Identifier>,
9714 pub check: Expression,
9715}
9716
9717impl CreateType {
9718 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
9719 Self {
9720 name: TableRef::new(name),
9721 definition: TypeDefinition::Enum(values),
9722 if_not_exists: false,
9723 }
9724 }
9725
9726 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
9727 Self {
9728 name: TableRef::new(name),
9729 definition: TypeDefinition::Composite(attributes),
9730 if_not_exists: false,
9731 }
9732 }
9733}
9734
9735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9737#[cfg_attr(feature = "bindings", derive(TS))]
9738pub struct DropType {
9739 pub name: TableRef,
9740 pub if_exists: bool,
9741 pub cascade: bool,
9742}
9743
9744impl DropType {
9745 pub fn new(name: impl Into<String>) -> Self {
9746 Self {
9747 name: TableRef::new(name),
9748 if_exists: false,
9749 cascade: false,
9750 }
9751 }
9752}
9753
9754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9756#[cfg_attr(feature = "bindings", derive(TS))]
9757pub struct Describe {
9758 pub target: Expression,
9760 pub extended: bool,
9762 pub formatted: bool,
9764 #[serde(default)]
9766 pub kind: Option<String>,
9767 #[serde(default)]
9769 pub properties: Vec<(String, String)>,
9770 #[serde(default, skip_serializing_if = "Option::is_none")]
9772 pub style: Option<String>,
9773 #[serde(default)]
9775 pub partition: Option<Box<Expression>>,
9776 #[serde(default)]
9778 pub leading_comments: Vec<String>,
9779 #[serde(default)]
9781 pub as_json: bool,
9782 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9784 pub params: Vec<String>,
9785}
9786
9787impl Describe {
9788 pub fn new(target: Expression) -> Self {
9789 Self {
9790 target,
9791 extended: false,
9792 formatted: false,
9793 kind: None,
9794 properties: Vec::new(),
9795 style: None,
9796 partition: None,
9797 leading_comments: Vec::new(),
9798 as_json: false,
9799 params: Vec::new(),
9800 }
9801 }
9802}
9803
9804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9806#[cfg_attr(feature = "bindings", derive(TS))]
9807pub struct Show {
9808 pub this: String,
9810 #[serde(default)]
9812 pub terse: bool,
9813 #[serde(default)]
9815 pub history: bool,
9816 pub like: Option<Expression>,
9818 pub scope_kind: Option<String>,
9820 pub scope: Option<Expression>,
9822 pub starts_with: Option<Expression>,
9824 pub limit: Option<Box<Limit>>,
9826 pub from: Option<Expression>,
9828 #[serde(default, skip_serializing_if = "Option::is_none")]
9830 pub where_clause: Option<Expression>,
9831 #[serde(default, skip_serializing_if = "Option::is_none")]
9833 pub for_target: Option<Expression>,
9834 #[serde(default, skip_serializing_if = "Option::is_none")]
9836 pub db: Option<Expression>,
9837 #[serde(default, skip_serializing_if = "Option::is_none")]
9839 pub target: Option<Expression>,
9840 #[serde(default, skip_serializing_if = "Option::is_none")]
9842 pub mutex: Option<bool>,
9843 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9845 pub privileges: Vec<String>,
9846}
9847
9848impl Show {
9849 pub fn new(this: impl Into<String>) -> Self {
9850 Self {
9851 this: this.into(),
9852 terse: false,
9853 history: false,
9854 like: None,
9855 scope_kind: None,
9856 scope: None,
9857 starts_with: None,
9858 limit: None,
9859 from: None,
9860 where_clause: None,
9861 for_target: None,
9862 db: None,
9863 target: None,
9864 mutex: None,
9865 privileges: Vec::new(),
9866 }
9867 }
9868}
9869
9870#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9875#[cfg_attr(feature = "bindings", derive(TS))]
9876pub struct Paren {
9877 pub this: Expression,
9879 #[serde(default)]
9880 pub trailing_comments: Vec<String>,
9881}
9882
9883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9885#[cfg_attr(feature = "bindings", derive(TS))]
9886pub struct Annotated {
9887 pub this: Expression,
9888 pub trailing_comments: Vec<String>,
9889}
9890
9891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9896#[cfg_attr(feature = "bindings", derive(TS))]
9897pub struct Refresh {
9898 pub this: Box<Expression>,
9899 pub kind: String,
9900}
9901
9902#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9904#[cfg_attr(feature = "bindings", derive(TS))]
9905pub struct LockingStatement {
9906 pub this: Box<Expression>,
9907 pub expression: Box<Expression>,
9908}
9909
9910#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9912#[cfg_attr(feature = "bindings", derive(TS))]
9913pub struct SequenceProperties {
9914 #[serde(default)]
9915 pub increment: Option<Box<Expression>>,
9916 #[serde(default)]
9917 pub minvalue: Option<Box<Expression>>,
9918 #[serde(default)]
9919 pub maxvalue: Option<Box<Expression>>,
9920 #[serde(default)]
9921 pub cache: Option<Box<Expression>>,
9922 #[serde(default)]
9923 pub start: Option<Box<Expression>>,
9924 #[serde(default)]
9925 pub owned: Option<Box<Expression>>,
9926 #[serde(default)]
9927 pub options: Vec<Expression>,
9928}
9929
9930#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9932#[cfg_attr(feature = "bindings", derive(TS))]
9933pub struct TruncateTable {
9934 #[serde(default)]
9935 pub expressions: Vec<Expression>,
9936 #[serde(default)]
9937 pub is_database: Option<Box<Expression>>,
9938 #[serde(default)]
9939 pub exists: bool,
9940 #[serde(default)]
9941 pub only: Option<Box<Expression>>,
9942 #[serde(default)]
9943 pub cluster: Option<Box<Expression>>,
9944 #[serde(default)]
9945 pub identity: Option<Box<Expression>>,
9946 #[serde(default)]
9947 pub option: Option<Box<Expression>>,
9948 #[serde(default)]
9949 pub partition: Option<Box<Expression>>,
9950}
9951
9952#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9954#[cfg_attr(feature = "bindings", derive(TS))]
9955pub struct Clone {
9956 pub this: Box<Expression>,
9957 #[serde(default)]
9958 pub shallow: Option<Box<Expression>>,
9959 #[serde(default)]
9960 pub copy: Option<Box<Expression>>,
9961}
9962
9963#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9965#[cfg_attr(feature = "bindings", derive(TS))]
9966pub struct Attach {
9967 pub this: Box<Expression>,
9968 #[serde(default)]
9969 pub exists: bool,
9970 #[serde(default)]
9971 pub expressions: Vec<Expression>,
9972}
9973
9974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9976#[cfg_attr(feature = "bindings", derive(TS))]
9977pub struct Detach {
9978 pub this: Box<Expression>,
9979 #[serde(default)]
9980 pub exists: bool,
9981}
9982
9983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9985#[cfg_attr(feature = "bindings", derive(TS))]
9986pub struct Install {
9987 pub this: Box<Expression>,
9988 #[serde(default)]
9989 pub from_: Option<Box<Expression>>,
9990 #[serde(default)]
9991 pub force: Option<Box<Expression>>,
9992}
9993
9994#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
9996#[cfg_attr(feature = "bindings", derive(TS))]
9997pub struct Summarize {
9998 pub this: Box<Expression>,
9999 #[serde(default)]
10000 pub table: Option<Box<Expression>>,
10001}
10002
10003#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10005#[cfg_attr(feature = "bindings", derive(TS))]
10006pub struct Declare {
10007 #[serde(default)]
10008 pub expressions: Vec<Expression>,
10009 #[serde(default)]
10010 pub replace: bool,
10011}
10012
10013#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10015#[cfg_attr(feature = "bindings", derive(TS))]
10016pub struct DeclareItem {
10017 pub this: Box<Expression>,
10018 #[serde(default)]
10019 pub kind: Option<String>,
10020 #[serde(default)]
10021 pub default: Option<Box<Expression>>,
10022 #[serde(default)]
10023 pub has_as: bool,
10024 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10026 pub additional_names: Vec<Expression>,
10027}
10028
10029#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10031#[cfg_attr(feature = "bindings", derive(TS))]
10032pub struct Set {
10033 #[serde(default)]
10034 pub expressions: Vec<Expression>,
10035 #[serde(default)]
10036 pub unset: Option<Box<Expression>>,
10037 #[serde(default)]
10038 pub tag: Option<Box<Expression>>,
10039}
10040
10041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10043#[cfg_attr(feature = "bindings", derive(TS))]
10044pub struct Heredoc {
10045 pub this: Box<Expression>,
10046 #[serde(default)]
10047 pub tag: Option<Box<Expression>>,
10048}
10049
10050#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10052#[cfg_attr(feature = "bindings", derive(TS))]
10053pub struct QueryBand {
10054 pub this: Box<Expression>,
10055 #[serde(default)]
10056 pub scope: Option<Box<Expression>>,
10057 #[serde(default)]
10058 pub update: Option<Box<Expression>>,
10059}
10060
10061#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10063#[cfg_attr(feature = "bindings", derive(TS))]
10064pub struct UserDefinedFunction {
10065 pub this: Box<Expression>,
10066 #[serde(default)]
10067 pub expressions: Vec<Expression>,
10068 #[serde(default)]
10069 pub wrapped: Option<Box<Expression>>,
10070}
10071
10072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10074#[cfg_attr(feature = "bindings", derive(TS))]
10075pub struct RecursiveWithSearch {
10076 pub kind: String,
10077 pub this: Box<Expression>,
10078 pub expression: Box<Expression>,
10079 #[serde(default)]
10080 pub using: Option<Box<Expression>>,
10081}
10082
10083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10085#[cfg_attr(feature = "bindings", derive(TS))]
10086pub struct ProjectionDef {
10087 pub this: Box<Expression>,
10088 pub expression: Box<Expression>,
10089}
10090
10091#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10093#[cfg_attr(feature = "bindings", derive(TS))]
10094pub struct TableAlias {
10095 #[serde(default)]
10096 pub this: Option<Box<Expression>>,
10097 #[serde(default)]
10098 pub columns: Vec<Expression>,
10099}
10100
10101#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10103#[cfg_attr(feature = "bindings", derive(TS))]
10104pub struct ByteString {
10105 pub this: Box<Expression>,
10106 #[serde(default)]
10107 pub is_bytes: Option<Box<Expression>>,
10108}
10109
10110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10113#[cfg_attr(feature = "bindings", derive(TS))]
10114pub struct HexStringExpr {
10115 pub this: Box<Expression>,
10116 #[serde(default)]
10117 pub is_integer: Option<bool>,
10118}
10119
10120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10122#[cfg_attr(feature = "bindings", derive(TS))]
10123pub struct UnicodeString {
10124 pub this: Box<Expression>,
10125 #[serde(default)]
10126 pub escape: Option<Box<Expression>>,
10127}
10128
10129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10131#[cfg_attr(feature = "bindings", derive(TS))]
10132pub struct AlterColumn {
10133 pub this: Box<Expression>,
10134 #[serde(default)]
10135 pub dtype: Option<Box<Expression>>,
10136 #[serde(default)]
10137 pub collate: Option<Box<Expression>>,
10138 #[serde(default)]
10139 pub using: Option<Box<Expression>>,
10140 #[serde(default)]
10141 pub default: Option<Box<Expression>>,
10142 #[serde(default)]
10143 pub drop: Option<Box<Expression>>,
10144 #[serde(default)]
10145 pub comment: Option<Box<Expression>>,
10146 #[serde(default)]
10147 pub allow_null: Option<Box<Expression>>,
10148 #[serde(default)]
10149 pub visible: Option<Box<Expression>>,
10150 #[serde(default)]
10151 pub rename_to: Option<Box<Expression>>,
10152}
10153
10154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10156#[cfg_attr(feature = "bindings", derive(TS))]
10157pub struct AlterSortKey {
10158 #[serde(default)]
10159 pub this: Option<Box<Expression>>,
10160 #[serde(default)]
10161 pub expressions: Vec<Expression>,
10162 #[serde(default)]
10163 pub compound: Option<Box<Expression>>,
10164}
10165
10166#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10168#[cfg_attr(feature = "bindings", derive(TS))]
10169pub struct AlterSet {
10170 #[serde(default)]
10171 pub expressions: Vec<Expression>,
10172 #[serde(default)]
10173 pub option: Option<Box<Expression>>,
10174 #[serde(default)]
10175 pub tablespace: Option<Box<Expression>>,
10176 #[serde(default)]
10177 pub access_method: Option<Box<Expression>>,
10178 #[serde(default)]
10179 pub file_format: Option<Box<Expression>>,
10180 #[serde(default)]
10181 pub copy_options: Option<Box<Expression>>,
10182 #[serde(default)]
10183 pub tag: Option<Box<Expression>>,
10184 #[serde(default)]
10185 pub location: Option<Box<Expression>>,
10186 #[serde(default)]
10187 pub serde: Option<Box<Expression>>,
10188}
10189
10190#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10192#[cfg_attr(feature = "bindings", derive(TS))]
10193pub struct RenameColumn {
10194 pub this: Box<Expression>,
10195 #[serde(default)]
10196 pub to: Option<Box<Expression>>,
10197 #[serde(default)]
10198 pub exists: bool,
10199}
10200
10201#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10203#[cfg_attr(feature = "bindings", derive(TS))]
10204pub struct Comprehension {
10205 pub this: Box<Expression>,
10206 pub expression: Box<Expression>,
10207 #[serde(default)]
10208 pub position: Option<Box<Expression>>,
10209 #[serde(default)]
10210 pub iterator: Option<Box<Expression>>,
10211 #[serde(default)]
10212 pub condition: Option<Box<Expression>>,
10213}
10214
10215#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10217#[cfg_attr(feature = "bindings", derive(TS))]
10218pub struct MergeTreeTTLAction {
10219 pub this: Box<Expression>,
10220 #[serde(default)]
10221 pub delete: Option<Box<Expression>>,
10222 #[serde(default)]
10223 pub recompress: Option<Box<Expression>>,
10224 #[serde(default)]
10225 pub to_disk: Option<Box<Expression>>,
10226 #[serde(default)]
10227 pub to_volume: Option<Box<Expression>>,
10228}
10229
10230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10232#[cfg_attr(feature = "bindings", derive(TS))]
10233pub struct MergeTreeTTL {
10234 #[serde(default)]
10235 pub expressions: Vec<Expression>,
10236 #[serde(default)]
10237 pub where_: Option<Box<Expression>>,
10238 #[serde(default)]
10239 pub group: Option<Box<Expression>>,
10240 #[serde(default)]
10241 pub aggregates: Option<Box<Expression>>,
10242}
10243
10244#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10246#[cfg_attr(feature = "bindings", derive(TS))]
10247pub struct IndexConstraintOption {
10248 #[serde(default)]
10249 pub key_block_size: Option<Box<Expression>>,
10250 #[serde(default)]
10251 pub using: Option<Box<Expression>>,
10252 #[serde(default)]
10253 pub parser: Option<Box<Expression>>,
10254 #[serde(default)]
10255 pub comment: Option<Box<Expression>>,
10256 #[serde(default)]
10257 pub visible: Option<Box<Expression>>,
10258 #[serde(default)]
10259 pub engine_attr: Option<Box<Expression>>,
10260 #[serde(default)]
10261 pub secondary_engine_attr: Option<Box<Expression>>,
10262}
10263
10264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10266#[cfg_attr(feature = "bindings", derive(TS))]
10267pub struct PeriodForSystemTimeConstraint {
10268 pub this: Box<Expression>,
10269 pub expression: Box<Expression>,
10270}
10271
10272#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10274#[cfg_attr(feature = "bindings", derive(TS))]
10275pub struct CaseSpecificColumnConstraint {
10276 #[serde(default)]
10277 pub not_: Option<Box<Expression>>,
10278}
10279
10280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10282#[cfg_attr(feature = "bindings", derive(TS))]
10283pub struct CharacterSetColumnConstraint {
10284 pub this: Box<Expression>,
10285}
10286
10287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10289#[cfg_attr(feature = "bindings", derive(TS))]
10290pub struct CheckColumnConstraint {
10291 pub this: Box<Expression>,
10292 #[serde(default)]
10293 pub enforced: Option<Box<Expression>>,
10294}
10295
10296#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10298#[cfg_attr(feature = "bindings", derive(TS))]
10299pub struct AssumeColumnConstraint {
10300 pub this: Box<Expression>,
10301}
10302
10303#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10305#[cfg_attr(feature = "bindings", derive(TS))]
10306pub struct CompressColumnConstraint {
10307 #[serde(default)]
10308 pub this: Option<Box<Expression>>,
10309}
10310
10311#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10313#[cfg_attr(feature = "bindings", derive(TS))]
10314pub struct DateFormatColumnConstraint {
10315 pub this: Box<Expression>,
10316}
10317
10318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10320#[cfg_attr(feature = "bindings", derive(TS))]
10321pub struct EphemeralColumnConstraint {
10322 #[serde(default)]
10323 pub this: Option<Box<Expression>>,
10324}
10325
10326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10328#[cfg_attr(feature = "bindings", derive(TS))]
10329pub struct WithOperator {
10330 pub this: Box<Expression>,
10331 pub op: String,
10332}
10333
10334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10336#[cfg_attr(feature = "bindings", derive(TS))]
10337pub struct GeneratedAsIdentityColumnConstraint {
10338 #[serde(default)]
10339 pub this: Option<Box<Expression>>,
10340 #[serde(default)]
10341 pub expression: Option<Box<Expression>>,
10342 #[serde(default)]
10343 pub on_null: Option<Box<Expression>>,
10344 #[serde(default)]
10345 pub start: Option<Box<Expression>>,
10346 #[serde(default)]
10347 pub increment: Option<Box<Expression>>,
10348 #[serde(default)]
10349 pub minvalue: Option<Box<Expression>>,
10350 #[serde(default)]
10351 pub maxvalue: Option<Box<Expression>>,
10352 #[serde(default)]
10353 pub cycle: Option<Box<Expression>>,
10354 #[serde(default)]
10355 pub order: Option<Box<Expression>>,
10356}
10357
10358#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10361#[cfg_attr(feature = "bindings", derive(TS))]
10362pub struct AutoIncrementColumnConstraint;
10363
10364#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10366#[cfg_attr(feature = "bindings", derive(TS))]
10367pub struct CommentColumnConstraint;
10368
10369#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10371#[cfg_attr(feature = "bindings", derive(TS))]
10372pub struct GeneratedAsRowColumnConstraint {
10373 #[serde(default)]
10374 pub start: Option<Box<Expression>>,
10375 #[serde(default)]
10376 pub hidden: Option<Box<Expression>>,
10377}
10378
10379#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10381#[cfg_attr(feature = "bindings", derive(TS))]
10382pub struct IndexColumnConstraint {
10383 #[serde(default)]
10384 pub this: Option<Box<Expression>>,
10385 #[serde(default)]
10386 pub expressions: Vec<Expression>,
10387 #[serde(default)]
10388 pub kind: Option<String>,
10389 #[serde(default)]
10390 pub index_type: Option<Box<Expression>>,
10391 #[serde(default)]
10392 pub options: Vec<Expression>,
10393 #[serde(default)]
10394 pub expression: Option<Box<Expression>>,
10395 #[serde(default)]
10396 pub granularity: Option<Box<Expression>>,
10397}
10398
10399#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10401#[cfg_attr(feature = "bindings", derive(TS))]
10402pub struct MaskingPolicyColumnConstraint {
10403 pub this: Box<Expression>,
10404 #[serde(default)]
10405 pub expressions: Vec<Expression>,
10406}
10407
10408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10410#[cfg_attr(feature = "bindings", derive(TS))]
10411pub struct NotNullColumnConstraint {
10412 #[serde(default)]
10413 pub allow_null: Option<Box<Expression>>,
10414}
10415
10416#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10418#[cfg_attr(feature = "bindings", derive(TS))]
10419pub struct DefaultColumnConstraint {
10420 pub this: Box<Expression>,
10421 #[serde(default, skip_serializing_if = "Option::is_none")]
10423 pub for_column: Option<Identifier>,
10424}
10425
10426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10428#[cfg_attr(feature = "bindings", derive(TS))]
10429pub struct PrimaryKeyColumnConstraint {
10430 #[serde(default)]
10431 pub desc: Option<Box<Expression>>,
10432 #[serde(default)]
10433 pub options: Vec<Expression>,
10434}
10435
10436#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10438#[cfg_attr(feature = "bindings", derive(TS))]
10439pub struct UniqueColumnConstraint {
10440 #[serde(default)]
10441 pub this: Option<Box<Expression>>,
10442 #[serde(default)]
10443 pub index_type: Option<Box<Expression>>,
10444 #[serde(default)]
10445 pub on_conflict: Option<Box<Expression>>,
10446 #[serde(default)]
10447 pub nulls: Option<Box<Expression>>,
10448 #[serde(default)]
10449 pub options: Vec<Expression>,
10450}
10451
10452#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10454#[cfg_attr(feature = "bindings", derive(TS))]
10455pub struct WatermarkColumnConstraint {
10456 pub this: Box<Expression>,
10457 pub expression: Box<Expression>,
10458}
10459
10460#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10462#[cfg_attr(feature = "bindings", derive(TS))]
10463pub struct ComputedColumnConstraint {
10464 pub this: Box<Expression>,
10465 #[serde(default)]
10466 pub persisted: Option<Box<Expression>>,
10467 #[serde(default)]
10468 pub not_null: Option<Box<Expression>>,
10469 #[serde(default)]
10470 pub data_type: Option<Box<Expression>>,
10471}
10472
10473#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10475#[cfg_attr(feature = "bindings", derive(TS))]
10476pub struct InOutColumnConstraint {
10477 #[serde(default)]
10478 pub input_: Option<Box<Expression>>,
10479 #[serde(default)]
10480 pub output: Option<Box<Expression>>,
10481}
10482
10483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10485#[cfg_attr(feature = "bindings", derive(TS))]
10486pub struct PathColumnConstraint {
10487 pub this: Box<Expression>,
10488}
10489
10490#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10492#[cfg_attr(feature = "bindings", derive(TS))]
10493pub struct Constraint {
10494 pub this: Box<Expression>,
10495 #[serde(default)]
10496 pub expressions: Vec<Expression>,
10497}
10498
10499#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10501#[cfg_attr(feature = "bindings", derive(TS))]
10502pub struct Export {
10503 pub this: Box<Expression>,
10504 #[serde(default)]
10505 pub connection: Option<Box<Expression>>,
10506 #[serde(default)]
10507 pub options: Vec<Expression>,
10508}
10509
10510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10512#[cfg_attr(feature = "bindings", derive(TS))]
10513pub struct Filter {
10514 pub this: Box<Expression>,
10515 pub expression: Box<Expression>,
10516}
10517
10518#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10520#[cfg_attr(feature = "bindings", derive(TS))]
10521pub struct Changes {
10522 #[serde(default)]
10523 pub information: Option<Box<Expression>>,
10524 #[serde(default)]
10525 pub at_before: Option<Box<Expression>>,
10526 #[serde(default)]
10527 pub end: Option<Box<Expression>>,
10528}
10529
10530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10532#[cfg_attr(feature = "bindings", derive(TS))]
10533pub struct Directory {
10534 pub this: Box<Expression>,
10535 #[serde(default)]
10536 pub local: Option<Box<Expression>>,
10537 #[serde(default)]
10538 pub row_format: Option<Box<Expression>>,
10539}
10540
10541#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10543#[cfg_attr(feature = "bindings", derive(TS))]
10544pub struct ForeignKey {
10545 #[serde(default)]
10546 pub expressions: Vec<Expression>,
10547 #[serde(default)]
10548 pub reference: Option<Box<Expression>>,
10549 #[serde(default)]
10550 pub delete: Option<Box<Expression>>,
10551 #[serde(default)]
10552 pub update: Option<Box<Expression>>,
10553 #[serde(default)]
10554 pub options: Vec<Expression>,
10555}
10556
10557#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10559#[cfg_attr(feature = "bindings", derive(TS))]
10560pub struct ColumnPrefix {
10561 pub this: Box<Expression>,
10562 pub expression: Box<Expression>,
10563}
10564
10565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10567#[cfg_attr(feature = "bindings", derive(TS))]
10568pub struct PrimaryKey {
10569 #[serde(default)]
10570 pub this: Option<Box<Expression>>,
10571 #[serde(default)]
10572 pub expressions: Vec<Expression>,
10573 #[serde(default)]
10574 pub options: Vec<Expression>,
10575 #[serde(default)]
10576 pub include: Option<Box<Expression>>,
10577}
10578
10579#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10581#[cfg_attr(feature = "bindings", derive(TS))]
10582pub struct IntoClause {
10583 #[serde(default)]
10584 pub this: Option<Box<Expression>>,
10585 #[serde(default)]
10586 pub temporary: bool,
10587 #[serde(default)]
10588 pub unlogged: Option<Box<Expression>>,
10589 #[serde(default)]
10590 pub bulk_collect: Option<Box<Expression>>,
10591 #[serde(default)]
10592 pub expressions: Vec<Expression>,
10593}
10594
10595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10597#[cfg_attr(feature = "bindings", derive(TS))]
10598pub struct JoinHint {
10599 pub this: Box<Expression>,
10600 #[serde(default)]
10601 pub expressions: Vec<Expression>,
10602}
10603
10604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10606#[cfg_attr(feature = "bindings", derive(TS))]
10607pub struct Opclass {
10608 pub this: Box<Expression>,
10609 pub expression: Box<Expression>,
10610}
10611
10612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10614#[cfg_attr(feature = "bindings", derive(TS))]
10615pub struct Index {
10616 #[serde(default)]
10617 pub this: Option<Box<Expression>>,
10618 #[serde(default)]
10619 pub table: Option<Box<Expression>>,
10620 #[serde(default)]
10621 pub unique: bool,
10622 #[serde(default)]
10623 pub primary: Option<Box<Expression>>,
10624 #[serde(default)]
10625 pub amp: Option<Box<Expression>>,
10626 #[serde(default)]
10627 pub params: Vec<Expression>,
10628}
10629
10630#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10632#[cfg_attr(feature = "bindings", derive(TS))]
10633pub struct IndexParameters {
10634 #[serde(default)]
10635 pub using: Option<Box<Expression>>,
10636 #[serde(default)]
10637 pub include: Option<Box<Expression>>,
10638 #[serde(default)]
10639 pub columns: Vec<Expression>,
10640 #[serde(default)]
10641 pub with_storage: Option<Box<Expression>>,
10642 #[serde(default)]
10643 pub partition_by: Option<Box<Expression>>,
10644 #[serde(default)]
10645 pub tablespace: Option<Box<Expression>>,
10646 #[serde(default)]
10647 pub where_: Option<Box<Expression>>,
10648 #[serde(default)]
10649 pub on: Option<Box<Expression>>,
10650}
10651
10652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10654#[cfg_attr(feature = "bindings", derive(TS))]
10655pub struct ConditionalInsert {
10656 pub this: Box<Expression>,
10657 #[serde(default)]
10658 pub expression: Option<Box<Expression>>,
10659 #[serde(default)]
10660 pub else_: Option<Box<Expression>>,
10661}
10662
10663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10665#[cfg_attr(feature = "bindings", derive(TS))]
10666pub struct MultitableInserts {
10667 #[serde(default)]
10668 pub expressions: Vec<Expression>,
10669 pub kind: String,
10670 #[serde(default)]
10671 pub source: Option<Box<Expression>>,
10672 #[serde(default)]
10674 pub leading_comments: Vec<String>,
10675 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10677 pub overwrite: bool,
10678}
10679
10680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10682#[cfg_attr(feature = "bindings", derive(TS))]
10683pub struct OnConflict {
10684 #[serde(default)]
10685 pub duplicate: Option<Box<Expression>>,
10686 #[serde(default)]
10687 pub expressions: Vec<Expression>,
10688 #[serde(default)]
10689 pub action: Option<Box<Expression>>,
10690 #[serde(default)]
10691 pub conflict_keys: Option<Box<Expression>>,
10692 #[serde(default)]
10693 pub index_predicate: Option<Box<Expression>>,
10694 #[serde(default)]
10695 pub constraint: Option<Box<Expression>>,
10696 #[serde(default)]
10697 pub where_: Option<Box<Expression>>,
10698}
10699
10700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10702#[cfg_attr(feature = "bindings", derive(TS))]
10703pub struct OnCondition {
10704 #[serde(default)]
10705 pub error: Option<Box<Expression>>,
10706 #[serde(default)]
10707 pub empty: Option<Box<Expression>>,
10708 #[serde(default)]
10709 pub null: Option<Box<Expression>>,
10710}
10711
10712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10714#[cfg_attr(feature = "bindings", derive(TS))]
10715pub struct Returning {
10716 #[serde(default)]
10717 pub expressions: Vec<Expression>,
10718 #[serde(default)]
10719 pub into: Option<Box<Expression>>,
10720}
10721
10722#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10724#[cfg_attr(feature = "bindings", derive(TS))]
10725pub struct Introducer {
10726 pub this: Box<Expression>,
10727 pub expression: Box<Expression>,
10728}
10729
10730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10732#[cfg_attr(feature = "bindings", derive(TS))]
10733pub struct PartitionRange {
10734 pub this: Box<Expression>,
10735 #[serde(default)]
10736 pub expression: Option<Box<Expression>>,
10737 #[serde(default)]
10738 pub expressions: Vec<Expression>,
10739}
10740
10741#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10743#[cfg_attr(feature = "bindings", derive(TS))]
10744pub struct Group {
10745 #[serde(default)]
10746 pub expressions: Vec<Expression>,
10747 #[serde(default)]
10748 pub grouping_sets: Option<Box<Expression>>,
10749 #[serde(default)]
10750 pub cube: Option<Box<Expression>>,
10751 #[serde(default)]
10752 pub rollup: Option<Box<Expression>>,
10753 #[serde(default)]
10754 pub totals: Option<Box<Expression>>,
10755 #[serde(default)]
10757 pub all: Option<bool>,
10758}
10759
10760#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10762#[cfg_attr(feature = "bindings", derive(TS))]
10763pub struct Cube {
10764 #[serde(default)]
10765 pub expressions: Vec<Expression>,
10766}
10767
10768#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10770#[cfg_attr(feature = "bindings", derive(TS))]
10771pub struct Rollup {
10772 #[serde(default)]
10773 pub expressions: Vec<Expression>,
10774}
10775
10776#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10778#[cfg_attr(feature = "bindings", derive(TS))]
10779pub struct GroupingSets {
10780 #[serde(default)]
10781 pub expressions: Vec<Expression>,
10782}
10783
10784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10786#[cfg_attr(feature = "bindings", derive(TS))]
10787pub struct LimitOptions {
10788 #[serde(default)]
10789 pub percent: Option<Box<Expression>>,
10790 #[serde(default)]
10791 pub rows: Option<Box<Expression>>,
10792 #[serde(default)]
10793 pub with_ties: Option<Box<Expression>>,
10794}
10795
10796#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10798#[cfg_attr(feature = "bindings", derive(TS))]
10799pub struct Lateral {
10800 pub this: Box<Expression>,
10801 #[serde(default)]
10802 pub view: Option<Box<Expression>>,
10803 #[serde(default)]
10804 pub outer: Option<Box<Expression>>,
10805 #[serde(default)]
10806 pub alias: Option<String>,
10807 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
10809 pub alias_quoted: bool,
10810 #[serde(default)]
10811 pub cross_apply: Option<Box<Expression>>,
10812 #[serde(default)]
10813 pub ordinality: Option<Box<Expression>>,
10814 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10816 pub column_aliases: Vec<String>,
10817}
10818
10819#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10821#[cfg_attr(feature = "bindings", derive(TS))]
10822pub struct TableFromRows {
10823 pub this: Box<Expression>,
10824 #[serde(default)]
10825 pub alias: Option<String>,
10826 #[serde(default)]
10827 pub joins: Vec<Expression>,
10828 #[serde(default)]
10829 pub pivots: Option<Box<Expression>>,
10830 #[serde(default)]
10831 pub sample: Option<Box<Expression>>,
10832}
10833
10834#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10837#[cfg_attr(feature = "bindings", derive(TS))]
10838pub struct RowsFrom {
10839 pub expressions: Vec<Expression>,
10841 #[serde(default)]
10843 pub ordinality: bool,
10844 #[serde(default)]
10846 pub alias: Option<Box<Expression>>,
10847}
10848
10849#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10851#[cfg_attr(feature = "bindings", derive(TS))]
10852pub struct WithFill {
10853 #[serde(default)]
10854 pub from_: Option<Box<Expression>>,
10855 #[serde(default)]
10856 pub to: Option<Box<Expression>>,
10857 #[serde(default)]
10858 pub step: Option<Box<Expression>>,
10859 #[serde(default)]
10860 pub staleness: Option<Box<Expression>>,
10861 #[serde(default)]
10862 pub interpolate: Option<Box<Expression>>,
10863}
10864
10865#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10867#[cfg_attr(feature = "bindings", derive(TS))]
10868pub struct Property {
10869 pub this: Box<Expression>,
10870 #[serde(default)]
10871 pub value: Option<Box<Expression>>,
10872}
10873
10874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10876#[cfg_attr(feature = "bindings", derive(TS))]
10877pub struct GrantPrivilege {
10878 pub this: Box<Expression>,
10879 #[serde(default)]
10880 pub expressions: Vec<Expression>,
10881}
10882
10883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10885#[cfg_attr(feature = "bindings", derive(TS))]
10886pub struct AllowedValuesProperty {
10887 #[serde(default)]
10888 pub expressions: Vec<Expression>,
10889}
10890
10891#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10893#[cfg_attr(feature = "bindings", derive(TS))]
10894pub struct AlgorithmProperty {
10895 pub this: Box<Expression>,
10896}
10897
10898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10900#[cfg_attr(feature = "bindings", derive(TS))]
10901pub struct AutoIncrementProperty {
10902 pub this: Box<Expression>,
10903}
10904
10905#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10907#[cfg_attr(feature = "bindings", derive(TS))]
10908pub struct AutoRefreshProperty {
10909 pub this: Box<Expression>,
10910}
10911
10912#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10914#[cfg_attr(feature = "bindings", derive(TS))]
10915pub struct BackupProperty {
10916 pub this: Box<Expression>,
10917}
10918
10919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10921#[cfg_attr(feature = "bindings", derive(TS))]
10922pub struct BuildProperty {
10923 pub this: Box<Expression>,
10924}
10925
10926#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10928#[cfg_attr(feature = "bindings", derive(TS))]
10929pub struct BlockCompressionProperty {
10930 #[serde(default)]
10931 pub autotemp: Option<Box<Expression>>,
10932 #[serde(default)]
10933 pub always: Option<Box<Expression>>,
10934 #[serde(default)]
10935 pub default: Option<Box<Expression>>,
10936 #[serde(default)]
10937 pub manual: Option<Box<Expression>>,
10938 #[serde(default)]
10939 pub never: Option<Box<Expression>>,
10940}
10941
10942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10944#[cfg_attr(feature = "bindings", derive(TS))]
10945pub struct CharacterSetProperty {
10946 pub this: Box<Expression>,
10947 #[serde(default)]
10948 pub default: Option<Box<Expression>>,
10949}
10950
10951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10953#[cfg_attr(feature = "bindings", derive(TS))]
10954pub struct ChecksumProperty {
10955 #[serde(default)]
10956 pub on: Option<Box<Expression>>,
10957 #[serde(default)]
10958 pub default: Option<Box<Expression>>,
10959}
10960
10961#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10963#[cfg_attr(feature = "bindings", derive(TS))]
10964pub struct CollateProperty {
10965 pub this: Box<Expression>,
10966 #[serde(default)]
10967 pub default: Option<Box<Expression>>,
10968}
10969
10970#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10972#[cfg_attr(feature = "bindings", derive(TS))]
10973pub struct DataBlocksizeProperty {
10974 #[serde(default)]
10975 pub size: Option<i64>,
10976 #[serde(default)]
10977 pub units: Option<Box<Expression>>,
10978 #[serde(default)]
10979 pub minimum: Option<Box<Expression>>,
10980 #[serde(default)]
10981 pub maximum: Option<Box<Expression>>,
10982 #[serde(default)]
10983 pub default: Option<Box<Expression>>,
10984}
10985
10986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10988#[cfg_attr(feature = "bindings", derive(TS))]
10989pub struct DataDeletionProperty {
10990 pub on: Box<Expression>,
10991 #[serde(default)]
10992 pub filter_column: Option<Box<Expression>>,
10993 #[serde(default)]
10994 pub retention_period: Option<Box<Expression>>,
10995}
10996
10997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
10999#[cfg_attr(feature = "bindings", derive(TS))]
11000pub struct DefinerProperty {
11001 pub this: Box<Expression>,
11002}
11003
11004#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11006#[cfg_attr(feature = "bindings", derive(TS))]
11007pub struct DistKeyProperty {
11008 pub this: Box<Expression>,
11009}
11010
11011#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11013#[cfg_attr(feature = "bindings", derive(TS))]
11014pub struct DistributedByProperty {
11015 #[serde(default)]
11016 pub expressions: Vec<Expression>,
11017 pub kind: String,
11018 #[serde(default)]
11019 pub buckets: Option<Box<Expression>>,
11020 #[serde(default)]
11021 pub order: Option<Box<Expression>>,
11022}
11023
11024#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11026#[cfg_attr(feature = "bindings", derive(TS))]
11027pub struct DistStyleProperty {
11028 pub this: Box<Expression>,
11029}
11030
11031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11033#[cfg_attr(feature = "bindings", derive(TS))]
11034pub struct DuplicateKeyProperty {
11035 #[serde(default)]
11036 pub expressions: Vec<Expression>,
11037}
11038
11039#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11041#[cfg_attr(feature = "bindings", derive(TS))]
11042pub struct EngineProperty {
11043 pub this: Box<Expression>,
11044}
11045
11046#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11048#[cfg_attr(feature = "bindings", derive(TS))]
11049pub struct ToTableProperty {
11050 pub this: Box<Expression>,
11051}
11052
11053#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11055#[cfg_attr(feature = "bindings", derive(TS))]
11056pub struct ExecuteAsProperty {
11057 pub this: Box<Expression>,
11058}
11059
11060#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11062#[cfg_attr(feature = "bindings", derive(TS))]
11063pub struct ExternalProperty {
11064 #[serde(default)]
11065 pub this: Option<Box<Expression>>,
11066}
11067
11068#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11070#[cfg_attr(feature = "bindings", derive(TS))]
11071pub struct FallbackProperty {
11072 #[serde(default)]
11073 pub no: Option<Box<Expression>>,
11074 #[serde(default)]
11075 pub protection: Option<Box<Expression>>,
11076}
11077
11078#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11080#[cfg_attr(feature = "bindings", derive(TS))]
11081pub struct FileFormatProperty {
11082 #[serde(default)]
11083 pub this: Option<Box<Expression>>,
11084 #[serde(default)]
11085 pub expressions: Vec<Expression>,
11086 #[serde(default)]
11087 pub hive_format: Option<Box<Expression>>,
11088}
11089
11090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11092#[cfg_attr(feature = "bindings", derive(TS))]
11093pub struct CredentialsProperty {
11094 #[serde(default)]
11095 pub expressions: Vec<Expression>,
11096}
11097
11098#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11100#[cfg_attr(feature = "bindings", derive(TS))]
11101pub struct FreespaceProperty {
11102 pub this: Box<Expression>,
11103 #[serde(default)]
11104 pub percent: Option<Box<Expression>>,
11105}
11106
11107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11109#[cfg_attr(feature = "bindings", derive(TS))]
11110pub struct InheritsProperty {
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 InputModelProperty {
11119 pub this: Box<Expression>,
11120}
11121
11122#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11124#[cfg_attr(feature = "bindings", derive(TS))]
11125pub struct OutputModelProperty {
11126 pub this: Box<Expression>,
11127}
11128
11129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11131#[cfg_attr(feature = "bindings", derive(TS))]
11132pub struct IsolatedLoadingProperty {
11133 #[serde(default)]
11134 pub no: Option<Box<Expression>>,
11135 #[serde(default)]
11136 pub concurrent: Option<Box<Expression>>,
11137 #[serde(default)]
11138 pub target: Option<Box<Expression>>,
11139}
11140
11141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11143#[cfg_attr(feature = "bindings", derive(TS))]
11144pub struct JournalProperty {
11145 #[serde(default)]
11146 pub no: Option<Box<Expression>>,
11147 #[serde(default)]
11148 pub dual: Option<Box<Expression>>,
11149 #[serde(default)]
11150 pub before: Option<Box<Expression>>,
11151 #[serde(default)]
11152 pub local: Option<Box<Expression>>,
11153 #[serde(default)]
11154 pub after: Option<Box<Expression>>,
11155}
11156
11157#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11159#[cfg_attr(feature = "bindings", derive(TS))]
11160pub struct LanguageProperty {
11161 pub this: Box<Expression>,
11162}
11163
11164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11166#[cfg_attr(feature = "bindings", derive(TS))]
11167pub struct EnviromentProperty {
11168 #[serde(default)]
11169 pub expressions: Vec<Expression>,
11170}
11171
11172#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11174#[cfg_attr(feature = "bindings", derive(TS))]
11175pub struct ClusteredByProperty {
11176 #[serde(default)]
11177 pub expressions: Vec<Expression>,
11178 #[serde(default)]
11179 pub sorted_by: Option<Box<Expression>>,
11180 #[serde(default)]
11181 pub buckets: Option<Box<Expression>>,
11182}
11183
11184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11186#[cfg_attr(feature = "bindings", derive(TS))]
11187pub struct DictProperty {
11188 pub this: Box<Expression>,
11189 pub kind: String,
11190 #[serde(default)]
11191 pub settings: Option<Box<Expression>>,
11192}
11193
11194#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11196#[cfg_attr(feature = "bindings", derive(TS))]
11197pub struct DictRange {
11198 pub this: Box<Expression>,
11199 #[serde(default)]
11200 pub min: Option<Box<Expression>>,
11201 #[serde(default)]
11202 pub max: Option<Box<Expression>>,
11203}
11204
11205#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11207#[cfg_attr(feature = "bindings", derive(TS))]
11208pub struct OnCluster {
11209 pub this: Box<Expression>,
11210}
11211
11212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11214#[cfg_attr(feature = "bindings", derive(TS))]
11215pub struct LikeProperty {
11216 pub this: Box<Expression>,
11217 #[serde(default)]
11218 pub expressions: Vec<Expression>,
11219}
11220
11221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11223#[cfg_attr(feature = "bindings", derive(TS))]
11224pub struct LocationProperty {
11225 pub this: Box<Expression>,
11226}
11227
11228#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11230#[cfg_attr(feature = "bindings", derive(TS))]
11231pub struct LockProperty {
11232 pub this: Box<Expression>,
11233}
11234
11235#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11237#[cfg_attr(feature = "bindings", derive(TS))]
11238pub struct LockingProperty {
11239 #[serde(default)]
11240 pub this: Option<Box<Expression>>,
11241 pub kind: String,
11242 #[serde(default)]
11243 pub for_or_in: Option<Box<Expression>>,
11244 #[serde(default)]
11245 pub lock_type: Option<Box<Expression>>,
11246 #[serde(default)]
11247 pub override_: Option<Box<Expression>>,
11248}
11249
11250#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11252#[cfg_attr(feature = "bindings", derive(TS))]
11253pub struct LogProperty {
11254 #[serde(default)]
11255 pub no: Option<Box<Expression>>,
11256}
11257
11258#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11260#[cfg_attr(feature = "bindings", derive(TS))]
11261pub struct MaterializedProperty {
11262 #[serde(default)]
11263 pub this: Option<Box<Expression>>,
11264}
11265
11266#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11268#[cfg_attr(feature = "bindings", derive(TS))]
11269pub struct MergeBlockRatioProperty {
11270 #[serde(default)]
11271 pub this: Option<Box<Expression>>,
11272 #[serde(default)]
11273 pub no: Option<Box<Expression>>,
11274 #[serde(default)]
11275 pub default: Option<Box<Expression>>,
11276 #[serde(default)]
11277 pub percent: Option<Box<Expression>>,
11278}
11279
11280#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11282#[cfg_attr(feature = "bindings", derive(TS))]
11283pub struct OnProperty {
11284 pub this: Box<Expression>,
11285}
11286
11287#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11289#[cfg_attr(feature = "bindings", derive(TS))]
11290pub struct OnCommitProperty {
11291 #[serde(default)]
11292 pub delete: Option<Box<Expression>>,
11293}
11294
11295#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11297#[cfg_attr(feature = "bindings", derive(TS))]
11298pub struct PartitionedByProperty {
11299 pub this: Box<Expression>,
11300}
11301
11302#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11304#[cfg_attr(feature = "bindings", derive(TS))]
11305pub struct PartitionByProperty {
11306 #[serde(default)]
11307 pub expressions: Vec<Expression>,
11308}
11309
11310#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11312#[cfg_attr(feature = "bindings", derive(TS))]
11313pub struct PartitionedByBucket {
11314 pub this: Box<Expression>,
11315 pub expression: Box<Expression>,
11316}
11317
11318#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11320#[cfg_attr(feature = "bindings", derive(TS))]
11321pub struct ClusterByColumnsProperty {
11322 #[serde(default)]
11323 pub columns: Vec<Identifier>,
11324}
11325
11326#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11328#[cfg_attr(feature = "bindings", derive(TS))]
11329pub struct PartitionByTruncate {
11330 pub this: Box<Expression>,
11331 pub expression: Box<Expression>,
11332}
11333
11334#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11336#[cfg_attr(feature = "bindings", derive(TS))]
11337pub struct PartitionByRangeProperty {
11338 #[serde(default)]
11339 pub partition_expressions: Option<Box<Expression>>,
11340 #[serde(default)]
11341 pub create_expressions: Option<Box<Expression>>,
11342}
11343
11344#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11346#[cfg_attr(feature = "bindings", derive(TS))]
11347pub struct PartitionByRangePropertyDynamic {
11348 #[serde(default)]
11349 pub this: Option<Box<Expression>>,
11350 #[serde(default)]
11351 pub start: Option<Box<Expression>>,
11352 #[serde(default)]
11354 pub use_start_end: bool,
11355 #[serde(default)]
11356 pub end: Option<Box<Expression>>,
11357 #[serde(default)]
11358 pub every: Option<Box<Expression>>,
11359}
11360
11361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11363#[cfg_attr(feature = "bindings", derive(TS))]
11364pub struct PartitionByListProperty {
11365 #[serde(default)]
11366 pub partition_expressions: Option<Box<Expression>>,
11367 #[serde(default)]
11368 pub create_expressions: Option<Box<Expression>>,
11369}
11370
11371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11373#[cfg_attr(feature = "bindings", derive(TS))]
11374pub struct PartitionList {
11375 pub this: Box<Expression>,
11376 #[serde(default)]
11377 pub expressions: Vec<Expression>,
11378}
11379
11380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11382#[cfg_attr(feature = "bindings", derive(TS))]
11383pub struct Partition {
11384 pub expressions: Vec<Expression>,
11385 #[serde(default)]
11386 pub subpartition: bool,
11387}
11388
11389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11392#[cfg_attr(feature = "bindings", derive(TS))]
11393pub struct RefreshTriggerProperty {
11394 pub method: String,
11396 #[serde(default)]
11398 pub kind: Option<String>,
11399 #[serde(default)]
11401 pub every: Option<Box<Expression>>,
11402 #[serde(default)]
11404 pub unit: Option<String>,
11405 #[serde(default)]
11407 pub starts: Option<Box<Expression>>,
11408}
11409
11410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11412#[cfg_attr(feature = "bindings", derive(TS))]
11413pub struct UniqueKeyProperty {
11414 #[serde(default)]
11415 pub expressions: Vec<Expression>,
11416}
11417
11418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11420#[cfg_attr(feature = "bindings", derive(TS))]
11421pub struct RollupProperty {
11422 pub expressions: Vec<RollupIndex>,
11423}
11424
11425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11427#[cfg_attr(feature = "bindings", derive(TS))]
11428pub struct RollupIndex {
11429 pub name: Identifier,
11430 pub expressions: Vec<Identifier>,
11431}
11432
11433#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11435#[cfg_attr(feature = "bindings", derive(TS))]
11436pub struct PartitionBoundSpec {
11437 #[serde(default)]
11438 pub this: Option<Box<Expression>>,
11439 #[serde(default)]
11440 pub expression: Option<Box<Expression>>,
11441 #[serde(default)]
11442 pub from_expressions: Option<Box<Expression>>,
11443 #[serde(default)]
11444 pub to_expressions: Option<Box<Expression>>,
11445}
11446
11447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11449#[cfg_attr(feature = "bindings", derive(TS))]
11450pub struct PartitionedOfProperty {
11451 pub this: Box<Expression>,
11452 pub expression: Box<Expression>,
11453}
11454
11455#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11457#[cfg_attr(feature = "bindings", derive(TS))]
11458pub struct RemoteWithConnectionModelProperty {
11459 pub this: Box<Expression>,
11460}
11461
11462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11464#[cfg_attr(feature = "bindings", derive(TS))]
11465pub struct ReturnsProperty {
11466 #[serde(default)]
11467 pub this: Option<Box<Expression>>,
11468 #[serde(default)]
11469 pub is_table: Option<Box<Expression>>,
11470 #[serde(default)]
11471 pub table: Option<Box<Expression>>,
11472 #[serde(default)]
11473 pub null: Option<Box<Expression>>,
11474}
11475
11476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11478#[cfg_attr(feature = "bindings", derive(TS))]
11479pub struct RowFormatProperty {
11480 pub this: Box<Expression>,
11481}
11482
11483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11485#[cfg_attr(feature = "bindings", derive(TS))]
11486pub struct RowFormatDelimitedProperty {
11487 #[serde(default)]
11488 pub fields: Option<Box<Expression>>,
11489 #[serde(default)]
11490 pub escaped: Option<Box<Expression>>,
11491 #[serde(default)]
11492 pub collection_items: Option<Box<Expression>>,
11493 #[serde(default)]
11494 pub map_keys: Option<Box<Expression>>,
11495 #[serde(default)]
11496 pub lines: Option<Box<Expression>>,
11497 #[serde(default)]
11498 pub null: Option<Box<Expression>>,
11499 #[serde(default)]
11500 pub serde: Option<Box<Expression>>,
11501}
11502
11503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11505#[cfg_attr(feature = "bindings", derive(TS))]
11506pub struct RowFormatSerdeProperty {
11507 pub this: Box<Expression>,
11508 #[serde(default)]
11509 pub serde_properties: Option<Box<Expression>>,
11510}
11511
11512#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11514#[cfg_attr(feature = "bindings", derive(TS))]
11515pub struct QueryTransform {
11516 #[serde(default)]
11517 pub expressions: Vec<Expression>,
11518 #[serde(default)]
11519 pub command_script: Option<Box<Expression>>,
11520 #[serde(default)]
11521 pub schema: Option<Box<Expression>>,
11522 #[serde(default)]
11523 pub row_format_before: Option<Box<Expression>>,
11524 #[serde(default)]
11525 pub record_writer: Option<Box<Expression>>,
11526 #[serde(default)]
11527 pub row_format_after: Option<Box<Expression>>,
11528 #[serde(default)]
11529 pub record_reader: Option<Box<Expression>>,
11530}
11531
11532#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11534#[cfg_attr(feature = "bindings", derive(TS))]
11535pub struct SampleProperty {
11536 pub this: Box<Expression>,
11537}
11538
11539#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11541#[cfg_attr(feature = "bindings", derive(TS))]
11542pub struct SecurityProperty {
11543 pub this: Box<Expression>,
11544}
11545
11546#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11548#[cfg_attr(feature = "bindings", derive(TS))]
11549pub struct SchemaCommentProperty {
11550 pub this: Box<Expression>,
11551}
11552
11553#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11555#[cfg_attr(feature = "bindings", derive(TS))]
11556pub struct SemanticView {
11557 pub this: Box<Expression>,
11558 #[serde(default)]
11559 pub metrics: Option<Box<Expression>>,
11560 #[serde(default)]
11561 pub dimensions: Option<Box<Expression>>,
11562 #[serde(default)]
11563 pub facts: Option<Box<Expression>>,
11564 #[serde(default)]
11565 pub where_: Option<Box<Expression>>,
11566}
11567
11568#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11570#[cfg_attr(feature = "bindings", derive(TS))]
11571pub struct SerdeProperties {
11572 #[serde(default)]
11573 pub expressions: Vec<Expression>,
11574 #[serde(default)]
11575 pub with_: Option<Box<Expression>>,
11576}
11577
11578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11580#[cfg_attr(feature = "bindings", derive(TS))]
11581pub struct SetProperty {
11582 #[serde(default)]
11583 pub multi: Option<Box<Expression>>,
11584}
11585
11586#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11588#[cfg_attr(feature = "bindings", derive(TS))]
11589pub struct SharingProperty {
11590 #[serde(default)]
11591 pub this: Option<Box<Expression>>,
11592}
11593
11594#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11596#[cfg_attr(feature = "bindings", derive(TS))]
11597pub struct SetConfigProperty {
11598 pub this: Box<Expression>,
11599}
11600
11601#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11603#[cfg_attr(feature = "bindings", derive(TS))]
11604pub struct SettingsProperty {
11605 #[serde(default)]
11606 pub expressions: Vec<Expression>,
11607}
11608
11609#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11611#[cfg_attr(feature = "bindings", derive(TS))]
11612pub struct SortKeyProperty {
11613 pub this: Box<Expression>,
11614 #[serde(default)]
11615 pub compound: Option<Box<Expression>>,
11616}
11617
11618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11620#[cfg_attr(feature = "bindings", derive(TS))]
11621pub struct SqlReadWriteProperty {
11622 pub this: Box<Expression>,
11623}
11624
11625#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11627#[cfg_attr(feature = "bindings", derive(TS))]
11628pub struct SqlSecurityProperty {
11629 pub this: Box<Expression>,
11630}
11631
11632#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11634#[cfg_attr(feature = "bindings", derive(TS))]
11635pub struct StabilityProperty {
11636 pub this: Box<Expression>,
11637}
11638
11639#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11641#[cfg_attr(feature = "bindings", derive(TS))]
11642pub struct StorageHandlerProperty {
11643 pub this: Box<Expression>,
11644}
11645
11646#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11648#[cfg_attr(feature = "bindings", derive(TS))]
11649pub struct TemporaryProperty {
11650 #[serde(default)]
11651 pub this: Option<Box<Expression>>,
11652}
11653
11654#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11656#[cfg_attr(feature = "bindings", derive(TS))]
11657pub struct Tags {
11658 #[serde(default)]
11659 pub expressions: Vec<Expression>,
11660}
11661
11662#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11664#[cfg_attr(feature = "bindings", derive(TS))]
11665pub struct TransformModelProperty {
11666 #[serde(default)]
11667 pub expressions: Vec<Expression>,
11668}
11669
11670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11672#[cfg_attr(feature = "bindings", derive(TS))]
11673pub struct TransientProperty {
11674 #[serde(default)]
11675 pub this: Option<Box<Expression>>,
11676}
11677
11678#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11680#[cfg_attr(feature = "bindings", derive(TS))]
11681pub struct UsingTemplateProperty {
11682 pub this: Box<Expression>,
11683}
11684
11685#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11687#[cfg_attr(feature = "bindings", derive(TS))]
11688pub struct ViewAttributeProperty {
11689 pub this: Box<Expression>,
11690}
11691
11692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11694#[cfg_attr(feature = "bindings", derive(TS))]
11695pub struct VolatileProperty {
11696 #[serde(default)]
11697 pub this: Option<Box<Expression>>,
11698}
11699
11700#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11702#[cfg_attr(feature = "bindings", derive(TS))]
11703pub struct WithDataProperty {
11704 #[serde(default)]
11705 pub no: Option<Box<Expression>>,
11706 #[serde(default)]
11707 pub statistics: Option<Box<Expression>>,
11708}
11709
11710#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11712#[cfg_attr(feature = "bindings", derive(TS))]
11713pub struct WithJournalTableProperty {
11714 pub this: Box<Expression>,
11715}
11716
11717#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11719#[cfg_attr(feature = "bindings", derive(TS))]
11720pub struct WithSchemaBindingProperty {
11721 pub this: Box<Expression>,
11722}
11723
11724#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11726#[cfg_attr(feature = "bindings", derive(TS))]
11727pub struct WithSystemVersioningProperty {
11728 #[serde(default)]
11729 pub on: Option<Box<Expression>>,
11730 #[serde(default)]
11731 pub this: Option<Box<Expression>>,
11732 #[serde(default)]
11733 pub data_consistency: Option<Box<Expression>>,
11734 #[serde(default)]
11735 pub retention_period: Option<Box<Expression>>,
11736 #[serde(default)]
11737 pub with_: Option<Box<Expression>>,
11738}
11739
11740#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11742#[cfg_attr(feature = "bindings", derive(TS))]
11743pub struct WithProcedureOptions {
11744 #[serde(default)]
11745 pub expressions: Vec<Expression>,
11746}
11747
11748#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11750#[cfg_attr(feature = "bindings", derive(TS))]
11751pub struct EncodeProperty {
11752 pub this: Box<Expression>,
11753 #[serde(default)]
11754 pub properties: Vec<Expression>,
11755 #[serde(default)]
11756 pub key: Option<Box<Expression>>,
11757}
11758
11759#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11761#[cfg_attr(feature = "bindings", derive(TS))]
11762pub struct IncludeProperty {
11763 pub this: Box<Expression>,
11764 #[serde(default)]
11765 pub alias: Option<String>,
11766 #[serde(default)]
11767 pub column_def: Option<Box<Expression>>,
11768}
11769
11770#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11772#[cfg_attr(feature = "bindings", derive(TS))]
11773pub struct Properties {
11774 #[serde(default)]
11775 pub expressions: Vec<Expression>,
11776}
11777
11778#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11780#[cfg_attr(feature = "bindings", derive(TS))]
11781pub struct OptionEntry {
11782 pub key: Identifier,
11783 pub value: Expression,
11784}
11785
11786#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11788#[cfg_attr(feature = "bindings", derive(TS))]
11789pub struct OptionsProperty {
11790 #[serde(default)]
11791 pub entries: Vec<OptionEntry>,
11792}
11793
11794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11796#[cfg_attr(feature = "bindings", derive(TS))]
11797pub struct InputOutputFormat {
11798 #[serde(default)]
11799 pub input_format: Option<Box<Expression>>,
11800 #[serde(default)]
11801 pub output_format: Option<Box<Expression>>,
11802}
11803
11804#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11806#[cfg_attr(feature = "bindings", derive(TS))]
11807pub struct Reference {
11808 pub this: Box<Expression>,
11809 #[serde(default)]
11810 pub expressions: Vec<Expression>,
11811 #[serde(default)]
11812 pub options: Vec<Expression>,
11813}
11814
11815#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11817#[cfg_attr(feature = "bindings", derive(TS))]
11818pub struct QueryOption {
11819 pub this: Box<Expression>,
11820 #[serde(default)]
11821 pub expression: Option<Box<Expression>>,
11822}
11823
11824#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11826#[cfg_attr(feature = "bindings", derive(TS))]
11827pub struct WithTableHint {
11828 #[serde(default)]
11829 pub expressions: Vec<Expression>,
11830}
11831
11832#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11834#[cfg_attr(feature = "bindings", derive(TS))]
11835pub struct IndexTableHint {
11836 pub this: Box<Expression>,
11837 #[serde(default)]
11838 pub expressions: Vec<Expression>,
11839 #[serde(default)]
11840 pub target: Option<Box<Expression>>,
11841}
11842
11843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11845#[cfg_attr(feature = "bindings", derive(TS))]
11846pub struct Get {
11847 pub this: Box<Expression>,
11848 #[serde(default)]
11849 pub target: Option<Box<Expression>>,
11850 #[serde(default)]
11851 pub properties: Vec<Expression>,
11852}
11853
11854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11856#[cfg_attr(feature = "bindings", derive(TS))]
11857pub struct SetOperation {
11858 #[serde(default)]
11859 pub with_: Option<Box<Expression>>,
11860 pub this: Box<Expression>,
11861 pub expression: Box<Expression>,
11862 #[serde(default)]
11863 pub distinct: bool,
11864 #[serde(default)]
11865 pub by_name: Option<Box<Expression>>,
11866 #[serde(default)]
11867 pub side: Option<Box<Expression>>,
11868 #[serde(default)]
11869 pub kind: Option<String>,
11870 #[serde(default)]
11871 pub on: Option<Box<Expression>>,
11872}
11873
11874#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11876#[cfg_attr(feature = "bindings", derive(TS))]
11877pub struct Var {
11878 pub this: String,
11879}
11880
11881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11883#[cfg_attr(feature = "bindings", derive(TS))]
11884pub struct Variadic {
11885 pub this: Box<Expression>,
11886}
11887
11888#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11890#[cfg_attr(feature = "bindings", derive(TS))]
11891pub struct Version {
11892 pub this: Box<Expression>,
11893 pub kind: String,
11894 #[serde(default)]
11895 pub expression: Option<Box<Expression>>,
11896}
11897
11898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11900#[cfg_attr(feature = "bindings", derive(TS))]
11901pub struct Schema {
11902 #[serde(default)]
11903 pub this: Option<Box<Expression>>,
11904 #[serde(default)]
11905 pub expressions: Vec<Expression>,
11906}
11907
11908#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11910#[cfg_attr(feature = "bindings", derive(TS))]
11911pub struct Lock {
11912 #[serde(default)]
11913 pub update: Option<Box<Expression>>,
11914 #[serde(default)]
11915 pub expressions: Vec<Expression>,
11916 #[serde(default)]
11917 pub wait: Option<Box<Expression>>,
11918 #[serde(default)]
11919 pub key: Option<Box<Expression>>,
11920}
11921
11922#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11925#[cfg_attr(feature = "bindings", derive(TS))]
11926pub struct TableSample {
11927 #[serde(default, skip_serializing_if = "Option::is_none")]
11929 pub this: Option<Box<Expression>>,
11930 #[serde(default, skip_serializing_if = "Option::is_none")]
11932 pub sample: Option<Box<Sample>>,
11933 #[serde(default)]
11934 pub expressions: Vec<Expression>,
11935 #[serde(default)]
11936 pub method: Option<String>,
11937 #[serde(default)]
11938 pub bucket_numerator: Option<Box<Expression>>,
11939 #[serde(default)]
11940 pub bucket_denominator: Option<Box<Expression>>,
11941 #[serde(default)]
11942 pub bucket_field: Option<Box<Expression>>,
11943 #[serde(default)]
11944 pub percent: Option<Box<Expression>>,
11945 #[serde(default)]
11946 pub rows: Option<Box<Expression>>,
11947 #[serde(default)]
11948 pub size: Option<i64>,
11949 #[serde(default)]
11950 pub seed: Option<Box<Expression>>,
11951}
11952
11953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11955#[cfg_attr(feature = "bindings", derive(TS))]
11956pub struct Tag {
11957 #[serde(default)]
11958 pub this: Option<Box<Expression>>,
11959 #[serde(default)]
11960 pub prefix: Option<Box<Expression>>,
11961 #[serde(default)]
11962 pub postfix: Option<Box<Expression>>,
11963}
11964
11965#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11967#[cfg_attr(feature = "bindings", derive(TS))]
11968pub struct UnpivotColumns {
11969 pub this: Box<Expression>,
11970 #[serde(default)]
11971 pub expressions: Vec<Expression>,
11972}
11973
11974#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11976#[cfg_attr(feature = "bindings", derive(TS))]
11977pub struct SessionParameter {
11978 pub this: Box<Expression>,
11979 #[serde(default)]
11980 pub kind: Option<String>,
11981}
11982
11983#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11985#[cfg_attr(feature = "bindings", derive(TS))]
11986pub struct PseudoType {
11987 pub this: Box<Expression>,
11988}
11989
11990#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11992#[cfg_attr(feature = "bindings", derive(TS))]
11993pub struct ObjectIdentifier {
11994 pub this: Box<Expression>,
11995}
11996
11997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11999#[cfg_attr(feature = "bindings", derive(TS))]
12000pub struct Transaction {
12001 #[serde(default)]
12002 pub this: Option<Box<Expression>>,
12003 #[serde(default)]
12004 pub modes: Option<Box<Expression>>,
12005 #[serde(default)]
12006 pub mark: Option<Box<Expression>>,
12007}
12008
12009#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12011#[cfg_attr(feature = "bindings", derive(TS))]
12012pub struct Commit {
12013 #[serde(default)]
12014 pub chain: Option<Box<Expression>>,
12015 #[serde(default)]
12016 pub this: Option<Box<Expression>>,
12017 #[serde(default)]
12018 pub durability: Option<Box<Expression>>,
12019}
12020
12021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12023#[cfg_attr(feature = "bindings", derive(TS))]
12024pub struct Rollback {
12025 #[serde(default)]
12026 pub savepoint: Option<Box<Expression>>,
12027 #[serde(default)]
12028 pub this: Option<Box<Expression>>,
12029}
12030
12031#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12033#[cfg_attr(feature = "bindings", derive(TS))]
12034pub struct AlterSession {
12035 #[serde(default)]
12036 pub expressions: Vec<Expression>,
12037 #[serde(default)]
12038 pub unset: Option<Box<Expression>>,
12039}
12040
12041#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12043#[cfg_attr(feature = "bindings", derive(TS))]
12044pub struct Analyze {
12045 #[serde(default)]
12046 pub kind: Option<String>,
12047 #[serde(default)]
12048 pub this: Option<Box<Expression>>,
12049 #[serde(default)]
12050 pub options: Vec<Expression>,
12051 #[serde(default)]
12052 pub mode: Option<Box<Expression>>,
12053 #[serde(default)]
12054 pub partition: Option<Box<Expression>>,
12055 #[serde(default)]
12056 pub expression: Option<Box<Expression>>,
12057 #[serde(default)]
12058 pub properties: Vec<Expression>,
12059 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12061 pub columns: Vec<String>,
12062}
12063
12064#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12066#[cfg_attr(feature = "bindings", derive(TS))]
12067pub struct AnalyzeStatistics {
12068 pub kind: String,
12069 #[serde(default)]
12070 pub option: Option<Box<Expression>>,
12071 #[serde(default)]
12072 pub this: Option<Box<Expression>>,
12073 #[serde(default)]
12074 pub expressions: Vec<Expression>,
12075}
12076
12077#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12079#[cfg_attr(feature = "bindings", derive(TS))]
12080pub struct AnalyzeHistogram {
12081 pub this: Box<Expression>,
12082 #[serde(default)]
12083 pub expressions: Vec<Expression>,
12084 #[serde(default)]
12085 pub expression: Option<Box<Expression>>,
12086 #[serde(default)]
12087 pub update_options: Option<Box<Expression>>,
12088}
12089
12090#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12092#[cfg_attr(feature = "bindings", derive(TS))]
12093pub struct AnalyzeSample {
12094 pub kind: String,
12095 #[serde(default)]
12096 pub sample: Option<Box<Expression>>,
12097}
12098
12099#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12101#[cfg_attr(feature = "bindings", derive(TS))]
12102pub struct AnalyzeListChainedRows {
12103 #[serde(default)]
12104 pub expression: Option<Box<Expression>>,
12105}
12106
12107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12109#[cfg_attr(feature = "bindings", derive(TS))]
12110pub struct AnalyzeDelete {
12111 #[serde(default)]
12112 pub kind: Option<String>,
12113}
12114
12115#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12117#[cfg_attr(feature = "bindings", derive(TS))]
12118pub struct AnalyzeWith {
12119 #[serde(default)]
12120 pub expressions: Vec<Expression>,
12121}
12122
12123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12125#[cfg_attr(feature = "bindings", derive(TS))]
12126pub struct AnalyzeValidate {
12127 pub kind: String,
12128 #[serde(default)]
12129 pub this: Option<Box<Expression>>,
12130 #[serde(default)]
12131 pub expression: Option<Box<Expression>>,
12132}
12133
12134#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12136#[cfg_attr(feature = "bindings", derive(TS))]
12137pub struct AddPartition {
12138 pub this: Box<Expression>,
12139 #[serde(default)]
12140 pub exists: bool,
12141 #[serde(default)]
12142 pub location: Option<Box<Expression>>,
12143}
12144
12145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12147#[cfg_attr(feature = "bindings", derive(TS))]
12148pub struct AttachOption {
12149 pub this: Box<Expression>,
12150 #[serde(default)]
12151 pub expression: Option<Box<Expression>>,
12152}
12153
12154#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12156#[cfg_attr(feature = "bindings", derive(TS))]
12157pub struct DropPartition {
12158 #[serde(default)]
12159 pub expressions: Vec<Expression>,
12160 #[serde(default)]
12161 pub exists: bool,
12162}
12163
12164#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12166#[cfg_attr(feature = "bindings", derive(TS))]
12167pub struct ReplacePartition {
12168 pub expression: Box<Expression>,
12169 #[serde(default)]
12170 pub source: Option<Box<Expression>>,
12171}
12172
12173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12175#[cfg_attr(feature = "bindings", derive(TS))]
12176pub struct DPipe {
12177 pub this: Box<Expression>,
12178 pub expression: Box<Expression>,
12179 #[serde(default)]
12180 pub safe: Option<Box<Expression>>,
12181}
12182
12183#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12185#[cfg_attr(feature = "bindings", derive(TS))]
12186pub struct Operator {
12187 pub this: Box<Expression>,
12188 #[serde(default)]
12189 pub operator: Option<Box<Expression>>,
12190 pub expression: Box<Expression>,
12191 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12193 pub comments: Vec<String>,
12194}
12195
12196#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12198#[cfg_attr(feature = "bindings", derive(TS))]
12199pub struct PivotAny {
12200 #[serde(default)]
12201 pub this: Option<Box<Expression>>,
12202}
12203
12204#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12206#[cfg_attr(feature = "bindings", derive(TS))]
12207pub struct Aliases {
12208 pub this: Box<Expression>,
12209 #[serde(default)]
12210 pub expressions: Vec<Expression>,
12211}
12212
12213#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12215#[cfg_attr(feature = "bindings", derive(TS))]
12216pub struct AtIndex {
12217 pub this: Box<Expression>,
12218 pub expression: Box<Expression>,
12219}
12220
12221#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12223#[cfg_attr(feature = "bindings", derive(TS))]
12224pub struct FromTimeZone {
12225 pub this: Box<Expression>,
12226 #[serde(default)]
12227 pub zone: Option<Box<Expression>>,
12228}
12229
12230#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct FormatPhrase {
12234 pub this: Box<Expression>,
12235 pub format: String,
12236}
12237
12238#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12240#[cfg_attr(feature = "bindings", derive(TS))]
12241pub struct ForIn {
12242 pub this: Box<Expression>,
12243 pub expression: Box<Expression>,
12244}
12245
12246#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12248#[cfg_attr(feature = "bindings", derive(TS))]
12249pub struct TimeUnit {
12250 #[serde(default)]
12251 pub unit: Option<String>,
12252}
12253
12254#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12256#[cfg_attr(feature = "bindings", derive(TS))]
12257pub struct IntervalOp {
12258 #[serde(default)]
12259 pub unit: Option<String>,
12260 pub expression: Box<Expression>,
12261}
12262
12263#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12265#[cfg_attr(feature = "bindings", derive(TS))]
12266pub struct HavingMax {
12267 pub this: Box<Expression>,
12268 pub expression: Box<Expression>,
12269 #[serde(default)]
12270 pub max: Option<Box<Expression>>,
12271}
12272
12273#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12275#[cfg_attr(feature = "bindings", derive(TS))]
12276pub struct CosineDistance {
12277 pub this: Box<Expression>,
12278 pub expression: Box<Expression>,
12279}
12280
12281#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12283#[cfg_attr(feature = "bindings", derive(TS))]
12284pub struct DotProduct {
12285 pub this: Box<Expression>,
12286 pub expression: Box<Expression>,
12287}
12288
12289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12291#[cfg_attr(feature = "bindings", derive(TS))]
12292pub struct EuclideanDistance {
12293 pub this: Box<Expression>,
12294 pub expression: Box<Expression>,
12295}
12296
12297#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12299#[cfg_attr(feature = "bindings", derive(TS))]
12300pub struct ManhattanDistance {
12301 pub this: Box<Expression>,
12302 pub expression: Box<Expression>,
12303}
12304
12305#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12307#[cfg_attr(feature = "bindings", derive(TS))]
12308pub struct JarowinklerSimilarity {
12309 pub this: Box<Expression>,
12310 pub expression: Box<Expression>,
12311}
12312
12313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12315#[cfg_attr(feature = "bindings", derive(TS))]
12316pub struct Booland {
12317 pub this: Box<Expression>,
12318 pub expression: Box<Expression>,
12319}
12320
12321#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12323#[cfg_attr(feature = "bindings", derive(TS))]
12324pub struct Boolor {
12325 pub this: Box<Expression>,
12326 pub expression: Box<Expression>,
12327}
12328
12329#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12331#[cfg_attr(feature = "bindings", derive(TS))]
12332pub struct ParameterizedAgg {
12333 pub this: Box<Expression>,
12334 #[serde(default)]
12335 pub expressions: Vec<Expression>,
12336 #[serde(default)]
12337 pub params: Vec<Expression>,
12338}
12339
12340#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12342#[cfg_attr(feature = "bindings", derive(TS))]
12343pub struct ArgMax {
12344 pub this: Box<Expression>,
12345 pub expression: Box<Expression>,
12346 #[serde(default)]
12347 pub count: Option<Box<Expression>>,
12348}
12349
12350#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12352#[cfg_attr(feature = "bindings", derive(TS))]
12353pub struct ArgMin {
12354 pub this: Box<Expression>,
12355 pub expression: Box<Expression>,
12356 #[serde(default)]
12357 pub count: Option<Box<Expression>>,
12358}
12359
12360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12362#[cfg_attr(feature = "bindings", derive(TS))]
12363pub struct ApproxTopK {
12364 pub this: Box<Expression>,
12365 #[serde(default)]
12366 pub expression: Option<Box<Expression>>,
12367 #[serde(default)]
12368 pub counters: Option<Box<Expression>>,
12369}
12370
12371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12373#[cfg_attr(feature = "bindings", derive(TS))]
12374pub struct ApproxTopKAccumulate {
12375 pub this: Box<Expression>,
12376 #[serde(default)]
12377 pub expression: Option<Box<Expression>>,
12378}
12379
12380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12382#[cfg_attr(feature = "bindings", derive(TS))]
12383pub struct ApproxTopKCombine {
12384 pub this: Box<Expression>,
12385 #[serde(default)]
12386 pub expression: Option<Box<Expression>>,
12387}
12388
12389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12391#[cfg_attr(feature = "bindings", derive(TS))]
12392pub struct ApproxTopKEstimate {
12393 pub this: Box<Expression>,
12394 #[serde(default)]
12395 pub expression: Option<Box<Expression>>,
12396}
12397
12398#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12400#[cfg_attr(feature = "bindings", derive(TS))]
12401pub struct ApproxTopSum {
12402 pub this: Box<Expression>,
12403 pub expression: Box<Expression>,
12404 #[serde(default)]
12405 pub count: Option<Box<Expression>>,
12406}
12407
12408#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12410#[cfg_attr(feature = "bindings", derive(TS))]
12411pub struct ApproxQuantiles {
12412 pub this: Box<Expression>,
12413 #[serde(default)]
12414 pub expression: Option<Box<Expression>>,
12415}
12416
12417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12419#[cfg_attr(feature = "bindings", derive(TS))]
12420pub struct Minhash {
12421 pub this: Box<Expression>,
12422 #[serde(default)]
12423 pub expressions: Vec<Expression>,
12424}
12425
12426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12428#[cfg_attr(feature = "bindings", derive(TS))]
12429pub struct FarmFingerprint {
12430 #[serde(default)]
12431 pub expressions: Vec<Expression>,
12432}
12433
12434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12436#[cfg_attr(feature = "bindings", derive(TS))]
12437pub struct Float64 {
12438 pub this: Box<Expression>,
12439 #[serde(default)]
12440 pub expression: Option<Box<Expression>>,
12441}
12442
12443#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12445#[cfg_attr(feature = "bindings", derive(TS))]
12446pub struct Transform {
12447 pub this: Box<Expression>,
12448 pub expression: Box<Expression>,
12449}
12450
12451#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12453#[cfg_attr(feature = "bindings", derive(TS))]
12454pub struct Translate {
12455 pub this: Box<Expression>,
12456 #[serde(default)]
12457 pub from_: Option<Box<Expression>>,
12458 #[serde(default)]
12459 pub to: Option<Box<Expression>>,
12460}
12461
12462#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12464#[cfg_attr(feature = "bindings", derive(TS))]
12465pub struct Grouping {
12466 #[serde(default)]
12467 pub expressions: Vec<Expression>,
12468}
12469
12470#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12472#[cfg_attr(feature = "bindings", derive(TS))]
12473pub struct GroupingId {
12474 #[serde(default)]
12475 pub expressions: Vec<Expression>,
12476}
12477
12478#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12480#[cfg_attr(feature = "bindings", derive(TS))]
12481pub struct Anonymous {
12482 pub this: Box<Expression>,
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 AnonymousAggFunc {
12491 pub this: Box<Expression>,
12492 #[serde(default)]
12493 pub expressions: Vec<Expression>,
12494}
12495
12496#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12498#[cfg_attr(feature = "bindings", derive(TS))]
12499pub struct CombinedAggFunc {
12500 pub this: Box<Expression>,
12501 #[serde(default)]
12502 pub expressions: Vec<Expression>,
12503}
12504
12505#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12507#[cfg_attr(feature = "bindings", derive(TS))]
12508pub struct CombinedParameterizedAgg {
12509 pub this: Box<Expression>,
12510 #[serde(default)]
12511 pub expressions: Vec<Expression>,
12512 #[serde(default)]
12513 pub params: Vec<Expression>,
12514}
12515
12516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12518#[cfg_attr(feature = "bindings", derive(TS))]
12519pub struct HashAgg {
12520 pub this: Box<Expression>,
12521 #[serde(default)]
12522 pub expressions: Vec<Expression>,
12523}
12524
12525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12527#[cfg_attr(feature = "bindings", derive(TS))]
12528pub struct Hll {
12529 pub this: Box<Expression>,
12530 #[serde(default)]
12531 pub expressions: Vec<Expression>,
12532}
12533
12534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12536#[cfg_attr(feature = "bindings", derive(TS))]
12537pub struct Apply {
12538 pub this: Box<Expression>,
12539 pub expression: Box<Expression>,
12540}
12541
12542#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12544#[cfg_attr(feature = "bindings", derive(TS))]
12545pub struct ToBoolean {
12546 pub this: Box<Expression>,
12547 #[serde(default)]
12548 pub safe: Option<Box<Expression>>,
12549}
12550
12551#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12553#[cfg_attr(feature = "bindings", derive(TS))]
12554pub struct List {
12555 #[serde(default)]
12556 pub expressions: Vec<Expression>,
12557}
12558
12559#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12564#[cfg_attr(feature = "bindings", derive(TS))]
12565pub struct ToMap {
12566 pub this: Box<Expression>,
12568}
12569
12570#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12572#[cfg_attr(feature = "bindings", derive(TS))]
12573pub struct Pad {
12574 pub this: Box<Expression>,
12575 pub expression: Box<Expression>,
12576 #[serde(default)]
12577 pub fill_pattern: Option<Box<Expression>>,
12578 #[serde(default)]
12579 pub is_left: Option<Box<Expression>>,
12580}
12581
12582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12584#[cfg_attr(feature = "bindings", derive(TS))]
12585pub struct ToChar {
12586 pub this: Box<Expression>,
12587 #[serde(default)]
12588 pub format: Option<String>,
12589 #[serde(default)]
12590 pub nlsparam: Option<Box<Expression>>,
12591 #[serde(default)]
12592 pub is_numeric: Option<Box<Expression>>,
12593}
12594
12595#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12597#[cfg_attr(feature = "bindings", derive(TS))]
12598pub struct StringFunc {
12599 pub this: Box<Expression>,
12600 #[serde(default)]
12601 pub zone: Option<Box<Expression>>,
12602}
12603
12604#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12606#[cfg_attr(feature = "bindings", derive(TS))]
12607pub struct ToNumber {
12608 pub this: Box<Expression>,
12609 #[serde(default)]
12610 pub format: Option<Box<Expression>>,
12611 #[serde(default)]
12612 pub nlsparam: Option<Box<Expression>>,
12613 #[serde(default)]
12614 pub precision: Option<Box<Expression>>,
12615 #[serde(default)]
12616 pub scale: Option<Box<Expression>>,
12617 #[serde(default)]
12618 pub safe: Option<Box<Expression>>,
12619 #[serde(default)]
12620 pub safe_name: Option<Box<Expression>>,
12621}
12622
12623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12625#[cfg_attr(feature = "bindings", derive(TS))]
12626pub struct ToDouble {
12627 pub this: Box<Expression>,
12628 #[serde(default)]
12629 pub format: Option<String>,
12630 #[serde(default)]
12631 pub safe: Option<Box<Expression>>,
12632}
12633
12634#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12636#[cfg_attr(feature = "bindings", derive(TS))]
12637pub struct ToDecfloat {
12638 pub this: Box<Expression>,
12639 #[serde(default)]
12640 pub format: Option<String>,
12641}
12642
12643#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12645#[cfg_attr(feature = "bindings", derive(TS))]
12646pub struct TryToDecfloat {
12647 pub this: Box<Expression>,
12648 #[serde(default)]
12649 pub format: Option<String>,
12650}
12651
12652#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12654#[cfg_attr(feature = "bindings", derive(TS))]
12655pub struct ToFile {
12656 pub this: Box<Expression>,
12657 #[serde(default)]
12658 pub path: Option<Box<Expression>>,
12659 #[serde(default)]
12660 pub safe: Option<Box<Expression>>,
12661}
12662
12663#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12665#[cfg_attr(feature = "bindings", derive(TS))]
12666pub struct Columns {
12667 pub this: Box<Expression>,
12668 #[serde(default)]
12669 pub unpack: Option<Box<Expression>>,
12670}
12671
12672#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12674#[cfg_attr(feature = "bindings", derive(TS))]
12675pub struct ConvertToCharset {
12676 pub this: Box<Expression>,
12677 #[serde(default)]
12678 pub dest: Option<Box<Expression>>,
12679 #[serde(default)]
12680 pub source: Option<Box<Expression>>,
12681}
12682
12683#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12685#[cfg_attr(feature = "bindings", derive(TS))]
12686pub struct ConvertTimezone {
12687 #[serde(default)]
12688 pub source_tz: Option<Box<Expression>>,
12689 #[serde(default)]
12690 pub target_tz: Option<Box<Expression>>,
12691 #[serde(default)]
12692 pub timestamp: Option<Box<Expression>>,
12693 #[serde(default)]
12694 pub options: Vec<Expression>,
12695}
12696
12697#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12699#[cfg_attr(feature = "bindings", derive(TS))]
12700pub struct GenerateSeries {
12701 #[serde(default)]
12702 pub start: Option<Box<Expression>>,
12703 #[serde(default)]
12704 pub end: Option<Box<Expression>>,
12705 #[serde(default)]
12706 pub step: Option<Box<Expression>>,
12707 #[serde(default)]
12708 pub is_end_exclusive: Option<Box<Expression>>,
12709}
12710
12711#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12713#[cfg_attr(feature = "bindings", derive(TS))]
12714pub struct AIAgg {
12715 pub this: Box<Expression>,
12716 pub expression: Box<Expression>,
12717}
12718
12719#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12721#[cfg_attr(feature = "bindings", derive(TS))]
12722pub struct AIClassify {
12723 pub this: Box<Expression>,
12724 #[serde(default)]
12725 pub categories: Option<Box<Expression>>,
12726 #[serde(default)]
12727 pub config: Option<Box<Expression>>,
12728}
12729
12730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12732#[cfg_attr(feature = "bindings", derive(TS))]
12733pub struct ArrayAll {
12734 pub this: Box<Expression>,
12735 pub expression: Box<Expression>,
12736}
12737
12738#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12740#[cfg_attr(feature = "bindings", derive(TS))]
12741pub struct ArrayAny {
12742 pub this: Box<Expression>,
12743 pub expression: Box<Expression>,
12744}
12745
12746#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12748#[cfg_attr(feature = "bindings", derive(TS))]
12749pub struct ArrayConstructCompact {
12750 #[serde(default)]
12751 pub expressions: Vec<Expression>,
12752}
12753
12754#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12756#[cfg_attr(feature = "bindings", derive(TS))]
12757pub struct StPoint {
12758 pub this: Box<Expression>,
12759 pub expression: Box<Expression>,
12760 #[serde(default)]
12761 pub null: Option<Box<Expression>>,
12762}
12763
12764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12766#[cfg_attr(feature = "bindings", derive(TS))]
12767pub struct StDistance {
12768 pub this: Box<Expression>,
12769 pub expression: Box<Expression>,
12770 #[serde(default)]
12771 pub use_spheroid: Option<Box<Expression>>,
12772}
12773
12774#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12776#[cfg_attr(feature = "bindings", derive(TS))]
12777pub struct StringToArray {
12778 pub this: Box<Expression>,
12779 #[serde(default)]
12780 pub expression: Option<Box<Expression>>,
12781 #[serde(default)]
12782 pub null: Option<Box<Expression>>,
12783}
12784
12785#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12787#[cfg_attr(feature = "bindings", derive(TS))]
12788pub struct ArraySum {
12789 pub this: Box<Expression>,
12790 #[serde(default)]
12791 pub expression: Option<Box<Expression>>,
12792}
12793
12794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12796#[cfg_attr(feature = "bindings", derive(TS))]
12797pub struct ObjectAgg {
12798 pub this: Box<Expression>,
12799 pub expression: Box<Expression>,
12800}
12801
12802#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12804#[cfg_attr(feature = "bindings", derive(TS))]
12805pub struct CastToStrType {
12806 pub this: Box<Expression>,
12807 #[serde(default)]
12808 pub to: Option<Box<Expression>>,
12809}
12810
12811#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12813#[cfg_attr(feature = "bindings", derive(TS))]
12814pub struct CheckJson {
12815 pub this: Box<Expression>,
12816}
12817
12818#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12820#[cfg_attr(feature = "bindings", derive(TS))]
12821pub struct CheckXml {
12822 pub this: Box<Expression>,
12823 #[serde(default)]
12824 pub disable_auto_convert: Option<Box<Expression>>,
12825}
12826
12827#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12829#[cfg_attr(feature = "bindings", derive(TS))]
12830pub struct TranslateCharacters {
12831 pub this: Box<Expression>,
12832 pub expression: Box<Expression>,
12833 #[serde(default)]
12834 pub with_error: Option<Box<Expression>>,
12835}
12836
12837#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12839#[cfg_attr(feature = "bindings", derive(TS))]
12840pub struct CurrentSchemas {
12841 #[serde(default)]
12842 pub this: Option<Box<Expression>>,
12843}
12844
12845#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12847#[cfg_attr(feature = "bindings", derive(TS))]
12848pub struct CurrentDatetime {
12849 #[serde(default)]
12850 pub this: Option<Box<Expression>>,
12851}
12852
12853#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12855#[cfg_attr(feature = "bindings", derive(TS))]
12856pub struct Localtime {
12857 #[serde(default)]
12858 pub this: Option<Box<Expression>>,
12859}
12860
12861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12863#[cfg_attr(feature = "bindings", derive(TS))]
12864pub struct Localtimestamp {
12865 #[serde(default)]
12866 pub this: Option<Box<Expression>>,
12867}
12868
12869#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12871#[cfg_attr(feature = "bindings", derive(TS))]
12872pub struct Systimestamp {
12873 #[serde(default)]
12874 pub this: Option<Box<Expression>>,
12875}
12876
12877#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12879#[cfg_attr(feature = "bindings", derive(TS))]
12880pub struct CurrentSchema {
12881 #[serde(default)]
12882 pub this: Option<Box<Expression>>,
12883}
12884
12885#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12887#[cfg_attr(feature = "bindings", derive(TS))]
12888pub struct CurrentUser {
12889 #[serde(default)]
12890 pub this: Option<Box<Expression>>,
12891}
12892
12893#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12895#[cfg_attr(feature = "bindings", derive(TS))]
12896pub struct SessionUser;
12897
12898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12900#[cfg_attr(feature = "bindings", derive(TS))]
12901pub struct JSONPathRoot;
12902
12903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12905#[cfg_attr(feature = "bindings", derive(TS))]
12906pub struct UtcTime {
12907 #[serde(default)]
12908 pub this: Option<Box<Expression>>,
12909}
12910
12911#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12913#[cfg_attr(feature = "bindings", derive(TS))]
12914pub struct UtcTimestamp {
12915 #[serde(default)]
12916 pub this: Option<Box<Expression>>,
12917}
12918
12919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12921#[cfg_attr(feature = "bindings", derive(TS))]
12922pub struct TimestampFunc {
12923 #[serde(default)]
12924 pub this: Option<Box<Expression>>,
12925 #[serde(default)]
12926 pub zone: Option<Box<Expression>>,
12927 #[serde(default)]
12928 pub with_tz: Option<bool>,
12929 #[serde(default)]
12930 pub safe: Option<bool>,
12931}
12932
12933#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12935#[cfg_attr(feature = "bindings", derive(TS))]
12936pub struct DateBin {
12937 pub this: Box<Expression>,
12938 pub expression: Box<Expression>,
12939 #[serde(default)]
12940 pub unit: Option<String>,
12941 #[serde(default)]
12942 pub zone: Option<Box<Expression>>,
12943 #[serde(default)]
12944 pub origin: Option<Box<Expression>>,
12945}
12946
12947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12949#[cfg_attr(feature = "bindings", derive(TS))]
12950pub struct Datetime {
12951 pub this: Box<Expression>,
12952 #[serde(default)]
12953 pub expression: Option<Box<Expression>>,
12954}
12955
12956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12958#[cfg_attr(feature = "bindings", derive(TS))]
12959pub struct DatetimeAdd {
12960 pub this: Box<Expression>,
12961 pub expression: Box<Expression>,
12962 #[serde(default)]
12963 pub unit: Option<String>,
12964}
12965
12966#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12968#[cfg_attr(feature = "bindings", derive(TS))]
12969pub struct DatetimeSub {
12970 pub this: Box<Expression>,
12971 pub expression: Box<Expression>,
12972 #[serde(default)]
12973 pub unit: Option<String>,
12974}
12975
12976#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12978#[cfg_attr(feature = "bindings", derive(TS))]
12979pub struct DatetimeDiff {
12980 pub this: Box<Expression>,
12981 pub expression: Box<Expression>,
12982 #[serde(default)]
12983 pub unit: Option<String>,
12984}
12985
12986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12988#[cfg_attr(feature = "bindings", derive(TS))]
12989pub struct DatetimeTrunc {
12990 pub this: Box<Expression>,
12991 pub unit: String,
12992 #[serde(default)]
12993 pub zone: Option<Box<Expression>>,
12994}
12995
12996#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12998#[cfg_attr(feature = "bindings", derive(TS))]
12999pub struct Dayname {
13000 pub this: Box<Expression>,
13001 #[serde(default)]
13002 pub abbreviated: Option<Box<Expression>>,
13003}
13004
13005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13007#[cfg_attr(feature = "bindings", derive(TS))]
13008pub struct MakeInterval {
13009 #[serde(default)]
13010 pub year: Option<Box<Expression>>,
13011 #[serde(default)]
13012 pub month: Option<Box<Expression>>,
13013 #[serde(default)]
13014 pub week: Option<Box<Expression>>,
13015 #[serde(default)]
13016 pub day: Option<Box<Expression>>,
13017 #[serde(default)]
13018 pub hour: Option<Box<Expression>>,
13019 #[serde(default)]
13020 pub minute: Option<Box<Expression>>,
13021 #[serde(default)]
13022 pub second: Option<Box<Expression>>,
13023}
13024
13025#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13027#[cfg_attr(feature = "bindings", derive(TS))]
13028pub struct PreviousDay {
13029 pub this: Box<Expression>,
13030 pub expression: Box<Expression>,
13031}
13032
13033#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13035#[cfg_attr(feature = "bindings", derive(TS))]
13036pub struct Elt {
13037 pub this: Box<Expression>,
13038 #[serde(default)]
13039 pub expressions: Vec<Expression>,
13040}
13041
13042#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13044#[cfg_attr(feature = "bindings", derive(TS))]
13045pub struct TimestampAdd {
13046 pub this: Box<Expression>,
13047 pub expression: Box<Expression>,
13048 #[serde(default)]
13049 pub unit: Option<String>,
13050}
13051
13052#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13054#[cfg_attr(feature = "bindings", derive(TS))]
13055pub struct TimestampSub {
13056 pub this: Box<Expression>,
13057 pub expression: Box<Expression>,
13058 #[serde(default)]
13059 pub unit: Option<String>,
13060}
13061
13062#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13064#[cfg_attr(feature = "bindings", derive(TS))]
13065pub struct TimestampDiff {
13066 pub this: Box<Expression>,
13067 pub expression: Box<Expression>,
13068 #[serde(default)]
13069 pub unit: Option<String>,
13070}
13071
13072#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13074#[cfg_attr(feature = "bindings", derive(TS))]
13075pub struct TimeSlice {
13076 pub this: Box<Expression>,
13077 pub expression: Box<Expression>,
13078 pub unit: String,
13079 #[serde(default)]
13080 pub kind: Option<String>,
13081}
13082
13083#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13085#[cfg_attr(feature = "bindings", derive(TS))]
13086pub struct TimeAdd {
13087 pub this: Box<Expression>,
13088 pub expression: Box<Expression>,
13089 #[serde(default)]
13090 pub unit: Option<String>,
13091}
13092
13093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13095#[cfg_attr(feature = "bindings", derive(TS))]
13096pub struct TimeSub {
13097 pub this: Box<Expression>,
13098 pub expression: Box<Expression>,
13099 #[serde(default)]
13100 pub unit: Option<String>,
13101}
13102
13103#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13105#[cfg_attr(feature = "bindings", derive(TS))]
13106pub struct TimeDiff {
13107 pub this: Box<Expression>,
13108 pub expression: Box<Expression>,
13109 #[serde(default)]
13110 pub unit: Option<String>,
13111}
13112
13113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13115#[cfg_attr(feature = "bindings", derive(TS))]
13116pub struct TimeTrunc {
13117 pub this: Box<Expression>,
13118 pub unit: String,
13119 #[serde(default)]
13120 pub zone: Option<Box<Expression>>,
13121}
13122
13123#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13125#[cfg_attr(feature = "bindings", derive(TS))]
13126pub struct DateFromParts {
13127 #[serde(default)]
13128 pub year: Option<Box<Expression>>,
13129 #[serde(default)]
13130 pub month: Option<Box<Expression>>,
13131 #[serde(default)]
13132 pub day: Option<Box<Expression>>,
13133 #[serde(default)]
13134 pub allow_overflow: Option<Box<Expression>>,
13135}
13136
13137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13139#[cfg_attr(feature = "bindings", derive(TS))]
13140pub struct TimeFromParts {
13141 #[serde(default)]
13142 pub hour: Option<Box<Expression>>,
13143 #[serde(default)]
13144 pub min: Option<Box<Expression>>,
13145 #[serde(default)]
13146 pub sec: Option<Box<Expression>>,
13147 #[serde(default)]
13148 pub nano: Option<Box<Expression>>,
13149 #[serde(default)]
13150 pub fractions: Option<Box<Expression>>,
13151 #[serde(default)]
13152 pub precision: Option<i64>,
13153}
13154
13155#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13157#[cfg_attr(feature = "bindings", derive(TS))]
13158pub struct DecodeCase {
13159 #[serde(default)]
13160 pub expressions: Vec<Expression>,
13161}
13162
13163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13165#[cfg_attr(feature = "bindings", derive(TS))]
13166pub struct Decrypt {
13167 pub this: Box<Expression>,
13168 #[serde(default)]
13169 pub passphrase: Option<Box<Expression>>,
13170 #[serde(default)]
13171 pub aad: Option<Box<Expression>>,
13172 #[serde(default)]
13173 pub encryption_method: Option<Box<Expression>>,
13174 #[serde(default)]
13175 pub safe: Option<Box<Expression>>,
13176}
13177
13178#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13180#[cfg_attr(feature = "bindings", derive(TS))]
13181pub struct DecryptRaw {
13182 pub this: Box<Expression>,
13183 #[serde(default)]
13184 pub key: Option<Box<Expression>>,
13185 #[serde(default)]
13186 pub iv: 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 aead: Option<Box<Expression>>,
13193 #[serde(default)]
13194 pub safe: Option<Box<Expression>>,
13195}
13196
13197#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13199#[cfg_attr(feature = "bindings", derive(TS))]
13200pub struct Encode {
13201 pub this: Box<Expression>,
13202 #[serde(default)]
13203 pub charset: Option<Box<Expression>>,
13204}
13205
13206#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13208#[cfg_attr(feature = "bindings", derive(TS))]
13209pub struct Encrypt {
13210 pub this: Box<Expression>,
13211 #[serde(default)]
13212 pub passphrase: Option<Box<Expression>>,
13213 #[serde(default)]
13214 pub aad: Option<Box<Expression>>,
13215 #[serde(default)]
13216 pub encryption_method: Option<Box<Expression>>,
13217}
13218
13219#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13221#[cfg_attr(feature = "bindings", derive(TS))]
13222pub struct EncryptRaw {
13223 pub this: Box<Expression>,
13224 #[serde(default)]
13225 pub key: Option<Box<Expression>>,
13226 #[serde(default)]
13227 pub iv: Option<Box<Expression>>,
13228 #[serde(default)]
13229 pub aad: Option<Box<Expression>>,
13230 #[serde(default)]
13231 pub encryption_method: Option<Box<Expression>>,
13232}
13233
13234#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13236#[cfg_attr(feature = "bindings", derive(TS))]
13237pub struct EqualNull {
13238 pub this: Box<Expression>,
13239 pub expression: Box<Expression>,
13240}
13241
13242#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13244#[cfg_attr(feature = "bindings", derive(TS))]
13245pub struct ToBinary {
13246 pub this: Box<Expression>,
13247 #[serde(default)]
13248 pub format: Option<String>,
13249 #[serde(default)]
13250 pub safe: Option<Box<Expression>>,
13251}
13252
13253#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13255#[cfg_attr(feature = "bindings", derive(TS))]
13256pub struct Base64DecodeBinary {
13257 pub this: Box<Expression>,
13258 #[serde(default)]
13259 pub alphabet: Option<Box<Expression>>,
13260}
13261
13262#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13264#[cfg_attr(feature = "bindings", derive(TS))]
13265pub struct Base64DecodeString {
13266 pub this: Box<Expression>,
13267 #[serde(default)]
13268 pub alphabet: Option<Box<Expression>>,
13269}
13270
13271#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13273#[cfg_attr(feature = "bindings", derive(TS))]
13274pub struct Base64Encode {
13275 pub this: Box<Expression>,
13276 #[serde(default)]
13277 pub max_line_length: Option<Box<Expression>>,
13278 #[serde(default)]
13279 pub alphabet: Option<Box<Expression>>,
13280}
13281
13282#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13284#[cfg_attr(feature = "bindings", derive(TS))]
13285pub struct TryBase64DecodeBinary {
13286 pub this: Box<Expression>,
13287 #[serde(default)]
13288 pub alphabet: Option<Box<Expression>>,
13289}
13290
13291#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13293#[cfg_attr(feature = "bindings", derive(TS))]
13294pub struct TryBase64DecodeString {
13295 pub this: Box<Expression>,
13296 #[serde(default)]
13297 pub alphabet: Option<Box<Expression>>,
13298}
13299
13300#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13302#[cfg_attr(feature = "bindings", derive(TS))]
13303pub struct GapFill {
13304 pub this: Box<Expression>,
13305 #[serde(default)]
13306 pub ts_column: Option<Box<Expression>>,
13307 #[serde(default)]
13308 pub bucket_width: Option<Box<Expression>>,
13309 #[serde(default)]
13310 pub partitioning_columns: Option<Box<Expression>>,
13311 #[serde(default)]
13312 pub value_columns: Option<Box<Expression>>,
13313 #[serde(default)]
13314 pub origin: Option<Box<Expression>>,
13315 #[serde(default)]
13316 pub ignore_nulls: Option<Box<Expression>>,
13317}
13318
13319#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13321#[cfg_attr(feature = "bindings", derive(TS))]
13322pub struct GenerateDateArray {
13323 #[serde(default)]
13324 pub start: Option<Box<Expression>>,
13325 #[serde(default)]
13326 pub end: Option<Box<Expression>>,
13327 #[serde(default)]
13328 pub step: Option<Box<Expression>>,
13329}
13330
13331#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13333#[cfg_attr(feature = "bindings", derive(TS))]
13334pub struct GenerateTimestampArray {
13335 #[serde(default)]
13336 pub start: Option<Box<Expression>>,
13337 #[serde(default)]
13338 pub end: Option<Box<Expression>>,
13339 #[serde(default)]
13340 pub step: Option<Box<Expression>>,
13341}
13342
13343#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13345#[cfg_attr(feature = "bindings", derive(TS))]
13346pub struct GetExtract {
13347 pub this: Box<Expression>,
13348 pub expression: Box<Expression>,
13349}
13350
13351#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13353#[cfg_attr(feature = "bindings", derive(TS))]
13354pub struct Getbit {
13355 pub this: Box<Expression>,
13356 pub expression: Box<Expression>,
13357 #[serde(default)]
13358 pub zero_is_msb: Option<Box<Expression>>,
13359}
13360
13361#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13363#[cfg_attr(feature = "bindings", derive(TS))]
13364pub struct OverflowTruncateBehavior {
13365 #[serde(default)]
13366 pub this: Option<Box<Expression>>,
13367 #[serde(default)]
13368 pub with_count: Option<Box<Expression>>,
13369}
13370
13371#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13373#[cfg_attr(feature = "bindings", derive(TS))]
13374pub struct HexEncode {
13375 pub this: Box<Expression>,
13376 #[serde(default)]
13377 pub case: Option<Box<Expression>>,
13378}
13379
13380#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13382#[cfg_attr(feature = "bindings", derive(TS))]
13383pub struct Compress {
13384 pub this: Box<Expression>,
13385 #[serde(default)]
13386 pub method: Option<String>,
13387}
13388
13389#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13391#[cfg_attr(feature = "bindings", derive(TS))]
13392pub struct DecompressBinary {
13393 pub this: Box<Expression>,
13394 pub method: String,
13395}
13396
13397#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13399#[cfg_attr(feature = "bindings", derive(TS))]
13400pub struct DecompressString {
13401 pub this: Box<Expression>,
13402 pub method: String,
13403}
13404
13405#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13407#[cfg_attr(feature = "bindings", derive(TS))]
13408pub struct Xor {
13409 #[serde(default)]
13410 pub this: Option<Box<Expression>>,
13411 #[serde(default)]
13412 pub expression: Option<Box<Expression>>,
13413 #[serde(default)]
13414 pub expressions: Vec<Expression>,
13415}
13416
13417#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13419#[cfg_attr(feature = "bindings", derive(TS))]
13420pub struct Nullif {
13421 pub this: Box<Expression>,
13422 pub expression: Box<Expression>,
13423}
13424
13425#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13427#[cfg_attr(feature = "bindings", derive(TS))]
13428pub struct JSON {
13429 #[serde(default)]
13430 pub this: Option<Box<Expression>>,
13431 #[serde(default)]
13432 pub with_: Option<Box<Expression>>,
13433 #[serde(default)]
13434 pub unique: bool,
13435}
13436
13437#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13439#[cfg_attr(feature = "bindings", derive(TS))]
13440pub struct JSONPath {
13441 #[serde(default)]
13442 pub expressions: Vec<Expression>,
13443 #[serde(default)]
13444 pub escape: Option<Box<Expression>>,
13445}
13446
13447#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13449#[cfg_attr(feature = "bindings", derive(TS))]
13450pub struct JSONPathFilter {
13451 pub this: Box<Expression>,
13452}
13453
13454#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13456#[cfg_attr(feature = "bindings", derive(TS))]
13457pub struct JSONPathKey {
13458 pub this: Box<Expression>,
13459}
13460
13461#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13463#[cfg_attr(feature = "bindings", derive(TS))]
13464pub struct JSONPathRecursive {
13465 #[serde(default)]
13466 pub this: Option<Box<Expression>>,
13467}
13468
13469#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13471#[cfg_attr(feature = "bindings", derive(TS))]
13472pub struct JSONPathScript {
13473 pub this: Box<Expression>,
13474}
13475
13476#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13478#[cfg_attr(feature = "bindings", derive(TS))]
13479pub struct JSONPathSlice {
13480 #[serde(default)]
13481 pub start: Option<Box<Expression>>,
13482 #[serde(default)]
13483 pub end: Option<Box<Expression>>,
13484 #[serde(default)]
13485 pub step: Option<Box<Expression>>,
13486}
13487
13488#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13490#[cfg_attr(feature = "bindings", derive(TS))]
13491pub struct JSONPathSelector {
13492 pub this: Box<Expression>,
13493}
13494
13495#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13497#[cfg_attr(feature = "bindings", derive(TS))]
13498pub struct JSONPathSubscript {
13499 pub this: Box<Expression>,
13500}
13501
13502#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13504#[cfg_attr(feature = "bindings", derive(TS))]
13505pub struct JSONPathUnion {
13506 #[serde(default)]
13507 pub expressions: Vec<Expression>,
13508}
13509
13510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13512#[cfg_attr(feature = "bindings", derive(TS))]
13513pub struct Format {
13514 pub this: Box<Expression>,
13515 #[serde(default)]
13516 pub expressions: Vec<Expression>,
13517}
13518
13519#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13521#[cfg_attr(feature = "bindings", derive(TS))]
13522pub struct JSONKeys {
13523 pub this: Box<Expression>,
13524 #[serde(default)]
13525 pub expression: Option<Box<Expression>>,
13526 #[serde(default)]
13527 pub expressions: Vec<Expression>,
13528}
13529
13530#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13532#[cfg_attr(feature = "bindings", derive(TS))]
13533pub struct JSONKeyValue {
13534 pub this: Box<Expression>,
13535 pub expression: Box<Expression>,
13536}
13537
13538#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13540#[cfg_attr(feature = "bindings", derive(TS))]
13541pub struct JSONKeysAtDepth {
13542 pub this: Box<Expression>,
13543 #[serde(default)]
13544 pub expression: Option<Box<Expression>>,
13545 #[serde(default)]
13546 pub mode: Option<Box<Expression>>,
13547}
13548
13549#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13551#[cfg_attr(feature = "bindings", derive(TS))]
13552pub struct JSONObject {
13553 #[serde(default)]
13554 pub expressions: Vec<Expression>,
13555 #[serde(default)]
13556 pub null_handling: Option<Box<Expression>>,
13557 #[serde(default)]
13558 pub unique_keys: Option<Box<Expression>>,
13559 #[serde(default)]
13560 pub return_type: Option<Box<Expression>>,
13561 #[serde(default)]
13562 pub encoding: Option<Box<Expression>>,
13563}
13564
13565#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13567#[cfg_attr(feature = "bindings", derive(TS))]
13568pub struct JSONObjectAgg {
13569 #[serde(default)]
13570 pub expressions: Vec<Expression>,
13571 #[serde(default)]
13572 pub null_handling: Option<Box<Expression>>,
13573 #[serde(default)]
13574 pub unique_keys: Option<Box<Expression>>,
13575 #[serde(default)]
13576 pub return_type: Option<Box<Expression>>,
13577 #[serde(default)]
13578 pub encoding: Option<Box<Expression>>,
13579}
13580
13581#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13583#[cfg_attr(feature = "bindings", derive(TS))]
13584pub struct JSONBObjectAgg {
13585 pub this: Box<Expression>,
13586 pub expression: Box<Expression>,
13587}
13588
13589#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13591#[cfg_attr(feature = "bindings", derive(TS))]
13592pub struct JSONArray {
13593 #[serde(default)]
13594 pub expressions: Vec<Expression>,
13595 #[serde(default)]
13596 pub null_handling: Option<Box<Expression>>,
13597 #[serde(default)]
13598 pub return_type: Option<Box<Expression>>,
13599 #[serde(default)]
13600 pub strict: Option<Box<Expression>>,
13601}
13602
13603#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13605#[cfg_attr(feature = "bindings", derive(TS))]
13606pub struct JSONArrayAgg {
13607 pub this: Box<Expression>,
13608 #[serde(default)]
13609 pub order: Option<Box<Expression>>,
13610 #[serde(default)]
13611 pub null_handling: Option<Box<Expression>>,
13612 #[serde(default)]
13613 pub return_type: Option<Box<Expression>>,
13614 #[serde(default)]
13615 pub strict: Option<Box<Expression>>,
13616}
13617
13618#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13620#[cfg_attr(feature = "bindings", derive(TS))]
13621pub struct JSONExists {
13622 pub this: Box<Expression>,
13623 #[serde(default)]
13624 pub path: Option<Box<Expression>>,
13625 #[serde(default)]
13626 pub passing: Option<Box<Expression>>,
13627 #[serde(default)]
13628 pub on_condition: Option<Box<Expression>>,
13629 #[serde(default)]
13630 pub from_dcolonqmark: Option<Box<Expression>>,
13631}
13632
13633#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13635#[cfg_attr(feature = "bindings", derive(TS))]
13636pub struct JSONColumnDef {
13637 #[serde(default)]
13638 pub this: Option<Box<Expression>>,
13639 #[serde(default)]
13640 pub kind: Option<String>,
13641 #[serde(default)]
13642 pub format_json: bool,
13643 #[serde(default)]
13644 pub path: Option<Box<Expression>>,
13645 #[serde(default)]
13646 pub nested_schema: Option<Box<Expression>>,
13647 #[serde(default)]
13648 pub ordinality: Option<Box<Expression>>,
13649}
13650
13651#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13653#[cfg_attr(feature = "bindings", derive(TS))]
13654pub struct JSONSchema {
13655 #[serde(default)]
13656 pub expressions: Vec<Expression>,
13657}
13658
13659#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13661#[cfg_attr(feature = "bindings", derive(TS))]
13662pub struct JSONSet {
13663 pub this: Box<Expression>,
13664 #[serde(default)]
13665 pub expressions: Vec<Expression>,
13666}
13667
13668#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13670#[cfg_attr(feature = "bindings", derive(TS))]
13671pub struct JSONStripNulls {
13672 pub this: Box<Expression>,
13673 #[serde(default)]
13674 pub expression: Option<Box<Expression>>,
13675 #[serde(default)]
13676 pub include_arrays: Option<Box<Expression>>,
13677 #[serde(default)]
13678 pub remove_empty: Option<Box<Expression>>,
13679}
13680
13681#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13683#[cfg_attr(feature = "bindings", derive(TS))]
13684pub struct JSONValue {
13685 pub this: Box<Expression>,
13686 #[serde(default)]
13687 pub path: Option<Box<Expression>>,
13688 #[serde(default)]
13689 pub returning: Option<Box<Expression>>,
13690 #[serde(default)]
13691 pub on_condition: Option<Box<Expression>>,
13692}
13693
13694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13696#[cfg_attr(feature = "bindings", derive(TS))]
13697pub struct JSONValueArray {
13698 pub this: Box<Expression>,
13699 #[serde(default)]
13700 pub expression: Option<Box<Expression>>,
13701}
13702
13703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13705#[cfg_attr(feature = "bindings", derive(TS))]
13706pub struct JSONRemove {
13707 pub this: Box<Expression>,
13708 #[serde(default)]
13709 pub expressions: Vec<Expression>,
13710}
13711
13712#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13714#[cfg_attr(feature = "bindings", derive(TS))]
13715pub struct JSONTable {
13716 pub this: Box<Expression>,
13717 #[serde(default)]
13718 pub schema: Option<Box<Expression>>,
13719 #[serde(default)]
13720 pub path: Option<Box<Expression>>,
13721 #[serde(default)]
13722 pub error_handling: Option<Box<Expression>>,
13723 #[serde(default)]
13724 pub empty_handling: Option<Box<Expression>>,
13725}
13726
13727#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13729#[cfg_attr(feature = "bindings", derive(TS))]
13730pub struct JSONType {
13731 pub this: Box<Expression>,
13732 #[serde(default)]
13733 pub expression: Option<Box<Expression>>,
13734}
13735
13736#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13738#[cfg_attr(feature = "bindings", derive(TS))]
13739pub struct ObjectInsert {
13740 pub this: Box<Expression>,
13741 #[serde(default)]
13742 pub key: Option<Box<Expression>>,
13743 #[serde(default)]
13744 pub value: Option<Box<Expression>>,
13745 #[serde(default)]
13746 pub update_flag: Option<Box<Expression>>,
13747}
13748
13749#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13751#[cfg_attr(feature = "bindings", derive(TS))]
13752pub struct OpenJSONColumnDef {
13753 pub this: Box<Expression>,
13754 pub kind: String,
13755 #[serde(default)]
13756 pub path: Option<Box<Expression>>,
13757 #[serde(default)]
13758 pub as_json: Option<Box<Expression>>,
13759 #[serde(default, skip_serializing_if = "Option::is_none")]
13761 pub data_type: Option<DataType>,
13762}
13763
13764#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13766#[cfg_attr(feature = "bindings", derive(TS))]
13767pub struct OpenJSON {
13768 pub this: Box<Expression>,
13769 #[serde(default)]
13770 pub path: Option<Box<Expression>>,
13771 #[serde(default)]
13772 pub expressions: Vec<Expression>,
13773}
13774
13775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13777#[cfg_attr(feature = "bindings", derive(TS))]
13778pub struct JSONBExists {
13779 pub this: Box<Expression>,
13780 #[serde(default)]
13781 pub path: Option<Box<Expression>>,
13782}
13783
13784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13786#[cfg_attr(feature = "bindings", derive(TS))]
13787pub struct JSONCast {
13788 pub this: Box<Expression>,
13789 pub to: DataType,
13790}
13791
13792#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13794#[cfg_attr(feature = "bindings", derive(TS))]
13795pub struct JSONExtract {
13796 pub this: Box<Expression>,
13797 pub expression: Box<Expression>,
13798 #[serde(default)]
13799 pub only_json_types: Option<Box<Expression>>,
13800 #[serde(default)]
13801 pub expressions: Vec<Expression>,
13802 #[serde(default)]
13803 pub variant_extract: Option<Box<Expression>>,
13804 #[serde(default)]
13805 pub json_query: Option<Box<Expression>>,
13806 #[serde(default)]
13807 pub option: Option<Box<Expression>>,
13808 #[serde(default)]
13809 pub quote: Option<Box<Expression>>,
13810 #[serde(default)]
13811 pub on_condition: Option<Box<Expression>>,
13812 #[serde(default)]
13813 pub requires_json: Option<Box<Expression>>,
13814}
13815
13816#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13818#[cfg_attr(feature = "bindings", derive(TS))]
13819pub struct JSONExtractQuote {
13820 #[serde(default)]
13821 pub option: Option<Box<Expression>>,
13822 #[serde(default)]
13823 pub scalar: Option<Box<Expression>>,
13824}
13825
13826#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13828#[cfg_attr(feature = "bindings", derive(TS))]
13829pub struct JSONExtractArray {
13830 pub this: Box<Expression>,
13831 #[serde(default)]
13832 pub expression: Option<Box<Expression>>,
13833}
13834
13835#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13837#[cfg_attr(feature = "bindings", derive(TS))]
13838pub struct JSONExtractScalar {
13839 pub this: Box<Expression>,
13840 pub expression: Box<Expression>,
13841 #[serde(default)]
13842 pub only_json_types: Option<Box<Expression>>,
13843 #[serde(default)]
13844 pub expressions: Vec<Expression>,
13845 #[serde(default)]
13846 pub json_type: Option<Box<Expression>>,
13847 #[serde(default)]
13848 pub scalar_only: Option<Box<Expression>>,
13849}
13850
13851#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13853#[cfg_attr(feature = "bindings", derive(TS))]
13854pub struct JSONBExtractScalar {
13855 pub this: Box<Expression>,
13856 pub expression: Box<Expression>,
13857 #[serde(default)]
13858 pub json_type: Option<Box<Expression>>,
13859}
13860
13861#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13863#[cfg_attr(feature = "bindings", derive(TS))]
13864pub struct JSONFormat {
13865 #[serde(default)]
13866 pub this: Option<Box<Expression>>,
13867 #[serde(default)]
13868 pub options: Vec<Expression>,
13869 #[serde(default)]
13870 pub is_json: Option<Box<Expression>>,
13871 #[serde(default)]
13872 pub to_json: Option<Box<Expression>>,
13873}
13874
13875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13877#[cfg_attr(feature = "bindings", derive(TS))]
13878pub struct JSONArrayAppend {
13879 pub this: Box<Expression>,
13880 #[serde(default)]
13881 pub expressions: Vec<Expression>,
13882}
13883
13884#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13886#[cfg_attr(feature = "bindings", derive(TS))]
13887pub struct JSONArrayContains {
13888 pub this: Box<Expression>,
13889 pub expression: Box<Expression>,
13890 #[serde(default)]
13891 pub json_type: Option<Box<Expression>>,
13892}
13893
13894#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13896#[cfg_attr(feature = "bindings", derive(TS))]
13897pub struct JSONArrayInsert {
13898 pub this: Box<Expression>,
13899 #[serde(default)]
13900 pub expressions: Vec<Expression>,
13901}
13902
13903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13905#[cfg_attr(feature = "bindings", derive(TS))]
13906pub struct ParseJSON {
13907 pub this: Box<Expression>,
13908 #[serde(default)]
13909 pub expression: Option<Box<Expression>>,
13910 #[serde(default)]
13911 pub safe: Option<Box<Expression>>,
13912}
13913
13914#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13916#[cfg_attr(feature = "bindings", derive(TS))]
13917pub struct ParseUrl {
13918 pub this: Box<Expression>,
13919 #[serde(default)]
13920 pub part_to_extract: Option<Box<Expression>>,
13921 #[serde(default)]
13922 pub key: Option<Box<Expression>>,
13923 #[serde(default)]
13924 pub permissive: Option<Box<Expression>>,
13925}
13926
13927#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13929#[cfg_attr(feature = "bindings", derive(TS))]
13930pub struct ParseIp {
13931 pub this: Box<Expression>,
13932 #[serde(default)]
13933 pub type_: Option<Box<Expression>>,
13934 #[serde(default)]
13935 pub permissive: Option<Box<Expression>>,
13936}
13937
13938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13940#[cfg_attr(feature = "bindings", derive(TS))]
13941pub struct ParseTime {
13942 pub this: Box<Expression>,
13943 pub format: String,
13944}
13945
13946#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13948#[cfg_attr(feature = "bindings", derive(TS))]
13949pub struct ParseDatetime {
13950 pub this: Box<Expression>,
13951 #[serde(default)]
13952 pub format: Option<String>,
13953 #[serde(default)]
13954 pub zone: Option<Box<Expression>>,
13955}
13956
13957#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13959#[cfg_attr(feature = "bindings", derive(TS))]
13960pub struct Map {
13961 #[serde(default)]
13962 pub keys: Vec<Expression>,
13963 #[serde(default)]
13964 pub values: Vec<Expression>,
13965}
13966
13967#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13969#[cfg_attr(feature = "bindings", derive(TS))]
13970pub struct MapCat {
13971 pub this: Box<Expression>,
13972 pub expression: Box<Expression>,
13973}
13974
13975#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13977#[cfg_attr(feature = "bindings", derive(TS))]
13978pub struct MapDelete {
13979 pub this: Box<Expression>,
13980 #[serde(default)]
13981 pub expressions: Vec<Expression>,
13982}
13983
13984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13986#[cfg_attr(feature = "bindings", derive(TS))]
13987pub struct MapInsert {
13988 pub this: Box<Expression>,
13989 #[serde(default)]
13990 pub key: Option<Box<Expression>>,
13991 #[serde(default)]
13992 pub value: Option<Box<Expression>>,
13993 #[serde(default)]
13994 pub update_flag: Option<Box<Expression>>,
13995}
13996
13997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
13999#[cfg_attr(feature = "bindings", derive(TS))]
14000pub struct MapPick {
14001 pub this: Box<Expression>,
14002 #[serde(default)]
14003 pub expressions: Vec<Expression>,
14004}
14005
14006#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14008#[cfg_attr(feature = "bindings", derive(TS))]
14009pub struct ScopeResolution {
14010 #[serde(default)]
14011 pub this: Option<Box<Expression>>,
14012 pub expression: Box<Expression>,
14013}
14014
14015#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14017#[cfg_attr(feature = "bindings", derive(TS))]
14018pub struct Slice {
14019 #[serde(default)]
14020 pub this: Option<Box<Expression>>,
14021 #[serde(default)]
14022 pub expression: Option<Box<Expression>>,
14023 #[serde(default)]
14024 pub step: Option<Box<Expression>>,
14025}
14026
14027#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14029#[cfg_attr(feature = "bindings", derive(TS))]
14030pub struct VarMap {
14031 #[serde(default)]
14032 pub keys: Vec<Expression>,
14033 #[serde(default)]
14034 pub values: Vec<Expression>,
14035}
14036
14037#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14039#[cfg_attr(feature = "bindings", derive(TS))]
14040pub struct MatchAgainst {
14041 pub this: Box<Expression>,
14042 #[serde(default)]
14043 pub expressions: Vec<Expression>,
14044 #[serde(default)]
14045 pub modifier: Option<Box<Expression>>,
14046}
14047
14048#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14050#[cfg_attr(feature = "bindings", derive(TS))]
14051pub struct MD5Digest {
14052 pub this: Box<Expression>,
14053 #[serde(default)]
14054 pub expressions: Vec<Expression>,
14055}
14056
14057#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14059#[cfg_attr(feature = "bindings", derive(TS))]
14060pub struct Monthname {
14061 pub this: Box<Expression>,
14062 #[serde(default)]
14063 pub abbreviated: Option<Box<Expression>>,
14064}
14065
14066#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14068#[cfg_attr(feature = "bindings", derive(TS))]
14069pub struct Ntile {
14070 #[serde(default)]
14071 pub this: Option<Box<Expression>>,
14072}
14073
14074#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14076#[cfg_attr(feature = "bindings", derive(TS))]
14077pub struct Normalize {
14078 pub this: Box<Expression>,
14079 #[serde(default)]
14080 pub form: Option<Box<Expression>>,
14081 #[serde(default)]
14082 pub is_casefold: Option<Box<Expression>>,
14083}
14084
14085#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14087#[cfg_attr(feature = "bindings", derive(TS))]
14088pub struct Normal {
14089 pub this: Box<Expression>,
14090 #[serde(default)]
14091 pub stddev: Option<Box<Expression>>,
14092 #[serde(default)]
14093 pub gen: Option<Box<Expression>>,
14094}
14095
14096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14098#[cfg_attr(feature = "bindings", derive(TS))]
14099pub struct Predict {
14100 pub this: Box<Expression>,
14101 pub expression: Box<Expression>,
14102 #[serde(default)]
14103 pub params_struct: Option<Box<Expression>>,
14104}
14105
14106#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14108#[cfg_attr(feature = "bindings", derive(TS))]
14109pub struct MLTranslate {
14110 pub this: Box<Expression>,
14111 pub expression: Box<Expression>,
14112 #[serde(default)]
14113 pub params_struct: Option<Box<Expression>>,
14114}
14115
14116#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14118#[cfg_attr(feature = "bindings", derive(TS))]
14119pub struct FeaturesAtTime {
14120 pub this: Box<Expression>,
14121 #[serde(default)]
14122 pub time: Option<Box<Expression>>,
14123 #[serde(default)]
14124 pub num_rows: Option<Box<Expression>>,
14125 #[serde(default)]
14126 pub ignore_feature_nulls: Option<Box<Expression>>,
14127}
14128
14129#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14131#[cfg_attr(feature = "bindings", derive(TS))]
14132pub struct GenerateEmbedding {
14133 pub this: Box<Expression>,
14134 pub expression: Box<Expression>,
14135 #[serde(default)]
14136 pub params_struct: Option<Box<Expression>>,
14137 #[serde(default)]
14138 pub is_text: Option<Box<Expression>>,
14139}
14140
14141#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14143#[cfg_attr(feature = "bindings", derive(TS))]
14144pub struct MLForecast {
14145 pub this: Box<Expression>,
14146 #[serde(default)]
14147 pub expression: Option<Box<Expression>>,
14148 #[serde(default)]
14149 pub params_struct: Option<Box<Expression>>,
14150}
14151
14152#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14154#[cfg_attr(feature = "bindings", derive(TS))]
14155pub struct ModelAttribute {
14156 pub this: Box<Expression>,
14157 pub expression: Box<Expression>,
14158}
14159
14160#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14162#[cfg_attr(feature = "bindings", derive(TS))]
14163pub struct VectorSearch {
14164 pub this: Box<Expression>,
14165 #[serde(default)]
14166 pub column_to_search: Option<Box<Expression>>,
14167 #[serde(default)]
14168 pub query_table: Option<Box<Expression>>,
14169 #[serde(default)]
14170 pub query_column_to_search: Option<Box<Expression>>,
14171 #[serde(default)]
14172 pub top_k: Option<Box<Expression>>,
14173 #[serde(default)]
14174 pub distance_type: Option<Box<Expression>>,
14175 #[serde(default)]
14176 pub options: Vec<Expression>,
14177}
14178
14179#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14181#[cfg_attr(feature = "bindings", derive(TS))]
14182pub struct Quantile {
14183 pub this: Box<Expression>,
14184 #[serde(default)]
14185 pub quantile: Option<Box<Expression>>,
14186}
14187
14188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14190#[cfg_attr(feature = "bindings", derive(TS))]
14191pub struct ApproxQuantile {
14192 pub this: Box<Expression>,
14193 #[serde(default)]
14194 pub quantile: Option<Box<Expression>>,
14195 #[serde(default)]
14196 pub accuracy: Option<Box<Expression>>,
14197 #[serde(default)]
14198 pub weight: Option<Box<Expression>>,
14199 #[serde(default)]
14200 pub error_tolerance: Option<Box<Expression>>,
14201}
14202
14203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14205#[cfg_attr(feature = "bindings", derive(TS))]
14206pub struct ApproxPercentileEstimate {
14207 pub this: Box<Expression>,
14208 #[serde(default)]
14209 pub percentile: Option<Box<Expression>>,
14210}
14211
14212#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14214#[cfg_attr(feature = "bindings", derive(TS))]
14215pub struct Randn {
14216 #[serde(default)]
14217 pub this: Option<Box<Expression>>,
14218}
14219
14220#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14222#[cfg_attr(feature = "bindings", derive(TS))]
14223pub struct Randstr {
14224 pub this: Box<Expression>,
14225 #[serde(default)]
14226 pub generator: Option<Box<Expression>>,
14227}
14228
14229#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14231#[cfg_attr(feature = "bindings", derive(TS))]
14232pub struct RangeN {
14233 pub this: Box<Expression>,
14234 #[serde(default)]
14235 pub expressions: Vec<Expression>,
14236 #[serde(default)]
14237 pub each: Option<Box<Expression>>,
14238}
14239
14240#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14242#[cfg_attr(feature = "bindings", derive(TS))]
14243pub struct RangeBucket {
14244 pub this: Box<Expression>,
14245 pub expression: Box<Expression>,
14246}
14247
14248#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14250#[cfg_attr(feature = "bindings", derive(TS))]
14251pub struct ReadCSV {
14252 pub this: Box<Expression>,
14253 #[serde(default)]
14254 pub expressions: Vec<Expression>,
14255}
14256
14257#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14259#[cfg_attr(feature = "bindings", derive(TS))]
14260pub struct ReadParquet {
14261 #[serde(default)]
14262 pub expressions: Vec<Expression>,
14263}
14264
14265#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14267#[cfg_attr(feature = "bindings", derive(TS))]
14268pub struct Reduce {
14269 pub this: Box<Expression>,
14270 #[serde(default)]
14271 pub initial: Option<Box<Expression>>,
14272 #[serde(default)]
14273 pub merge: Option<Box<Expression>>,
14274 #[serde(default)]
14275 pub finish: Option<Box<Expression>>,
14276}
14277
14278#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14280#[cfg_attr(feature = "bindings", derive(TS))]
14281pub struct RegexpExtractAll {
14282 pub this: Box<Expression>,
14283 pub expression: Box<Expression>,
14284 #[serde(default)]
14285 pub group: Option<Box<Expression>>,
14286 #[serde(default)]
14287 pub parameters: Option<Box<Expression>>,
14288 #[serde(default)]
14289 pub position: Option<Box<Expression>>,
14290 #[serde(default)]
14291 pub occurrence: Option<Box<Expression>>,
14292}
14293
14294#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14296#[cfg_attr(feature = "bindings", derive(TS))]
14297pub struct RegexpILike {
14298 pub this: Box<Expression>,
14299 pub expression: Box<Expression>,
14300 #[serde(default)]
14301 pub flag: Option<Box<Expression>>,
14302}
14303
14304#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14306#[cfg_attr(feature = "bindings", derive(TS))]
14307pub struct RegexpFullMatch {
14308 pub this: Box<Expression>,
14309 pub expression: Box<Expression>,
14310 #[serde(default)]
14311 pub options: Vec<Expression>,
14312}
14313
14314#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14316#[cfg_attr(feature = "bindings", derive(TS))]
14317pub struct RegexpInstr {
14318 pub this: Box<Expression>,
14319 pub expression: Box<Expression>,
14320 #[serde(default)]
14321 pub position: Option<Box<Expression>>,
14322 #[serde(default)]
14323 pub occurrence: Option<Box<Expression>>,
14324 #[serde(default)]
14325 pub option: Option<Box<Expression>>,
14326 #[serde(default)]
14327 pub parameters: Option<Box<Expression>>,
14328 #[serde(default)]
14329 pub group: Option<Box<Expression>>,
14330}
14331
14332#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14334#[cfg_attr(feature = "bindings", derive(TS))]
14335pub struct RegexpSplit {
14336 pub this: Box<Expression>,
14337 pub expression: Box<Expression>,
14338 #[serde(default)]
14339 pub limit: Option<Box<Expression>>,
14340}
14341
14342#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14344#[cfg_attr(feature = "bindings", derive(TS))]
14345pub struct RegexpCount {
14346 pub this: Box<Expression>,
14347 pub expression: Box<Expression>,
14348 #[serde(default)]
14349 pub position: Option<Box<Expression>>,
14350 #[serde(default)]
14351 pub parameters: Option<Box<Expression>>,
14352}
14353
14354#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14356#[cfg_attr(feature = "bindings", derive(TS))]
14357pub struct RegrValx {
14358 pub this: Box<Expression>,
14359 pub expression: Box<Expression>,
14360}
14361
14362#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14364#[cfg_attr(feature = "bindings", derive(TS))]
14365pub struct RegrValy {
14366 pub this: Box<Expression>,
14367 pub expression: Box<Expression>,
14368}
14369
14370#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14372#[cfg_attr(feature = "bindings", derive(TS))]
14373pub struct RegrAvgy {
14374 pub this: Box<Expression>,
14375 pub expression: Box<Expression>,
14376}
14377
14378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14380#[cfg_attr(feature = "bindings", derive(TS))]
14381pub struct RegrAvgx {
14382 pub this: Box<Expression>,
14383 pub expression: Box<Expression>,
14384}
14385
14386#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14388#[cfg_attr(feature = "bindings", derive(TS))]
14389pub struct RegrCount {
14390 pub this: Box<Expression>,
14391 pub expression: Box<Expression>,
14392}
14393
14394#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14396#[cfg_attr(feature = "bindings", derive(TS))]
14397pub struct RegrIntercept {
14398 pub this: Box<Expression>,
14399 pub expression: Box<Expression>,
14400}
14401
14402#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14404#[cfg_attr(feature = "bindings", derive(TS))]
14405pub struct RegrR2 {
14406 pub this: Box<Expression>,
14407 pub expression: Box<Expression>,
14408}
14409
14410#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14412#[cfg_attr(feature = "bindings", derive(TS))]
14413pub struct RegrSxx {
14414 pub this: Box<Expression>,
14415 pub expression: Box<Expression>,
14416}
14417
14418#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14420#[cfg_attr(feature = "bindings", derive(TS))]
14421pub struct RegrSxy {
14422 pub this: Box<Expression>,
14423 pub expression: Box<Expression>,
14424}
14425
14426#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14428#[cfg_attr(feature = "bindings", derive(TS))]
14429pub struct RegrSyy {
14430 pub this: Box<Expression>,
14431 pub expression: Box<Expression>,
14432}
14433
14434#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14436#[cfg_attr(feature = "bindings", derive(TS))]
14437pub struct RegrSlope {
14438 pub this: Box<Expression>,
14439 pub expression: Box<Expression>,
14440}
14441
14442#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14444#[cfg_attr(feature = "bindings", derive(TS))]
14445pub struct SafeAdd {
14446 pub this: Box<Expression>,
14447 pub expression: Box<Expression>,
14448}
14449
14450#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14452#[cfg_attr(feature = "bindings", derive(TS))]
14453pub struct SafeDivide {
14454 pub this: Box<Expression>,
14455 pub expression: Box<Expression>,
14456}
14457
14458#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14460#[cfg_attr(feature = "bindings", derive(TS))]
14461pub struct SafeMultiply {
14462 pub this: Box<Expression>,
14463 pub expression: Box<Expression>,
14464}
14465
14466#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14468#[cfg_attr(feature = "bindings", derive(TS))]
14469pub struct SafeSubtract {
14470 pub this: Box<Expression>,
14471 pub expression: Box<Expression>,
14472}
14473
14474#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14476#[cfg_attr(feature = "bindings", derive(TS))]
14477pub struct SHA2 {
14478 pub this: Box<Expression>,
14479 #[serde(default)]
14480 pub length: Option<i64>,
14481}
14482
14483#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14485#[cfg_attr(feature = "bindings", derive(TS))]
14486pub struct SHA2Digest {
14487 pub this: Box<Expression>,
14488 #[serde(default)]
14489 pub length: Option<i64>,
14490}
14491
14492#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14494#[cfg_attr(feature = "bindings", derive(TS))]
14495pub struct SortArray {
14496 pub this: Box<Expression>,
14497 #[serde(default)]
14498 pub asc: Option<Box<Expression>>,
14499 #[serde(default)]
14500 pub nulls_first: Option<Box<Expression>>,
14501}
14502
14503#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14505#[cfg_attr(feature = "bindings", derive(TS))]
14506pub struct SplitPart {
14507 pub this: Box<Expression>,
14508 #[serde(default)]
14509 pub delimiter: Option<Box<Expression>>,
14510 #[serde(default)]
14511 pub part_index: Option<Box<Expression>>,
14512}
14513
14514#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14516#[cfg_attr(feature = "bindings", derive(TS))]
14517pub struct SubstringIndex {
14518 pub this: Box<Expression>,
14519 #[serde(default)]
14520 pub delimiter: Option<Box<Expression>>,
14521 #[serde(default)]
14522 pub count: Option<Box<Expression>>,
14523}
14524
14525#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14527#[cfg_attr(feature = "bindings", derive(TS))]
14528pub struct StandardHash {
14529 pub this: Box<Expression>,
14530 #[serde(default)]
14531 pub expression: Option<Box<Expression>>,
14532}
14533
14534#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14536#[cfg_attr(feature = "bindings", derive(TS))]
14537pub struct StrPosition {
14538 pub this: Box<Expression>,
14539 #[serde(default)]
14540 pub substr: Option<Box<Expression>>,
14541 #[serde(default)]
14542 pub position: Option<Box<Expression>>,
14543 #[serde(default)]
14544 pub occurrence: Option<Box<Expression>>,
14545}
14546
14547#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14549#[cfg_attr(feature = "bindings", derive(TS))]
14550pub struct Search {
14551 pub this: Box<Expression>,
14552 pub expression: Box<Expression>,
14553 #[serde(default)]
14554 pub json_scope: Option<Box<Expression>>,
14555 #[serde(default)]
14556 pub analyzer: Option<Box<Expression>>,
14557 #[serde(default)]
14558 pub analyzer_options: Option<Box<Expression>>,
14559 #[serde(default)]
14560 pub search_mode: Option<Box<Expression>>,
14561}
14562
14563#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14565#[cfg_attr(feature = "bindings", derive(TS))]
14566pub struct SearchIp {
14567 pub this: Box<Expression>,
14568 pub expression: Box<Expression>,
14569}
14570
14571#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14573#[cfg_attr(feature = "bindings", derive(TS))]
14574pub struct StrToDate {
14575 pub this: Box<Expression>,
14576 #[serde(default)]
14577 pub format: Option<String>,
14578 #[serde(default)]
14579 pub safe: Option<Box<Expression>>,
14580}
14581
14582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14584#[cfg_attr(feature = "bindings", derive(TS))]
14585pub struct StrToTime {
14586 pub this: Box<Expression>,
14587 pub format: String,
14588 #[serde(default)]
14589 pub zone: Option<Box<Expression>>,
14590 #[serde(default)]
14591 pub safe: Option<Box<Expression>>,
14592 #[serde(default)]
14593 pub target_type: Option<Box<Expression>>,
14594}
14595
14596#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14598#[cfg_attr(feature = "bindings", derive(TS))]
14599pub struct StrToUnix {
14600 #[serde(default)]
14601 pub this: Option<Box<Expression>>,
14602 #[serde(default)]
14603 pub format: Option<String>,
14604}
14605
14606#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14608#[cfg_attr(feature = "bindings", derive(TS))]
14609pub struct StrToMap {
14610 pub this: Box<Expression>,
14611 #[serde(default)]
14612 pub pair_delim: Option<Box<Expression>>,
14613 #[serde(default)]
14614 pub key_value_delim: Option<Box<Expression>>,
14615 #[serde(default)]
14616 pub duplicate_resolution_callback: Option<Box<Expression>>,
14617}
14618
14619#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14621#[cfg_attr(feature = "bindings", derive(TS))]
14622pub struct NumberToStr {
14623 pub this: Box<Expression>,
14624 pub format: String,
14625 #[serde(default)]
14626 pub culture: Option<Box<Expression>>,
14627}
14628
14629#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14631#[cfg_attr(feature = "bindings", derive(TS))]
14632pub struct FromBase {
14633 pub this: Box<Expression>,
14634 pub expression: Box<Expression>,
14635}
14636
14637#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14639#[cfg_attr(feature = "bindings", derive(TS))]
14640pub struct Stuff {
14641 pub this: Box<Expression>,
14642 #[serde(default)]
14643 pub start: Option<Box<Expression>>,
14644 #[serde(default)]
14645 pub length: Option<i64>,
14646 pub expression: Box<Expression>,
14647}
14648
14649#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14651#[cfg_attr(feature = "bindings", derive(TS))]
14652pub struct TimeToStr {
14653 pub this: Box<Expression>,
14654 pub format: String,
14655 #[serde(default)]
14656 pub culture: Option<Box<Expression>>,
14657 #[serde(default)]
14658 pub zone: Option<Box<Expression>>,
14659}
14660
14661#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14663#[cfg_attr(feature = "bindings", derive(TS))]
14664pub struct TimeStrToTime {
14665 pub this: Box<Expression>,
14666 #[serde(default)]
14667 pub zone: Option<Box<Expression>>,
14668}
14669
14670#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14672#[cfg_attr(feature = "bindings", derive(TS))]
14673pub struct TsOrDsAdd {
14674 pub this: Box<Expression>,
14675 pub expression: Box<Expression>,
14676 #[serde(default)]
14677 pub unit: Option<String>,
14678 #[serde(default)]
14679 pub return_type: Option<Box<Expression>>,
14680}
14681
14682#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14684#[cfg_attr(feature = "bindings", derive(TS))]
14685pub struct TsOrDsDiff {
14686 pub this: Box<Expression>,
14687 pub expression: Box<Expression>,
14688 #[serde(default)]
14689 pub unit: Option<String>,
14690}
14691
14692#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14694#[cfg_attr(feature = "bindings", derive(TS))]
14695pub struct TsOrDsToDate {
14696 pub this: Box<Expression>,
14697 #[serde(default)]
14698 pub format: Option<String>,
14699 #[serde(default)]
14700 pub safe: Option<Box<Expression>>,
14701}
14702
14703#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14705#[cfg_attr(feature = "bindings", derive(TS))]
14706pub struct TsOrDsToTime {
14707 pub this: Box<Expression>,
14708 #[serde(default)]
14709 pub format: Option<String>,
14710 #[serde(default)]
14711 pub safe: Option<Box<Expression>>,
14712}
14713
14714#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14716#[cfg_attr(feature = "bindings", derive(TS))]
14717pub struct Unhex {
14718 pub this: Box<Expression>,
14719 #[serde(default)]
14720 pub expression: Option<Box<Expression>>,
14721}
14722
14723#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14725#[cfg_attr(feature = "bindings", derive(TS))]
14726pub struct Uniform {
14727 pub this: Box<Expression>,
14728 pub expression: Box<Expression>,
14729 #[serde(default)]
14730 pub gen: Option<Box<Expression>>,
14731 #[serde(default)]
14732 pub seed: Option<Box<Expression>>,
14733}
14734
14735#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14737#[cfg_attr(feature = "bindings", derive(TS))]
14738pub struct UnixToStr {
14739 pub this: Box<Expression>,
14740 #[serde(default)]
14741 pub format: Option<String>,
14742}
14743
14744#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14746#[cfg_attr(feature = "bindings", derive(TS))]
14747pub struct UnixToTime {
14748 pub this: Box<Expression>,
14749 #[serde(default)]
14750 pub scale: Option<i64>,
14751 #[serde(default)]
14752 pub zone: Option<Box<Expression>>,
14753 #[serde(default)]
14754 pub hours: Option<Box<Expression>>,
14755 #[serde(default)]
14756 pub minutes: Option<Box<Expression>>,
14757 #[serde(default)]
14758 pub format: Option<String>,
14759 #[serde(default)]
14760 pub target_type: Option<Box<Expression>>,
14761}
14762
14763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14765#[cfg_attr(feature = "bindings", derive(TS))]
14766pub struct Uuid {
14767 #[serde(default)]
14768 pub this: Option<Box<Expression>>,
14769 #[serde(default)]
14770 pub name: Option<String>,
14771 #[serde(default)]
14772 pub is_string: Option<Box<Expression>>,
14773}
14774
14775#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14777#[cfg_attr(feature = "bindings", derive(TS))]
14778pub struct TimestampFromParts {
14779 #[serde(default)]
14780 pub zone: Option<Box<Expression>>,
14781 #[serde(default)]
14782 pub milli: Option<Box<Expression>>,
14783 #[serde(default)]
14784 pub this: Option<Box<Expression>>,
14785 #[serde(default)]
14786 pub expression: Option<Box<Expression>>,
14787}
14788
14789#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14791#[cfg_attr(feature = "bindings", derive(TS))]
14792pub struct TimestampTzFromParts {
14793 #[serde(default)]
14794 pub zone: Option<Box<Expression>>,
14795}
14796
14797#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14799#[cfg_attr(feature = "bindings", derive(TS))]
14800pub struct Corr {
14801 pub this: Box<Expression>,
14802 pub expression: Box<Expression>,
14803 #[serde(default)]
14804 pub null_on_zero_variance: Option<Box<Expression>>,
14805}
14806
14807#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14809#[cfg_attr(feature = "bindings", derive(TS))]
14810pub struct WidthBucket {
14811 pub this: Box<Expression>,
14812 #[serde(default)]
14813 pub min_value: Option<Box<Expression>>,
14814 #[serde(default)]
14815 pub max_value: Option<Box<Expression>>,
14816 #[serde(default)]
14817 pub num_buckets: Option<Box<Expression>>,
14818 #[serde(default)]
14819 pub threshold: Option<Box<Expression>>,
14820}
14821
14822#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14824#[cfg_attr(feature = "bindings", derive(TS))]
14825pub struct CovarSamp {
14826 pub this: Box<Expression>,
14827 pub expression: Box<Expression>,
14828}
14829
14830#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14832#[cfg_attr(feature = "bindings", derive(TS))]
14833pub struct CovarPop {
14834 pub this: Box<Expression>,
14835 pub expression: Box<Expression>,
14836}
14837
14838#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14840#[cfg_attr(feature = "bindings", derive(TS))]
14841pub struct Week {
14842 pub this: Box<Expression>,
14843 #[serde(default)]
14844 pub mode: Option<Box<Expression>>,
14845}
14846
14847#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14849#[cfg_attr(feature = "bindings", derive(TS))]
14850pub struct XMLElement {
14851 pub this: Box<Expression>,
14852 #[serde(default)]
14853 pub expressions: Vec<Expression>,
14854 #[serde(default)]
14855 pub evalname: Option<Box<Expression>>,
14856}
14857
14858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14860#[cfg_attr(feature = "bindings", derive(TS))]
14861pub struct XMLGet {
14862 pub this: Box<Expression>,
14863 pub expression: Box<Expression>,
14864 #[serde(default)]
14865 pub instance: Option<Box<Expression>>,
14866}
14867
14868#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14870#[cfg_attr(feature = "bindings", derive(TS))]
14871pub struct XMLTable {
14872 pub this: Box<Expression>,
14873 #[serde(default)]
14874 pub namespaces: Option<Box<Expression>>,
14875 #[serde(default)]
14876 pub passing: Option<Box<Expression>>,
14877 #[serde(default)]
14878 pub columns: Vec<Expression>,
14879 #[serde(default)]
14880 pub by_ref: Option<Box<Expression>>,
14881}
14882
14883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14885#[cfg_attr(feature = "bindings", derive(TS))]
14886pub struct XMLKeyValueOption {
14887 pub this: Box<Expression>,
14888 #[serde(default)]
14889 pub expression: Option<Box<Expression>>,
14890}
14891
14892#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14894#[cfg_attr(feature = "bindings", derive(TS))]
14895pub struct Zipf {
14896 pub this: Box<Expression>,
14897 #[serde(default)]
14898 pub elementcount: Option<Box<Expression>>,
14899 #[serde(default)]
14900 pub gen: Option<Box<Expression>>,
14901}
14902
14903#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14905#[cfg_attr(feature = "bindings", derive(TS))]
14906pub struct Merge {
14907 pub this: Box<Expression>,
14908 pub using: Box<Expression>,
14909 #[serde(default)]
14910 pub on: Option<Box<Expression>>,
14911 #[serde(default)]
14912 pub using_cond: Option<Box<Expression>>,
14913 #[serde(default)]
14914 pub whens: Option<Box<Expression>>,
14915 #[serde(default)]
14916 pub with_: Option<Box<Expression>>,
14917 #[serde(default)]
14918 pub returning: Option<Box<Expression>>,
14919}
14920
14921#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14923#[cfg_attr(feature = "bindings", derive(TS))]
14924pub struct When {
14925 #[serde(default)]
14926 pub matched: Option<Box<Expression>>,
14927 #[serde(default)]
14928 pub source: Option<Box<Expression>>,
14929 #[serde(default)]
14930 pub condition: Option<Box<Expression>>,
14931 pub then: Box<Expression>,
14932}
14933
14934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14936#[cfg_attr(feature = "bindings", derive(TS))]
14937pub struct Whens {
14938 #[serde(default)]
14939 pub expressions: Vec<Expression>,
14940}
14941
14942#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
14944#[cfg_attr(feature = "bindings", derive(TS))]
14945pub struct NextValueFor {
14946 pub this: Box<Expression>,
14947 #[serde(default)]
14948 pub order: Option<Box<Expression>>,
14949}
14950
14951#[cfg(test)]
14952mod tests {
14953 use super::*;
14954
14955 #[test]
14956 #[cfg(feature = "bindings")]
14957 fn export_typescript_types() {
14958 Expression::export_all(&ts_rs::Config::default())
14961 .expect("Failed to export Expression types");
14962 }
14963
14964 #[test]
14965 fn test_simple_select_builder() {
14966 let select = Select::new()
14967 .column(Expression::star())
14968 .from(Expression::Table(Box::new(TableRef::new("users"))));
14969
14970 assert_eq!(select.expressions.len(), 1);
14971 assert!(select.from.is_some());
14972 }
14973
14974 #[test]
14975 fn test_expression_alias() {
14976 let expr = Expression::column("id").alias("user_id");
14977
14978 match expr {
14979 Expression::Alias(a) => {
14980 assert_eq!(a.alias.name, "user_id");
14981 }
14982 _ => panic!("Expected Alias"),
14983 }
14984 }
14985
14986 #[test]
14987 fn test_literal_creation() {
14988 let num = Expression::number(42);
14989 let str = Expression::string("hello");
14990
14991 match num {
14992 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
14993 let Literal::Number(n) = lit.as_ref() else {
14994 unreachable!()
14995 };
14996 assert_eq!(n, "42")
14997 }
14998 _ => panic!("Expected Number"),
14999 }
15000
15001 match str {
15002 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15003 let Literal::String(s) = lit.as_ref() else {
15004 unreachable!()
15005 };
15006 assert_eq!(s, "hello")
15007 }
15008 _ => panic!("Expected String"),
15009 }
15010 }
15011
15012 #[test]
15013 fn test_expression_sql() {
15014 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15015 assert_eq!(expr.sql(), "SELECT 1 + 2");
15016 }
15017
15018 #[test]
15019 fn test_expression_sql_for() {
15020 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15021 let sql = expr.sql_for(crate::DialectType::Generic);
15022 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15024 }
15025}