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(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
77#[cfg_attr(feature = "bindings", derive(TS))]
78#[serde(rename_all = "snake_case")]
79#[cfg_attr(feature = "bindings", ts(export))]
80pub enum Expression {
81 Literal(Box<Literal>),
83 Boolean(BooleanLiteral),
84 Null(Null),
85
86 Identifier(Identifier),
88 Column(Box<Column>),
89 Table(Box<TableRef>),
90 Star(Star),
91 BracedWildcard(Box<Expression>),
93
94 Select(Box<Select>),
96 Union(Box<Union>),
97 Intersect(Box<Intersect>),
98 Except(Box<Except>),
99 Subquery(Box<Subquery>),
100 PipeOperator(Box<PipeOperator>),
101 Pivot(Box<Pivot>),
102 PivotAlias(Box<PivotAlias>),
103 Unpivot(Box<Unpivot>),
104 Values(Box<Values>),
105 PreWhere(Box<PreWhere>),
106 Stream(Box<Stream>),
107 UsingData(Box<UsingData>),
108 XmlNamespace(Box<XmlNamespace>),
109
110 Insert(Box<Insert>),
112 Update(Box<Update>),
113 Delete(Box<Delete>),
114 Copy(Box<CopyStmt>),
115 Put(Box<PutStmt>),
116 StageReference(Box<StageReference>),
117 TryCatch(Box<TryCatch>),
118
119 Alias(Box<Alias>),
121 Cast(Box<Cast>),
122 Collation(Box<CollationExpr>),
123 Case(Box<Case>),
124
125 And(Box<BinaryOp>),
127 Or(Box<BinaryOp>),
128 Add(Box<BinaryOp>),
129 Sub(Box<BinaryOp>),
130 Mul(Box<BinaryOp>),
131 Div(Box<BinaryOp>),
132 Mod(Box<BinaryOp>),
133 Eq(Box<BinaryOp>),
134 Neq(Box<BinaryOp>),
135 Lt(Box<BinaryOp>),
136 Lte(Box<BinaryOp>),
137 Gt(Box<BinaryOp>),
138 Gte(Box<BinaryOp>),
139 Like(Box<LikeOp>),
140 ILike(Box<LikeOp>),
141 Match(Box<BinaryOp>),
143 BitwiseAnd(Box<BinaryOp>),
144 BitwiseOr(Box<BinaryOp>),
145 BitwiseXor(Box<BinaryOp>),
146 Concat(Box<BinaryOp>),
147 Adjacent(Box<BinaryOp>), TsMatch(Box<BinaryOp>), PropertyEQ(Box<BinaryOp>), ArrayContainsAll(Box<BinaryOp>), ArrayContainedBy(Box<BinaryOp>), ArrayOverlaps(Box<BinaryOp>), JSONBContainsAllTopKeys(Box<BinaryOp>), JSONBContainsAnyTopKeys(Box<BinaryOp>), JSONBDeleteAtPath(Box<BinaryOp>), ExtendsLeft(Box<BinaryOp>), ExtendsRight(Box<BinaryOp>), Not(Box<UnaryOp>),
163 Neg(Box<UnaryOp>),
164 BitwiseNot(Box<UnaryOp>),
165
166 In(Box<In>),
168 Between(Box<Between>),
169 IsNull(Box<IsNull>),
170 IsTrue(Box<IsTrueFalse>),
171 IsFalse(Box<IsTrueFalse>),
172 IsJson(Box<IsJson>),
173 Is(Box<BinaryOp>), Exists(Box<Exists>),
175 MemberOf(Box<BinaryOp>),
177
178 Function(Box<Function>),
180 AggregateFunction(Box<AggregateFunction>),
181 WindowFunction(Box<WindowFunction>),
182
183 From(Box<From>),
185 Join(Box<Join>),
186 JoinedTable(Box<JoinedTable>),
187 Where(Box<Where>),
188 GroupBy(Box<GroupBy>),
189 Having(Box<Having>),
190 OrderBy(Box<OrderBy>),
191 Limit(Box<Limit>),
192 Offset(Box<Offset>),
193 Qualify(Box<Qualify>),
194 With(Box<With>),
195 Cte(Box<Cte>),
196 DistributeBy(Box<DistributeBy>),
197 ClusterBy(Box<ClusterBy>),
198 SortBy(Box<SortBy>),
199 LateralView(Box<LateralView>),
200 Hint(Box<Hint>),
201 Pseudocolumn(Pseudocolumn),
202
203 Connect(Box<Connect>),
205 Prior(Box<Prior>),
206 ConnectByRoot(Box<ConnectByRoot>),
207
208 MatchRecognize(Box<MatchRecognize>),
210
211 Ordered(Box<Ordered>),
213
214 Window(Box<WindowSpec>),
216 Over(Box<Over>),
217 WithinGroup(Box<WithinGroup>),
218
219 DataType(DataType),
221
222 Array(Box<Array>),
224 Struct(Box<Struct>),
225 Tuple(Box<Tuple>),
226
227 Interval(Box<Interval>),
229
230 ConcatWs(Box<ConcatWs>),
232 Substring(Box<SubstringFunc>),
233 Upper(Box<UnaryFunc>),
234 Lower(Box<UnaryFunc>),
235 Length(Box<UnaryFunc>),
236 Trim(Box<TrimFunc>),
237 LTrim(Box<UnaryFunc>),
238 RTrim(Box<UnaryFunc>),
239 Replace(Box<ReplaceFunc>),
240 Reverse(Box<UnaryFunc>),
241 Left(Box<LeftRightFunc>),
242 Right(Box<LeftRightFunc>),
243 Repeat(Box<RepeatFunc>),
244 Lpad(Box<PadFunc>),
245 Rpad(Box<PadFunc>),
246 Split(Box<SplitFunc>),
247 RegexpLike(Box<RegexpFunc>),
248 RegexpReplace(Box<RegexpReplaceFunc>),
249 RegexpExtract(Box<RegexpExtractFunc>),
250 Overlay(Box<OverlayFunc>),
251
252 Abs(Box<UnaryFunc>),
254 Round(Box<RoundFunc>),
255 Floor(Box<FloorFunc>),
256 Ceil(Box<CeilFunc>),
257 Power(Box<BinaryFunc>),
258 Sqrt(Box<UnaryFunc>),
259 Cbrt(Box<UnaryFunc>),
260 Ln(Box<UnaryFunc>),
261 Log(Box<LogFunc>),
262 Exp(Box<UnaryFunc>),
263 Sign(Box<UnaryFunc>),
264 Greatest(Box<VarArgFunc>),
265 Least(Box<VarArgFunc>),
266
267 CurrentDate(CurrentDate),
269 CurrentTime(CurrentTime),
270 CurrentTimestamp(CurrentTimestamp),
271 CurrentTimestampLTZ(CurrentTimestampLTZ),
272 AtTimeZone(Box<AtTimeZone>),
273 DateAdd(Box<DateAddFunc>),
274 DateSub(Box<DateAddFunc>),
275 DateDiff(Box<DateDiffFunc>),
276 DateTrunc(Box<DateTruncFunc>),
277 Extract(Box<ExtractFunc>),
278 ToDate(Box<ToDateFunc>),
279 ToTimestamp(Box<ToTimestampFunc>),
280 Date(Box<UnaryFunc>),
281 Time(Box<UnaryFunc>),
282 DateFromUnixDate(Box<UnaryFunc>),
283 UnixDate(Box<UnaryFunc>),
284 UnixSeconds(Box<UnaryFunc>),
285 UnixMillis(Box<UnaryFunc>),
286 UnixMicros(Box<UnaryFunc>),
287 UnixToTimeStr(Box<BinaryFunc>),
288 TimeStrToDate(Box<UnaryFunc>),
289 DateToDi(Box<UnaryFunc>),
290 DiToDate(Box<UnaryFunc>),
291 TsOrDiToDi(Box<UnaryFunc>),
292 TsOrDsToDatetime(Box<UnaryFunc>),
293 TsOrDsToTimestamp(Box<UnaryFunc>),
294 YearOfWeek(Box<UnaryFunc>),
295 YearOfWeekIso(Box<UnaryFunc>),
296
297 Coalesce(Box<VarArgFunc>),
299 NullIf(Box<BinaryFunc>),
300 IfFunc(Box<IfFunc>),
301 IfNull(Box<BinaryFunc>),
302 Nvl(Box<BinaryFunc>),
303 Nvl2(Box<Nvl2Func>),
304
305 TryCast(Box<Cast>),
307 SafeCast(Box<Cast>),
308
309 Count(Box<CountFunc>),
311 Sum(Box<AggFunc>),
312 Avg(Box<AggFunc>),
313 Min(Box<AggFunc>),
314 Max(Box<AggFunc>),
315 GroupConcat(Box<GroupConcatFunc>),
316 StringAgg(Box<StringAggFunc>),
317 ListAgg(Box<ListAggFunc>),
318 ArrayAgg(Box<AggFunc>),
319 CountIf(Box<AggFunc>),
320 SumIf(Box<SumIfFunc>),
321 Stddev(Box<AggFunc>),
322 StddevPop(Box<AggFunc>),
323 StddevSamp(Box<AggFunc>),
324 Variance(Box<AggFunc>),
325 VarPop(Box<AggFunc>),
326 VarSamp(Box<AggFunc>),
327 Median(Box<AggFunc>),
328 Mode(Box<AggFunc>),
329 First(Box<AggFunc>),
330 Last(Box<AggFunc>),
331 AnyValue(Box<AggFunc>),
332 ApproxDistinct(Box<AggFunc>),
333 ApproxCountDistinct(Box<AggFunc>),
334 ApproxPercentile(Box<ApproxPercentileFunc>),
335 Percentile(Box<PercentileFunc>),
336 LogicalAnd(Box<AggFunc>),
337 LogicalOr(Box<AggFunc>),
338 Skewness(Box<AggFunc>),
339 BitwiseCount(Box<UnaryFunc>),
340 ArrayConcatAgg(Box<AggFunc>),
341 ArrayUniqueAgg(Box<AggFunc>),
342 BoolXorAgg(Box<AggFunc>),
343
344 RowNumber(RowNumber),
346 Rank(Rank),
347 DenseRank(DenseRank),
348 NTile(Box<NTileFunc>),
349 Lead(Box<LeadLagFunc>),
350 Lag(Box<LeadLagFunc>),
351 FirstValue(Box<ValueFunc>),
352 LastValue(Box<ValueFunc>),
353 NthValue(Box<NthValueFunc>),
354 PercentRank(PercentRank),
355 CumeDist(CumeDist),
356 PercentileCont(Box<PercentileFunc>),
357 PercentileDisc(Box<PercentileFunc>),
358
359 Contains(Box<BinaryFunc>),
361 StartsWith(Box<BinaryFunc>),
362 EndsWith(Box<BinaryFunc>),
363 Position(Box<PositionFunc>),
364 Initcap(Box<UnaryFunc>),
365 Ascii(Box<UnaryFunc>),
366 Chr(Box<UnaryFunc>),
367 CharFunc(Box<CharFunc>),
369 Soundex(Box<UnaryFunc>),
370 Levenshtein(Box<BinaryFunc>),
371 ByteLength(Box<UnaryFunc>),
372 Hex(Box<UnaryFunc>),
373 LowerHex(Box<UnaryFunc>),
374 Unicode(Box<UnaryFunc>),
375
376 ModFunc(Box<BinaryFunc>),
378 Random(Random),
379 Rand(Box<Rand>),
380 TruncFunc(Box<TruncateFunc>),
381 Pi(Pi),
382 Radians(Box<UnaryFunc>),
383 Degrees(Box<UnaryFunc>),
384 Sin(Box<UnaryFunc>),
385 Cos(Box<UnaryFunc>),
386 Tan(Box<UnaryFunc>),
387 Asin(Box<UnaryFunc>),
388 Acos(Box<UnaryFunc>),
389 Atan(Box<UnaryFunc>),
390 Atan2(Box<BinaryFunc>),
391 IsNan(Box<UnaryFunc>),
392 IsInf(Box<UnaryFunc>),
393 IntDiv(Box<BinaryFunc>),
394
395 Decode(Box<DecodeFunc>),
397
398 DateFormat(Box<DateFormatFunc>),
400 FormatDate(Box<DateFormatFunc>),
401 Year(Box<UnaryFunc>),
402 Month(Box<UnaryFunc>),
403 Day(Box<UnaryFunc>),
404 Hour(Box<UnaryFunc>),
405 Minute(Box<UnaryFunc>),
406 Second(Box<UnaryFunc>),
407 DayOfWeek(Box<UnaryFunc>),
408 DayOfWeekIso(Box<UnaryFunc>),
409 DayOfMonth(Box<UnaryFunc>),
410 DayOfYear(Box<UnaryFunc>),
411 WeekOfYear(Box<UnaryFunc>),
412 Quarter(Box<UnaryFunc>),
413 AddMonths(Box<BinaryFunc>),
414 MonthsBetween(Box<BinaryFunc>),
415 LastDay(Box<LastDayFunc>),
416 NextDay(Box<BinaryFunc>),
417 Epoch(Box<UnaryFunc>),
418 EpochMs(Box<UnaryFunc>),
419 FromUnixtime(Box<FromUnixtimeFunc>),
420 UnixTimestamp(Box<UnixTimestampFunc>),
421 MakeDate(Box<MakeDateFunc>),
422 MakeTimestamp(Box<MakeTimestampFunc>),
423 TimestampTrunc(Box<DateTruncFunc>),
424 TimeStrToUnix(Box<UnaryFunc>),
425
426 SessionUser(SessionUser),
428
429 SHA(Box<UnaryFunc>),
431 SHA1Digest(Box<UnaryFunc>),
432
433 TimeToUnix(Box<UnaryFunc>),
435
436 ArrayFunc(Box<ArrayConstructor>),
438 ArrayLength(Box<UnaryFunc>),
439 ArraySize(Box<UnaryFunc>),
440 Cardinality(Box<UnaryFunc>),
441 ArrayContains(Box<BinaryFunc>),
442 ArrayPosition(Box<BinaryFunc>),
443 ArrayAppend(Box<BinaryFunc>),
444 ArrayPrepend(Box<BinaryFunc>),
445 ArrayConcat(Box<VarArgFunc>),
446 ArraySort(Box<ArraySortFunc>),
447 ArrayReverse(Box<UnaryFunc>),
448 ArrayDistinct(Box<UnaryFunc>),
449 ArrayJoin(Box<ArrayJoinFunc>),
450 ArrayToString(Box<ArrayJoinFunc>),
451 Unnest(Box<UnnestFunc>),
452 Explode(Box<UnaryFunc>),
453 ExplodeOuter(Box<UnaryFunc>),
454 ArrayFilter(Box<ArrayFilterFunc>),
455 ArrayTransform(Box<ArrayTransformFunc>),
456 ArrayFlatten(Box<UnaryFunc>),
457 ArrayCompact(Box<UnaryFunc>),
458 ArrayIntersect(Box<VarArgFunc>),
459 ArrayUnion(Box<BinaryFunc>),
460 ArrayExcept(Box<BinaryFunc>),
461 ArrayRemove(Box<BinaryFunc>),
462 ArrayZip(Box<VarArgFunc>),
463 Sequence(Box<SequenceFunc>),
464 Generate(Box<SequenceFunc>),
465 ExplodingGenerateSeries(Box<SequenceFunc>),
466 ToArray(Box<UnaryFunc>),
467 StarMap(Box<BinaryFunc>),
468
469 StructFunc(Box<StructConstructor>),
471 StructExtract(Box<StructExtractFunc>),
472 NamedStruct(Box<NamedStructFunc>),
473
474 MapFunc(Box<MapConstructor>),
476 MapFromEntries(Box<UnaryFunc>),
477 MapFromArrays(Box<BinaryFunc>),
478 MapKeys(Box<UnaryFunc>),
479 MapValues(Box<UnaryFunc>),
480 MapContainsKey(Box<BinaryFunc>),
481 MapConcat(Box<VarArgFunc>),
482 ElementAt(Box<BinaryFunc>),
483 TransformKeys(Box<TransformFunc>),
484 TransformValues(Box<TransformFunc>),
485
486 FunctionEmits(Box<FunctionEmits>),
488
489 JsonExtract(Box<JsonExtractFunc>),
491 JsonExtractScalar(Box<JsonExtractFunc>),
492 JsonExtractPath(Box<JsonPathFunc>),
493 JsonArray(Box<VarArgFunc>),
494 JsonObject(Box<JsonObjectFunc>),
495 JsonQuery(Box<JsonExtractFunc>),
496 JsonValue(Box<JsonExtractFunc>),
497 JsonArrayLength(Box<UnaryFunc>),
498 JsonKeys(Box<UnaryFunc>),
499 JsonType(Box<UnaryFunc>),
500 ParseJson(Box<UnaryFunc>),
501 ToJson(Box<UnaryFunc>),
502 JsonSet(Box<JsonModifyFunc>),
503 JsonInsert(Box<JsonModifyFunc>),
504 JsonRemove(Box<JsonPathFunc>),
505 JsonMergePatch(Box<BinaryFunc>),
506 JsonArrayAgg(Box<JsonArrayAggFunc>),
507 JsonObjectAgg(Box<JsonObjectAggFunc>),
508
509 Convert(Box<ConvertFunc>),
511 Typeof(Box<UnaryFunc>),
512
513 Lambda(Box<LambdaExpr>),
515 Parameter(Box<Parameter>),
516 Placeholder(Placeholder),
517 NamedArgument(Box<NamedArgument>),
518 TableArgument(Box<TableArgument>),
521 SqlComment(Box<SqlComment>),
522
523 NullSafeEq(Box<BinaryOp>),
525 NullSafeNeq(Box<BinaryOp>),
526 Glob(Box<BinaryOp>),
527 SimilarTo(Box<SimilarToExpr>),
528 Any(Box<QuantifiedExpr>),
529 All(Box<QuantifiedExpr>),
530 Overlaps(Box<OverlapsExpr>),
531
532 BitwiseLeftShift(Box<BinaryOp>),
534 BitwiseRightShift(Box<BinaryOp>),
535 BitwiseAndAgg(Box<AggFunc>),
536 BitwiseOrAgg(Box<AggFunc>),
537 BitwiseXorAgg(Box<AggFunc>),
538
539 Subscript(Box<Subscript>),
541 Dot(Box<DotAccess>),
542 MethodCall(Box<MethodCall>),
543 ArraySlice(Box<ArraySlice>),
544
545 CreateTable(Box<CreateTable>),
547 DropTable(Box<DropTable>),
548 Undrop(Box<Undrop>),
549 AlterTable(Box<AlterTable>),
550 SplitTable(Box<SplitTable>),
551 FlashbackTable(Box<FlashbackTable>),
552 CreateIndex(Box<CreateIndex>),
553 DropIndex(Box<DropIndex>),
554 CreateView(Box<CreateView>),
555 DropView(Box<DropView>),
556 AlterView(Box<AlterView>),
557 AlterIndex(Box<AlterIndex>),
558 Truncate(Box<Truncate>),
559 Use(Box<Use>),
560 Cache(Box<Cache>),
561 Uncache(Box<Uncache>),
562 LoadData(Box<LoadData>),
563 Pragma(Box<Pragma>),
564 Grant(Box<Grant>),
565 Revoke(Box<Revoke>),
566 Comment(Box<Comment>),
567 SetStatement(Box<SetStatement>),
568 CreateSchema(Box<CreateSchema>),
570 DropSchema(Box<DropSchema>),
571 DropNamespace(Box<DropNamespace>),
572 CreateDatabase(Box<CreateDatabase>),
573 DropDatabase(Box<DropDatabase>),
574 CreateFunction(Box<CreateFunction>),
575 DropFunction(Box<DropFunction>),
576 CreateProcedure(Box<CreateProcedure>),
577 DropProcedure(Box<DropProcedure>),
578 CreateSequence(Box<CreateSequence>),
579 CreateSynonym(Box<CreateSynonym>),
580 DropSequence(Box<DropSequence>),
581 AlterSequence(Box<AlterSequence>),
582 CreateTrigger(Box<CreateTrigger>),
583 DropTrigger(Box<DropTrigger>),
584 CreateType(Box<CreateType>),
585 DropType(Box<DropType>),
586 Describe(Box<Describe>),
587 Show(Box<Show>),
588
589 Command(Box<Command>),
591 Kill(Box<Kill>),
592 Prepare(Box<PrepareStatement>),
594 Execute(Box<ExecuteStatement>),
596
597 CreateTask(Box<CreateTask>),
599
600 Raw(Raw),
602
603 Paren(Box<Paren>),
605
606 Annotated(Box<Annotated>),
608
609 Refresh(Box<Refresh>),
612 LockingStatement(Box<LockingStatement>),
613 SequenceProperties(Box<SequenceProperties>),
614 TruncateTable(Box<TruncateTable>),
615 Clone(Box<Clone>),
616 Attach(Box<Attach>),
617 Detach(Box<Detach>),
618 Install(Box<Install>),
619 Summarize(Box<Summarize>),
620 Declare(Box<Declare>),
621 DeclareItem(Box<DeclareItem>),
622 Set(Box<Set>),
623 Heredoc(Box<Heredoc>),
624 SetItem(Box<SetItem>),
625 QueryBand(Box<QueryBand>),
626 UserDefinedFunction(Box<UserDefinedFunction>),
627 RecursiveWithSearch(Box<RecursiveWithSearch>),
628 ProjectionDef(Box<ProjectionDef>),
629 TableAlias(Box<TableAlias>),
630 ByteString(Box<ByteString>),
631 HexStringExpr(Box<HexStringExpr>),
632 UnicodeString(Box<UnicodeString>),
633 ColumnPosition(Box<ColumnPosition>),
634 ColumnDef(Box<ColumnDef>),
635 AlterColumn(Box<AlterColumn>),
636 AlterSortKey(Box<AlterSortKey>),
637 AlterSet(Box<AlterSet>),
638 RenameColumn(Box<RenameColumn>),
639 Comprehension(Box<Comprehension>),
640 MergeTreeTTLAction(Box<MergeTreeTTLAction>),
641 MergeTreeTTL(Box<MergeTreeTTL>),
642 IndexConstraintOption(Box<IndexConstraintOption>),
643 ColumnConstraint(Box<ColumnConstraint>),
644 PeriodForSystemTimeConstraint(Box<PeriodForSystemTimeConstraint>),
645 CaseSpecificColumnConstraint(Box<CaseSpecificColumnConstraint>),
646 CharacterSetColumnConstraint(Box<CharacterSetColumnConstraint>),
647 CheckColumnConstraint(Box<CheckColumnConstraint>),
648 AssumeColumnConstraint(Box<AssumeColumnConstraint>),
649 CompressColumnConstraint(Box<CompressColumnConstraint>),
650 DateFormatColumnConstraint(Box<DateFormatColumnConstraint>),
651 EphemeralColumnConstraint(Box<EphemeralColumnConstraint>),
652 WithOperator(Box<WithOperator>),
653 GeneratedAsIdentityColumnConstraint(Box<GeneratedAsIdentityColumnConstraint>),
654 AutoIncrementColumnConstraint(AutoIncrementColumnConstraint),
655 CommentColumnConstraint(CommentColumnConstraint),
656 GeneratedAsRowColumnConstraint(Box<GeneratedAsRowColumnConstraint>),
657 IndexColumnConstraint(Box<IndexColumnConstraint>),
658 MaskingPolicyColumnConstraint(Box<MaskingPolicyColumnConstraint>),
659 NotNullColumnConstraint(Box<NotNullColumnConstraint>),
660 PrimaryKeyColumnConstraint(Box<PrimaryKeyColumnConstraint>),
661 UniqueColumnConstraint(Box<UniqueColumnConstraint>),
662 WatermarkColumnConstraint(Box<WatermarkColumnConstraint>),
663 ComputedColumnConstraint(Box<ComputedColumnConstraint>),
664 InOutColumnConstraint(Box<InOutColumnConstraint>),
665 DefaultColumnConstraint(Box<DefaultColumnConstraint>),
666 PathColumnConstraint(Box<PathColumnConstraint>),
667 Constraint(Box<Constraint>),
668 Export(Box<Export>),
669 Filter(Box<Filter>),
670 Changes(Box<Changes>),
671 CopyParameter(Box<CopyParameter>),
672 Credentials(Box<Credentials>),
673 Directory(Box<Directory>),
674 ForeignKey(Box<ForeignKey>),
675 ColumnPrefix(Box<ColumnPrefix>),
676 PrimaryKey(Box<PrimaryKey>),
677 IntoClause(Box<IntoClause>),
678 JoinHint(Box<JoinHint>),
679 Opclass(Box<Opclass>),
680 Index(Box<Index>),
681 IndexParameters(Box<IndexParameters>),
682 ConditionalInsert(Box<ConditionalInsert>),
683 MultitableInserts(Box<MultitableInserts>),
684 OnConflict(Box<OnConflict>),
685 OnCondition(Box<OnCondition>),
686 Returning(Box<Returning>),
687 Introducer(Box<Introducer>),
688 PartitionRange(Box<PartitionRange>),
689 Fetch(Box<Fetch>),
690 Group(Box<Group>),
691 Cube(Box<Cube>),
692 Rollup(Box<Rollup>),
693 GroupingSets(Box<GroupingSets>),
694 LimitOptions(Box<LimitOptions>),
695 Lateral(Box<Lateral>),
696 TableFromRows(Box<TableFromRows>),
697 RowsFrom(Box<RowsFrom>),
698 MatchRecognizeMeasure(Box<MatchRecognizeMeasure>),
699 WithFill(Box<WithFill>),
700 Property(Box<Property>),
701 GrantPrivilege(Box<GrantPrivilege>),
702 GrantPrincipal(Box<GrantPrincipal>),
703 AllowedValuesProperty(Box<AllowedValuesProperty>),
704 AlgorithmProperty(Box<AlgorithmProperty>),
705 AutoIncrementProperty(Box<AutoIncrementProperty>),
706 AutoRefreshProperty(Box<AutoRefreshProperty>),
707 BackupProperty(Box<BackupProperty>),
708 BuildProperty(Box<BuildProperty>),
709 BlockCompressionProperty(Box<BlockCompressionProperty>),
710 CharacterSetProperty(Box<CharacterSetProperty>),
711 ChecksumProperty(Box<ChecksumProperty>),
712 CollateProperty(Box<CollateProperty>),
713 DataBlocksizeProperty(Box<DataBlocksizeProperty>),
714 DataDeletionProperty(Box<DataDeletionProperty>),
715 DefinerProperty(Box<DefinerProperty>),
716 DistKeyProperty(Box<DistKeyProperty>),
717 DistributedByProperty(Box<DistributedByProperty>),
718 DistStyleProperty(Box<DistStyleProperty>),
719 DuplicateKeyProperty(Box<DuplicateKeyProperty>),
720 EngineProperty(Box<EngineProperty>),
721 ToTableProperty(Box<ToTableProperty>),
722 ExecuteAsProperty(Box<ExecuteAsProperty>),
723 ExternalProperty(Box<ExternalProperty>),
724 FallbackProperty(Box<FallbackProperty>),
725 FileFormatProperty(Box<FileFormatProperty>),
726 CredentialsProperty(Box<CredentialsProperty>),
727 FreespaceProperty(Box<FreespaceProperty>),
728 InheritsProperty(Box<InheritsProperty>),
729 InputModelProperty(Box<InputModelProperty>),
730 OutputModelProperty(Box<OutputModelProperty>),
731 IsolatedLoadingProperty(Box<IsolatedLoadingProperty>),
732 JournalProperty(Box<JournalProperty>),
733 LanguageProperty(Box<LanguageProperty>),
734 EnviromentProperty(Box<EnviromentProperty>),
735 ClusteredByProperty(Box<ClusteredByProperty>),
736 DictProperty(Box<DictProperty>),
737 DictRange(Box<DictRange>),
738 OnCluster(Box<OnCluster>),
739 LikeProperty(Box<LikeProperty>),
740 LocationProperty(Box<LocationProperty>),
741 LockProperty(Box<LockProperty>),
742 LockingProperty(Box<LockingProperty>),
743 LogProperty(Box<LogProperty>),
744 MaterializedProperty(Box<MaterializedProperty>),
745 MergeBlockRatioProperty(Box<MergeBlockRatioProperty>),
746 OnProperty(Box<OnProperty>),
747 OnCommitProperty(Box<OnCommitProperty>),
748 PartitionedByProperty(Box<PartitionedByProperty>),
749 PartitionByProperty(Box<PartitionByProperty>),
750 PartitionedByBucket(Box<PartitionedByBucket>),
751 ClusterByColumnsProperty(Box<ClusterByColumnsProperty>),
752 PartitionByTruncate(Box<PartitionByTruncate>),
753 PartitionByRangeProperty(Box<PartitionByRangeProperty>),
754 PartitionByRangePropertyDynamic(Box<PartitionByRangePropertyDynamic>),
755 PartitionByListProperty(Box<PartitionByListProperty>),
756 PartitionList(Box<PartitionList>),
757 Partition(Box<Partition>),
758 RefreshTriggerProperty(Box<RefreshTriggerProperty>),
759 UniqueKeyProperty(Box<UniqueKeyProperty>),
760 RollupProperty(Box<RollupProperty>),
761 PartitionBoundSpec(Box<PartitionBoundSpec>),
762 PartitionedOfProperty(Box<PartitionedOfProperty>),
763 RemoteWithConnectionModelProperty(Box<RemoteWithConnectionModelProperty>),
764 ReturnsProperty(Box<ReturnsProperty>),
765 RowFormatProperty(Box<RowFormatProperty>),
766 RowFormatDelimitedProperty(Box<RowFormatDelimitedProperty>),
767 RowFormatSerdeProperty(Box<RowFormatSerdeProperty>),
768 QueryTransform(Box<QueryTransform>),
769 SampleProperty(Box<SampleProperty>),
770 SecurityProperty(Box<SecurityProperty>),
771 SchemaCommentProperty(Box<SchemaCommentProperty>),
772 SemanticView(Box<SemanticView>),
773 SerdeProperties(Box<SerdeProperties>),
774 SetProperty(Box<SetProperty>),
775 SharingProperty(Box<SharingProperty>),
776 SetConfigProperty(Box<SetConfigProperty>),
777 SettingsProperty(Box<SettingsProperty>),
778 SortKeyProperty(Box<SortKeyProperty>),
779 SqlReadWriteProperty(Box<SqlReadWriteProperty>),
780 SqlSecurityProperty(Box<SqlSecurityProperty>),
781 StabilityProperty(Box<StabilityProperty>),
782 StorageHandlerProperty(Box<StorageHandlerProperty>),
783 TemporaryProperty(Box<TemporaryProperty>),
784 Tags(Box<Tags>),
785 TransformModelProperty(Box<TransformModelProperty>),
786 TransientProperty(Box<TransientProperty>),
787 UsingTemplateProperty(Box<UsingTemplateProperty>),
788 ViewAttributeProperty(Box<ViewAttributeProperty>),
789 VolatileProperty(Box<VolatileProperty>),
790 WithDataProperty(Box<WithDataProperty>),
791 WithJournalTableProperty(Box<WithJournalTableProperty>),
792 WithSchemaBindingProperty(Box<WithSchemaBindingProperty>),
793 WithSystemVersioningProperty(Box<WithSystemVersioningProperty>),
794 WithProcedureOptions(Box<WithProcedureOptions>),
795 EncodeProperty(Box<EncodeProperty>),
796 IncludeProperty(Box<IncludeProperty>),
797 Properties(Box<Properties>),
798 OptionsProperty(Box<OptionsProperty>),
799 InputOutputFormat(Box<InputOutputFormat>),
800 Reference(Box<Reference>),
801 QueryOption(Box<QueryOption>),
802 WithTableHint(Box<WithTableHint>),
803 IndexTableHint(Box<IndexTableHint>),
804 HistoricalData(Box<HistoricalData>),
805 Get(Box<Get>),
806 SetOperation(Box<SetOperation>),
807 Var(Box<Var>),
808 Variadic(Box<Variadic>),
809 Version(Box<Version>),
810 Schema(Box<Schema>),
811 Lock(Box<Lock>),
812 TableSample(Box<TableSample>),
813 Tag(Box<Tag>),
814 UnpivotColumns(Box<UnpivotColumns>),
815 WindowSpec(Box<WindowSpec>),
816 SessionParameter(Box<SessionParameter>),
817 PseudoType(Box<PseudoType>),
818 ObjectIdentifier(Box<ObjectIdentifier>),
819 Transaction(Box<Transaction>),
820 Commit(Box<Commit>),
821 Rollback(Box<Rollback>),
822 AlterSession(Box<AlterSession>),
823 Analyze(Box<Analyze>),
824 AnalyzeStatistics(Box<AnalyzeStatistics>),
825 AnalyzeHistogram(Box<AnalyzeHistogram>),
826 AnalyzeSample(Box<AnalyzeSample>),
827 AnalyzeListChainedRows(Box<AnalyzeListChainedRows>),
828 AnalyzeDelete(Box<AnalyzeDelete>),
829 AnalyzeWith(Box<AnalyzeWith>),
830 AnalyzeValidate(Box<AnalyzeValidate>),
831 AddPartition(Box<AddPartition>),
832 AttachOption(Box<AttachOption>),
833 DropPartition(Box<DropPartition>),
834 ReplacePartition(Box<ReplacePartition>),
835 DPipe(Box<DPipe>),
836 Operator(Box<Operator>),
837 PivotAny(Box<PivotAny>),
838 Aliases(Box<Aliases>),
839 AtIndex(Box<AtIndex>),
840 FromTimeZone(Box<FromTimeZone>),
841 FormatPhrase(Box<FormatPhrase>),
842 ForIn(Box<ForIn>),
843 TimeUnit(Box<TimeUnit>),
844 IntervalOp(Box<IntervalOp>),
845 IntervalSpan(Box<IntervalSpan>),
846 HavingMax(Box<HavingMax>),
847 CosineDistance(Box<CosineDistance>),
848 DotProduct(Box<DotProduct>),
849 EuclideanDistance(Box<EuclideanDistance>),
850 ManhattanDistance(Box<ManhattanDistance>),
851 JarowinklerSimilarity(Box<JarowinklerSimilarity>),
852 Booland(Box<Booland>),
853 Boolor(Box<Boolor>),
854 ParameterizedAgg(Box<ParameterizedAgg>),
855 ArgMax(Box<ArgMax>),
856 ArgMin(Box<ArgMin>),
857 ApproxTopK(Box<ApproxTopK>),
858 ApproxTopKAccumulate(Box<ApproxTopKAccumulate>),
859 ApproxTopKCombine(Box<ApproxTopKCombine>),
860 ApproxTopKEstimate(Box<ApproxTopKEstimate>),
861 ApproxTopSum(Box<ApproxTopSum>),
862 ApproxQuantiles(Box<ApproxQuantiles>),
863 Minhash(Box<Minhash>),
864 FarmFingerprint(Box<FarmFingerprint>),
865 Float64(Box<Float64>),
866 Transform(Box<Transform>),
867 Translate(Box<Translate>),
868 Grouping(Box<Grouping>),
869 GroupingId(Box<GroupingId>),
870 Anonymous(Box<Anonymous>),
871 AnonymousAggFunc(Box<AnonymousAggFunc>),
872 CombinedAggFunc(Box<CombinedAggFunc>),
873 CombinedParameterizedAgg(Box<CombinedParameterizedAgg>),
874 HashAgg(Box<HashAgg>),
875 Hll(Box<Hll>),
876 Apply(Box<Apply>),
877 ToBoolean(Box<ToBoolean>),
878 List(Box<List>),
879 ToMap(Box<ToMap>),
880 Pad(Box<Pad>),
881 ToChar(Box<ToChar>),
882 ToNumber(Box<ToNumber>),
883 ToDouble(Box<ToDouble>),
884 Int64(Box<UnaryFunc>),
885 StringFunc(Box<StringFunc>),
886 ToDecfloat(Box<ToDecfloat>),
887 TryToDecfloat(Box<TryToDecfloat>),
888 ToFile(Box<ToFile>),
889 Columns(Box<Columns>),
890 ConvertToCharset(Box<ConvertToCharset>),
891 ConvertTimezone(Box<ConvertTimezone>),
892 GenerateSeries(Box<GenerateSeries>),
893 AIAgg(Box<AIAgg>),
894 AIClassify(Box<AIClassify>),
895 ArrayAll(Box<ArrayAll>),
896 ArrayAny(Box<ArrayAny>),
897 ArrayConstructCompact(Box<ArrayConstructCompact>),
898 StPoint(Box<StPoint>),
899 StDistance(Box<StDistance>),
900 StringToArray(Box<StringToArray>),
901 ArraySum(Box<ArraySum>),
902 ObjectAgg(Box<ObjectAgg>),
903 CastToStrType(Box<CastToStrType>),
904 CheckJson(Box<CheckJson>),
905 CheckXml(Box<CheckXml>),
906 TranslateCharacters(Box<TranslateCharacters>),
907 CurrentSchemas(Box<CurrentSchemas>),
908 CurrentDatetime(Box<CurrentDatetime>),
909 Localtime(Box<Localtime>),
910 Localtimestamp(Box<Localtimestamp>),
911 Systimestamp(Box<Systimestamp>),
912 CurrentSchema(Box<CurrentSchema>),
913 CurrentUser(Box<CurrentUser>),
914 UtcTime(Box<UtcTime>),
915 UtcTimestamp(Box<UtcTimestamp>),
916 Timestamp(Box<TimestampFunc>),
917 DateBin(Box<DateBin>),
918 Datetime(Box<Datetime>),
919 DatetimeAdd(Box<DatetimeAdd>),
920 DatetimeSub(Box<DatetimeSub>),
921 DatetimeDiff(Box<DatetimeDiff>),
922 DatetimeTrunc(Box<DatetimeTrunc>),
923 Dayname(Box<Dayname>),
924 MakeInterval(Box<MakeInterval>),
925 PreviousDay(Box<PreviousDay>),
926 Elt(Box<Elt>),
927 TimestampAdd(Box<TimestampAdd>),
928 TimestampSub(Box<TimestampSub>),
929 TimestampDiff(Box<TimestampDiff>),
930 TimeSlice(Box<TimeSlice>),
931 TimeAdd(Box<TimeAdd>),
932 TimeSub(Box<TimeSub>),
933 TimeDiff(Box<TimeDiff>),
934 TimeTrunc(Box<TimeTrunc>),
935 DateFromParts(Box<DateFromParts>),
936 TimeFromParts(Box<TimeFromParts>),
937 DecodeCase(Box<DecodeCase>),
938 Decrypt(Box<Decrypt>),
939 DecryptRaw(Box<DecryptRaw>),
940 Encode(Box<Encode>),
941 Encrypt(Box<Encrypt>),
942 EncryptRaw(Box<EncryptRaw>),
943 EqualNull(Box<EqualNull>),
944 ToBinary(Box<ToBinary>),
945 Base64DecodeBinary(Box<Base64DecodeBinary>),
946 Base64DecodeString(Box<Base64DecodeString>),
947 Base64Encode(Box<Base64Encode>),
948 TryBase64DecodeBinary(Box<TryBase64DecodeBinary>),
949 TryBase64DecodeString(Box<TryBase64DecodeString>),
950 GapFill(Box<GapFill>),
951 GenerateDateArray(Box<GenerateDateArray>),
952 GenerateTimestampArray(Box<GenerateTimestampArray>),
953 GetExtract(Box<GetExtract>),
954 Getbit(Box<Getbit>),
955 OverflowTruncateBehavior(Box<OverflowTruncateBehavior>),
956 HexEncode(Box<HexEncode>),
957 Compress(Box<Compress>),
958 DecompressBinary(Box<DecompressBinary>),
959 DecompressString(Box<DecompressString>),
960 Xor(Box<Xor>),
961 Nullif(Box<Nullif>),
962 JSON(Box<JSON>),
963 JSONPath(Box<JSONPath>),
964 JSONPathFilter(Box<JSONPathFilter>),
965 JSONPathKey(Box<JSONPathKey>),
966 JSONPathRecursive(Box<JSONPathRecursive>),
967 JSONPathScript(Box<JSONPathScript>),
968 JSONPathSlice(Box<JSONPathSlice>),
969 JSONPathSelector(Box<JSONPathSelector>),
970 JSONPathSubscript(Box<JSONPathSubscript>),
971 JSONPathUnion(Box<JSONPathUnion>),
972 Format(Box<Format>),
973 JSONKeys(Box<JSONKeys>),
974 JSONKeyValue(Box<JSONKeyValue>),
975 JSONKeysAtDepth(Box<JSONKeysAtDepth>),
976 JSONObject(Box<JSONObject>),
977 JSONObjectAgg(Box<JSONObjectAgg>),
978 JSONBObjectAgg(Box<JSONBObjectAgg>),
979 JSONArray(Box<JSONArray>),
980 JSONArrayAgg(Box<JSONArrayAgg>),
981 JSONExists(Box<JSONExists>),
982 JSONColumnDef(Box<JSONColumnDef>),
983 JSONSchema(Box<JSONSchema>),
984 JSONSet(Box<JSONSet>),
985 JSONStripNulls(Box<JSONStripNulls>),
986 JSONValue(Box<JSONValue>),
987 JSONValueArray(Box<JSONValueArray>),
988 JSONRemove(Box<JSONRemove>),
989 JSONTable(Box<JSONTable>),
990 JSONType(Box<JSONType>),
991 ObjectInsert(Box<ObjectInsert>),
992 OpenJSONColumnDef(Box<OpenJSONColumnDef>),
993 OpenJSON(Box<OpenJSON>),
994 JSONBExists(Box<JSONBExists>),
995 JSONBContains(Box<BinaryFunc>),
996 JSONBExtract(Box<BinaryFunc>),
997 JSONCast(Box<JSONCast>),
998 JSONExtract(Box<JSONExtract>),
999 JSONExtractQuote(Box<JSONExtractQuote>),
1000 JSONExtractArray(Box<JSONExtractArray>),
1001 JSONExtractScalar(Box<JSONExtractScalar>),
1002 JSONBExtractScalar(Box<JSONBExtractScalar>),
1003 JSONFormat(Box<JSONFormat>),
1004 JSONBool(Box<UnaryFunc>),
1005 JSONPathRoot(JSONPathRoot),
1006 JSONArrayAppend(Box<JSONArrayAppend>),
1007 JSONArrayContains(Box<JSONArrayContains>),
1008 JSONArrayInsert(Box<JSONArrayInsert>),
1009 ParseJSON(Box<ParseJSON>),
1010 ParseUrl(Box<ParseUrl>),
1011 ParseIp(Box<ParseIp>),
1012 ParseTime(Box<ParseTime>),
1013 ParseDatetime(Box<ParseDatetime>),
1014 Map(Box<Map>),
1015 MapCat(Box<MapCat>),
1016 MapDelete(Box<MapDelete>),
1017 MapInsert(Box<MapInsert>),
1018 MapPick(Box<MapPick>),
1019 ScopeResolution(Box<ScopeResolution>),
1020 Slice(Box<Slice>),
1021 VarMap(Box<VarMap>),
1022 MatchAgainst(Box<MatchAgainst>),
1023 MD5Digest(Box<MD5Digest>),
1024 MD5NumberLower64(Box<UnaryFunc>),
1025 MD5NumberUpper64(Box<UnaryFunc>),
1026 Monthname(Box<Monthname>),
1027 Ntile(Box<Ntile>),
1028 Normalize(Box<Normalize>),
1029 Normal(Box<Normal>),
1030 Predict(Box<Predict>),
1031 MLTranslate(Box<MLTranslate>),
1032 FeaturesAtTime(Box<FeaturesAtTime>),
1033 GenerateEmbedding(Box<GenerateEmbedding>),
1034 MLForecast(Box<MLForecast>),
1035 ModelAttribute(Box<ModelAttribute>),
1036 VectorSearch(Box<VectorSearch>),
1037 Quantile(Box<Quantile>),
1038 ApproxQuantile(Box<ApproxQuantile>),
1039 ApproxPercentileEstimate(Box<ApproxPercentileEstimate>),
1040 Randn(Box<Randn>),
1041 Randstr(Box<Randstr>),
1042 RangeN(Box<RangeN>),
1043 RangeBucket(Box<RangeBucket>),
1044 ReadCSV(Box<ReadCSV>),
1045 ReadParquet(Box<ReadParquet>),
1046 Reduce(Box<Reduce>),
1047 RegexpExtractAll(Box<RegexpExtractAll>),
1048 RegexpILike(Box<RegexpILike>),
1049 RegexpFullMatch(Box<RegexpFullMatch>),
1050 RegexpInstr(Box<RegexpInstr>),
1051 RegexpSplit(Box<RegexpSplit>),
1052 RegexpCount(Box<RegexpCount>),
1053 RegrValx(Box<RegrValx>),
1054 RegrValy(Box<RegrValy>),
1055 RegrAvgy(Box<RegrAvgy>),
1056 RegrAvgx(Box<RegrAvgx>),
1057 RegrCount(Box<RegrCount>),
1058 RegrIntercept(Box<RegrIntercept>),
1059 RegrR2(Box<RegrR2>),
1060 RegrSxx(Box<RegrSxx>),
1061 RegrSxy(Box<RegrSxy>),
1062 RegrSyy(Box<RegrSyy>),
1063 RegrSlope(Box<RegrSlope>),
1064 SafeAdd(Box<SafeAdd>),
1065 SafeDivide(Box<SafeDivide>),
1066 SafeMultiply(Box<SafeMultiply>),
1067 SafeSubtract(Box<SafeSubtract>),
1068 SHA2(Box<SHA2>),
1069 SHA2Digest(Box<SHA2Digest>),
1070 SortArray(Box<SortArray>),
1071 SplitPart(Box<SplitPart>),
1072 SubstringIndex(Box<SubstringIndex>),
1073 StandardHash(Box<StandardHash>),
1074 StrPosition(Box<StrPosition>),
1075 Search(Box<Search>),
1076 SearchIp(Box<SearchIp>),
1077 StrToDate(Box<StrToDate>),
1078 DateStrToDate(Box<UnaryFunc>),
1079 DateToDateStr(Box<UnaryFunc>),
1080 StrToTime(Box<StrToTime>),
1081 StrToUnix(Box<StrToUnix>),
1082 StrToMap(Box<StrToMap>),
1083 NumberToStr(Box<NumberToStr>),
1084 FromBase(Box<FromBase>),
1085 Stuff(Box<Stuff>),
1086 TimeToStr(Box<TimeToStr>),
1087 TimeStrToTime(Box<TimeStrToTime>),
1088 TsOrDsAdd(Box<TsOrDsAdd>),
1089 TsOrDsDiff(Box<TsOrDsDiff>),
1090 TsOrDsToDate(Box<TsOrDsToDate>),
1091 TsOrDsToTime(Box<TsOrDsToTime>),
1092 Unhex(Box<Unhex>),
1093 Uniform(Box<Uniform>),
1094 UnixToStr(Box<UnixToStr>),
1095 UnixToTime(Box<UnixToTime>),
1096 Uuid(Box<Uuid>),
1097 TimestampFromParts(Box<TimestampFromParts>),
1098 TimestampTzFromParts(Box<TimestampTzFromParts>),
1099 Corr(Box<Corr>),
1100 WidthBucket(Box<WidthBucket>),
1101 CovarSamp(Box<CovarSamp>),
1102 CovarPop(Box<CovarPop>),
1103 Week(Box<Week>),
1104 XMLElement(Box<XMLElement>),
1105 XMLGet(Box<XMLGet>),
1106 XMLTable(Box<XMLTable>),
1107 XMLKeyValueOption(Box<XMLKeyValueOption>),
1108 Zipf(Box<Zipf>),
1109 Merge(Box<Merge>),
1110 When(Box<When>),
1111 Whens(Box<Whens>),
1112 NextValueFor(Box<NextValueFor>),
1113 ReturnStmt(Box<Expression>),
1115}
1116
1117impl Expression {
1118 #[inline]
1120 pub fn boxed_column(col: Column) -> Self {
1121 Expression::Column(Box::new(col))
1122 }
1123
1124 #[inline]
1126 pub fn boxed_table(t: TableRef) -> Self {
1127 Expression::Table(Box::new(t))
1128 }
1129
1130 pub fn is_statement(&self) -> bool {
1137 match self {
1138 Expression::Select(_)
1140 | Expression::Union(_)
1141 | Expression::Intersect(_)
1142 | Expression::Except(_)
1143 | Expression::Subquery(_)
1144 | Expression::Values(_)
1145 | Expression::PipeOperator(_)
1146
1147 | Expression::Insert(_)
1149 | Expression::Update(_)
1150 | Expression::Delete(_)
1151 | Expression::Copy(_)
1152 | Expression::Put(_)
1153 | Expression::Merge(_)
1154 | Expression::TryCatch(_)
1155
1156 | Expression::CreateTable(_)
1158 | Expression::DropTable(_)
1159 | Expression::Undrop(_)
1160 | Expression::AlterTable(_)
1161 | Expression::SplitTable(_)
1162 | Expression::FlashbackTable(_)
1163 | Expression::CreateIndex(_)
1164 | Expression::DropIndex(_)
1165 | Expression::CreateView(_)
1166 | Expression::DropView(_)
1167 | Expression::AlterView(_)
1168 | Expression::AlterIndex(_)
1169 | Expression::Truncate(_)
1170 | Expression::TruncateTable(_)
1171 | Expression::CreateSchema(_)
1172 | Expression::DropSchema(_)
1173 | Expression::DropNamespace(_)
1174 | Expression::CreateDatabase(_)
1175 | Expression::DropDatabase(_)
1176 | Expression::CreateFunction(_)
1177 | Expression::DropFunction(_)
1178 | Expression::CreateProcedure(_)
1179 | Expression::DropProcedure(_)
1180 | Expression::CreateSequence(_)
1181 | Expression::CreateSynonym(_)
1182 | Expression::DropSequence(_)
1183 | Expression::AlterSequence(_)
1184 | Expression::CreateTrigger(_)
1185 | Expression::DropTrigger(_)
1186 | Expression::CreateType(_)
1187 | Expression::DropType(_)
1188 | Expression::Comment(_)
1189
1190 | Expression::Use(_)
1192 | Expression::Set(_)
1193 | Expression::SetStatement(_)
1194 | Expression::Transaction(_)
1195 | Expression::Commit(_)
1196 | Expression::Rollback(_)
1197 | Expression::Grant(_)
1198 | Expression::Revoke(_)
1199 | Expression::Cache(_)
1200 | Expression::Uncache(_)
1201 | Expression::LoadData(_)
1202 | Expression::Pragma(_)
1203 | Expression::Describe(_)
1204 | Expression::Show(_)
1205 | Expression::Kill(_)
1206 | Expression::Prepare(_)
1207 | Expression::Execute(_)
1208 | Expression::Declare(_)
1209 | Expression::Refresh(_)
1210 | Expression::AlterSession(_)
1211 | Expression::LockingStatement(_)
1212
1213 | Expression::Analyze(_)
1215 | Expression::AnalyzeStatistics(_)
1216 | Expression::AnalyzeHistogram(_)
1217 | Expression::AnalyzeSample(_)
1218 | Expression::AnalyzeListChainedRows(_)
1219 | Expression::AnalyzeDelete(_)
1220
1221 | Expression::Attach(_)
1223 | Expression::Detach(_)
1224 | Expression::Install(_)
1225 | Expression::Summarize(_)
1226
1227 | Expression::Pivot(_)
1229 | Expression::Unpivot(_)
1230
1231 | Expression::Command(_)
1233 | Expression::Raw(_)
1234 | Expression::CreateTask(_)
1235
1236 | Expression::ReturnStmt(_) => true,
1238
1239 Expression::Annotated(a) => a.this.is_statement(),
1241
1242 Expression::Alias(a) => a.this.is_statement(),
1244
1245 _ => false,
1247 }
1248 }
1249
1250 pub fn number(n: i64) -> Self {
1252 Expression::Literal(Box::new(Literal::Number(n.to_string())))
1253 }
1254
1255 pub fn string(s: impl Into<String>) -> Self {
1257 Expression::Literal(Box::new(Literal::String(s.into())))
1258 }
1259
1260 pub fn float(f: f64) -> Self {
1262 Expression::Literal(Box::new(Literal::Number(f.to_string())))
1263 }
1264
1265 pub fn inferred_type(&self) -> Option<&DataType> {
1271 match self {
1272 Expression::And(op)
1274 | Expression::Or(op)
1275 | Expression::Add(op)
1276 | Expression::Sub(op)
1277 | Expression::Mul(op)
1278 | Expression::Div(op)
1279 | Expression::Mod(op)
1280 | Expression::Eq(op)
1281 | Expression::Neq(op)
1282 | Expression::Lt(op)
1283 | Expression::Lte(op)
1284 | Expression::Gt(op)
1285 | Expression::Gte(op)
1286 | Expression::Concat(op)
1287 | Expression::BitwiseAnd(op)
1288 | Expression::BitwiseOr(op)
1289 | Expression::BitwiseXor(op)
1290 | Expression::Adjacent(op)
1291 | Expression::TsMatch(op)
1292 | Expression::PropertyEQ(op)
1293 | Expression::ArrayContainsAll(op)
1294 | Expression::ArrayContainedBy(op)
1295 | Expression::ArrayOverlaps(op)
1296 | Expression::JSONBContainsAllTopKeys(op)
1297 | Expression::JSONBContainsAnyTopKeys(op)
1298 | Expression::JSONBDeleteAtPath(op)
1299 | Expression::ExtendsLeft(op)
1300 | Expression::ExtendsRight(op)
1301 | Expression::Is(op)
1302 | Expression::MemberOf(op)
1303 | Expression::Match(op)
1304 | Expression::NullSafeEq(op)
1305 | Expression::NullSafeNeq(op)
1306 | Expression::Glob(op)
1307 | Expression::BitwiseLeftShift(op)
1308 | Expression::BitwiseRightShift(op) => op.inferred_type.as_ref(),
1309
1310 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1311 op.inferred_type.as_ref()
1312 }
1313
1314 Expression::Like(op) | Expression::ILike(op) => op.inferred_type.as_ref(),
1315
1316 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1317 c.inferred_type.as_ref()
1318 }
1319
1320 Expression::Column(c) => c.inferred_type.as_ref(),
1321 Expression::Function(f) => f.inferred_type.as_ref(),
1322 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1323 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1324 Expression::Case(c) => c.inferred_type.as_ref(),
1325 Expression::Subquery(s) => s.inferred_type.as_ref(),
1326 Expression::Alias(a) => a.inferred_type.as_ref(),
1327 Expression::Unnest(u) => u.inferred_type.as_ref(),
1328 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1329 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1330 Expression::Count(f) => f.inferred_type.as_ref(),
1331 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1332 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1333 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1334 Expression::SumIf(f) => f.inferred_type.as_ref(),
1335
1336 Expression::Upper(f)
1338 | Expression::Lower(f)
1339 | Expression::Length(f)
1340 | Expression::LTrim(f)
1341 | Expression::RTrim(f)
1342 | Expression::Reverse(f)
1343 | Expression::Abs(f)
1344 | Expression::Sqrt(f)
1345 | Expression::Cbrt(f)
1346 | Expression::Ln(f)
1347 | Expression::Exp(f)
1348 | Expression::Sign(f)
1349 | Expression::Date(f)
1350 | Expression::Time(f)
1351 | Expression::Initcap(f)
1352 | Expression::Ascii(f)
1353 | Expression::Chr(f)
1354 | Expression::Soundex(f)
1355 | Expression::ByteLength(f)
1356 | Expression::Hex(f)
1357 | Expression::LowerHex(f)
1358 | Expression::Unicode(f)
1359 | Expression::Typeof(f)
1360 | Expression::Explode(f)
1361 | Expression::ExplodeOuter(f)
1362 | Expression::MapFromEntries(f)
1363 | Expression::MapKeys(f)
1364 | Expression::MapValues(f)
1365 | Expression::ArrayLength(f)
1366 | Expression::ArraySize(f)
1367 | Expression::Cardinality(f)
1368 | Expression::ArrayReverse(f)
1369 | Expression::ArrayDistinct(f)
1370 | Expression::ArrayFlatten(f)
1371 | Expression::ArrayCompact(f)
1372 | Expression::ToArray(f)
1373 | Expression::JsonArrayLength(f)
1374 | Expression::JsonKeys(f)
1375 | Expression::JsonType(f)
1376 | Expression::ParseJson(f)
1377 | Expression::ToJson(f)
1378 | Expression::Radians(f)
1379 | Expression::Degrees(f)
1380 | Expression::Sin(f)
1381 | Expression::Cos(f)
1382 | Expression::Tan(f)
1383 | Expression::Asin(f)
1384 | Expression::Acos(f)
1385 | Expression::Atan(f)
1386 | Expression::IsNan(f)
1387 | Expression::IsInf(f)
1388 | Expression::Year(f)
1389 | Expression::Month(f)
1390 | Expression::Day(f)
1391 | Expression::Hour(f)
1392 | Expression::Minute(f)
1393 | Expression::Second(f)
1394 | Expression::DayOfWeek(f)
1395 | Expression::DayOfWeekIso(f)
1396 | Expression::DayOfMonth(f)
1397 | Expression::DayOfYear(f)
1398 | Expression::WeekOfYear(f)
1399 | Expression::Quarter(f)
1400 | Expression::Epoch(f)
1401 | Expression::EpochMs(f)
1402 | Expression::BitwiseCount(f)
1403 | Expression::DateFromUnixDate(f)
1404 | Expression::UnixDate(f)
1405 | Expression::UnixSeconds(f)
1406 | Expression::UnixMillis(f)
1407 | Expression::UnixMicros(f)
1408 | Expression::TimeStrToDate(f)
1409 | Expression::DateToDi(f)
1410 | Expression::DiToDate(f)
1411 | Expression::TsOrDiToDi(f)
1412 | Expression::TsOrDsToDatetime(f)
1413 | Expression::TsOrDsToTimestamp(f)
1414 | Expression::YearOfWeek(f)
1415 | Expression::YearOfWeekIso(f)
1416 | Expression::SHA(f)
1417 | Expression::SHA1Digest(f)
1418 | Expression::TimeToUnix(f)
1419 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1420
1421 Expression::Power(f)
1423 | Expression::NullIf(f)
1424 | Expression::IfNull(f)
1425 | Expression::Nvl(f)
1426 | Expression::Contains(f)
1427 | Expression::StartsWith(f)
1428 | Expression::EndsWith(f)
1429 | Expression::Levenshtein(f)
1430 | Expression::ModFunc(f)
1431 | Expression::IntDiv(f)
1432 | Expression::Atan2(f)
1433 | Expression::AddMonths(f)
1434 | Expression::MonthsBetween(f)
1435 | Expression::NextDay(f)
1436 | Expression::UnixToTimeStr(f)
1437 | Expression::ArrayContains(f)
1438 | Expression::ArrayPosition(f)
1439 | Expression::ArrayAppend(f)
1440 | Expression::ArrayPrepend(f)
1441 | Expression::ArrayUnion(f)
1442 | Expression::ArrayExcept(f)
1443 | Expression::ArrayRemove(f)
1444 | Expression::StarMap(f)
1445 | Expression::MapFromArrays(f)
1446 | Expression::MapContainsKey(f)
1447 | Expression::ElementAt(f)
1448 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1449
1450 Expression::Coalesce(f)
1452 | Expression::Greatest(f)
1453 | Expression::Least(f)
1454 | Expression::ArrayConcat(f)
1455 | Expression::ArrayIntersect(f)
1456 | Expression::ArrayZip(f)
1457 | Expression::MapConcat(f)
1458 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1459
1460 Expression::Sum(f)
1462 | Expression::Avg(f)
1463 | Expression::Min(f)
1464 | Expression::Max(f)
1465 | Expression::ArrayAgg(f)
1466 | Expression::CountIf(f)
1467 | Expression::Stddev(f)
1468 | Expression::StddevPop(f)
1469 | Expression::StddevSamp(f)
1470 | Expression::Variance(f)
1471 | Expression::VarPop(f)
1472 | Expression::VarSamp(f)
1473 | Expression::Median(f)
1474 | Expression::Mode(f)
1475 | Expression::First(f)
1476 | Expression::Last(f)
1477 | Expression::AnyValue(f)
1478 | Expression::ApproxDistinct(f)
1479 | Expression::ApproxCountDistinct(f)
1480 | Expression::LogicalAnd(f)
1481 | Expression::LogicalOr(f)
1482 | Expression::Skewness(f)
1483 | Expression::ArrayConcatAgg(f)
1484 | Expression::ArrayUniqueAgg(f)
1485 | Expression::BoolXorAgg(f)
1486 | Expression::BitwiseAndAgg(f)
1487 | Expression::BitwiseOrAgg(f)
1488 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1489
1490 _ => None,
1492 }
1493 }
1494
1495 pub fn set_inferred_type(&mut self, dt: DataType) {
1500 match self {
1501 Expression::And(op)
1502 | Expression::Or(op)
1503 | Expression::Add(op)
1504 | Expression::Sub(op)
1505 | Expression::Mul(op)
1506 | Expression::Div(op)
1507 | Expression::Mod(op)
1508 | Expression::Eq(op)
1509 | Expression::Neq(op)
1510 | Expression::Lt(op)
1511 | Expression::Lte(op)
1512 | Expression::Gt(op)
1513 | Expression::Gte(op)
1514 | Expression::Concat(op)
1515 | Expression::BitwiseAnd(op)
1516 | Expression::BitwiseOr(op)
1517 | Expression::BitwiseXor(op)
1518 | Expression::Adjacent(op)
1519 | Expression::TsMatch(op)
1520 | Expression::PropertyEQ(op)
1521 | Expression::ArrayContainsAll(op)
1522 | Expression::ArrayContainedBy(op)
1523 | Expression::ArrayOverlaps(op)
1524 | Expression::JSONBContainsAllTopKeys(op)
1525 | Expression::JSONBContainsAnyTopKeys(op)
1526 | Expression::JSONBDeleteAtPath(op)
1527 | Expression::ExtendsLeft(op)
1528 | Expression::ExtendsRight(op)
1529 | Expression::Is(op)
1530 | Expression::MemberOf(op)
1531 | Expression::Match(op)
1532 | Expression::NullSafeEq(op)
1533 | Expression::NullSafeNeq(op)
1534 | Expression::Glob(op)
1535 | Expression::BitwiseLeftShift(op)
1536 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1537
1538 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1539 op.inferred_type = Some(dt)
1540 }
1541
1542 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1543
1544 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1545 c.inferred_type = Some(dt)
1546 }
1547
1548 Expression::Column(c) => c.inferred_type = Some(dt),
1549 Expression::Function(f) => f.inferred_type = Some(dt),
1550 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1551 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1552 Expression::Case(c) => c.inferred_type = Some(dt),
1553 Expression::Subquery(s) => s.inferred_type = Some(dt),
1554 Expression::Alias(a) => a.inferred_type = Some(dt),
1555 Expression::Unnest(u) => u.inferred_type = Some(dt),
1556 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1557 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1558 Expression::Count(f) => f.inferred_type = Some(dt),
1559 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1560 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1561 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1562 Expression::SumIf(f) => f.inferred_type = Some(dt),
1563
1564 Expression::Upper(f)
1566 | Expression::Lower(f)
1567 | Expression::Length(f)
1568 | Expression::LTrim(f)
1569 | Expression::RTrim(f)
1570 | Expression::Reverse(f)
1571 | Expression::Abs(f)
1572 | Expression::Sqrt(f)
1573 | Expression::Cbrt(f)
1574 | Expression::Ln(f)
1575 | Expression::Exp(f)
1576 | Expression::Sign(f)
1577 | Expression::Date(f)
1578 | Expression::Time(f)
1579 | Expression::Initcap(f)
1580 | Expression::Ascii(f)
1581 | Expression::Chr(f)
1582 | Expression::Soundex(f)
1583 | Expression::ByteLength(f)
1584 | Expression::Hex(f)
1585 | Expression::LowerHex(f)
1586 | Expression::Unicode(f)
1587 | Expression::Typeof(f)
1588 | Expression::Explode(f)
1589 | Expression::ExplodeOuter(f)
1590 | Expression::MapFromEntries(f)
1591 | Expression::MapKeys(f)
1592 | Expression::MapValues(f)
1593 | Expression::ArrayLength(f)
1594 | Expression::ArraySize(f)
1595 | Expression::Cardinality(f)
1596 | Expression::ArrayReverse(f)
1597 | Expression::ArrayDistinct(f)
1598 | Expression::ArrayFlatten(f)
1599 | Expression::ArrayCompact(f)
1600 | Expression::ToArray(f)
1601 | Expression::JsonArrayLength(f)
1602 | Expression::JsonKeys(f)
1603 | Expression::JsonType(f)
1604 | Expression::ParseJson(f)
1605 | Expression::ToJson(f)
1606 | Expression::Radians(f)
1607 | Expression::Degrees(f)
1608 | Expression::Sin(f)
1609 | Expression::Cos(f)
1610 | Expression::Tan(f)
1611 | Expression::Asin(f)
1612 | Expression::Acos(f)
1613 | Expression::Atan(f)
1614 | Expression::IsNan(f)
1615 | Expression::IsInf(f)
1616 | Expression::Year(f)
1617 | Expression::Month(f)
1618 | Expression::Day(f)
1619 | Expression::Hour(f)
1620 | Expression::Minute(f)
1621 | Expression::Second(f)
1622 | Expression::DayOfWeek(f)
1623 | Expression::DayOfWeekIso(f)
1624 | Expression::DayOfMonth(f)
1625 | Expression::DayOfYear(f)
1626 | Expression::WeekOfYear(f)
1627 | Expression::Quarter(f)
1628 | Expression::Epoch(f)
1629 | Expression::EpochMs(f)
1630 | Expression::BitwiseCount(f)
1631 | Expression::DateFromUnixDate(f)
1632 | Expression::UnixDate(f)
1633 | Expression::UnixSeconds(f)
1634 | Expression::UnixMillis(f)
1635 | Expression::UnixMicros(f)
1636 | Expression::TimeStrToDate(f)
1637 | Expression::DateToDi(f)
1638 | Expression::DiToDate(f)
1639 | Expression::TsOrDiToDi(f)
1640 | Expression::TsOrDsToDatetime(f)
1641 | Expression::TsOrDsToTimestamp(f)
1642 | Expression::YearOfWeek(f)
1643 | Expression::YearOfWeekIso(f)
1644 | Expression::SHA(f)
1645 | Expression::SHA1Digest(f)
1646 | Expression::TimeToUnix(f)
1647 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1648
1649 Expression::Power(f)
1651 | Expression::NullIf(f)
1652 | Expression::IfNull(f)
1653 | Expression::Nvl(f)
1654 | Expression::Contains(f)
1655 | Expression::StartsWith(f)
1656 | Expression::EndsWith(f)
1657 | Expression::Levenshtein(f)
1658 | Expression::ModFunc(f)
1659 | Expression::IntDiv(f)
1660 | Expression::Atan2(f)
1661 | Expression::AddMonths(f)
1662 | Expression::MonthsBetween(f)
1663 | Expression::NextDay(f)
1664 | Expression::UnixToTimeStr(f)
1665 | Expression::ArrayContains(f)
1666 | Expression::ArrayPosition(f)
1667 | Expression::ArrayAppend(f)
1668 | Expression::ArrayPrepend(f)
1669 | Expression::ArrayUnion(f)
1670 | Expression::ArrayExcept(f)
1671 | Expression::ArrayRemove(f)
1672 | Expression::StarMap(f)
1673 | Expression::MapFromArrays(f)
1674 | Expression::MapContainsKey(f)
1675 | Expression::ElementAt(f)
1676 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1677
1678 Expression::Coalesce(f)
1680 | Expression::Greatest(f)
1681 | Expression::Least(f)
1682 | Expression::ArrayConcat(f)
1683 | Expression::ArrayIntersect(f)
1684 | Expression::ArrayZip(f)
1685 | Expression::MapConcat(f)
1686 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1687
1688 Expression::Sum(f)
1690 | Expression::Avg(f)
1691 | Expression::Min(f)
1692 | Expression::Max(f)
1693 | Expression::ArrayAgg(f)
1694 | Expression::CountIf(f)
1695 | Expression::Stddev(f)
1696 | Expression::StddevPop(f)
1697 | Expression::StddevSamp(f)
1698 | Expression::Variance(f)
1699 | Expression::VarPop(f)
1700 | Expression::VarSamp(f)
1701 | Expression::Median(f)
1702 | Expression::Mode(f)
1703 | Expression::First(f)
1704 | Expression::Last(f)
1705 | Expression::AnyValue(f)
1706 | Expression::ApproxDistinct(f)
1707 | Expression::ApproxCountDistinct(f)
1708 | Expression::LogicalAnd(f)
1709 | Expression::LogicalOr(f)
1710 | Expression::Skewness(f)
1711 | Expression::ArrayConcatAgg(f)
1712 | Expression::ArrayUniqueAgg(f)
1713 | Expression::BoolXorAgg(f)
1714 | Expression::BitwiseAndAgg(f)
1715 | Expression::BitwiseOrAgg(f)
1716 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1717
1718 _ => {}
1720 }
1721 }
1722
1723 pub fn column(name: impl Into<String>) -> Self {
1725 Expression::Column(Box::new(Column {
1726 name: Identifier::new(name),
1727 table: None,
1728 join_mark: false,
1729 trailing_comments: Vec::new(),
1730 span: None,
1731 inferred_type: None,
1732 }))
1733 }
1734
1735 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1737 Expression::Column(Box::new(Column {
1738 name: Identifier::new(column),
1739 table: Some(Identifier::new(table)),
1740 join_mark: false,
1741 trailing_comments: Vec::new(),
1742 span: None,
1743 inferred_type: None,
1744 }))
1745 }
1746
1747 pub fn identifier(name: impl Into<String>) -> Self {
1749 Expression::Identifier(Identifier::new(name))
1750 }
1751
1752 pub fn null() -> Self {
1754 Expression::Null(Null)
1755 }
1756
1757 pub fn true_() -> Self {
1759 Expression::Boolean(BooleanLiteral { value: true })
1760 }
1761
1762 pub fn false_() -> Self {
1764 Expression::Boolean(BooleanLiteral { value: false })
1765 }
1766
1767 pub fn star() -> Self {
1769 Expression::Star(Star {
1770 table: None,
1771 except: None,
1772 replace: None,
1773 rename: None,
1774 trailing_comments: Vec::new(),
1775 span: None,
1776 })
1777 }
1778
1779 pub fn alias(self, name: impl Into<String>) -> Self {
1781 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1782 }
1783
1784 pub fn is_select(&self) -> bool {
1786 matches!(self, Expression::Select(_))
1787 }
1788
1789 pub fn as_select(&self) -> Option<&Select> {
1791 match self {
1792 Expression::Select(s) => Some(s),
1793 _ => None,
1794 }
1795 }
1796
1797 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1799 match self {
1800 Expression::Select(s) => Some(s),
1801 _ => None,
1802 }
1803 }
1804
1805 #[cfg(feature = "generate")]
1810 pub fn sql(&self) -> String {
1811 crate::generator::Generator::sql(self).unwrap_or_default()
1812 }
1813
1814 #[cfg(feature = "generate")]
1820 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1821 crate::generate(self, dialect).unwrap_or_default()
1822 }
1823}
1824
1825impl Expression {
1828 pub fn variant_name(&self) -> &'static str {
1831 match self {
1832 Expression::Literal(_) => "literal",
1833 Expression::Boolean(_) => "boolean",
1834 Expression::Null(_) => "null",
1835 Expression::Identifier(_) => "identifier",
1836 Expression::Column(_) => "column",
1837 Expression::Table(_) => "table",
1838 Expression::Star(_) => "star",
1839 Expression::BracedWildcard(_) => "braced_wildcard",
1840 Expression::Select(_) => "select",
1841 Expression::Union(_) => "union",
1842 Expression::Intersect(_) => "intersect",
1843 Expression::Except(_) => "except",
1844 Expression::Subquery(_) => "subquery",
1845 Expression::PipeOperator(_) => "pipe_operator",
1846 Expression::Pivot(_) => "pivot",
1847 Expression::PivotAlias(_) => "pivot_alias",
1848 Expression::Unpivot(_) => "unpivot",
1849 Expression::Values(_) => "values",
1850 Expression::PreWhere(_) => "pre_where",
1851 Expression::Stream(_) => "stream",
1852 Expression::UsingData(_) => "using_data",
1853 Expression::XmlNamespace(_) => "xml_namespace",
1854 Expression::Insert(_) => "insert",
1855 Expression::Update(_) => "update",
1856 Expression::Delete(_) => "delete",
1857 Expression::Copy(_) => "copy",
1858 Expression::Put(_) => "put",
1859 Expression::StageReference(_) => "stage_reference",
1860 Expression::Alias(_) => "alias",
1861 Expression::Cast(_) => "cast",
1862 Expression::Collation(_) => "collation",
1863 Expression::Case(_) => "case",
1864 Expression::And(_) => "and",
1865 Expression::Or(_) => "or",
1866 Expression::Add(_) => "add",
1867 Expression::Sub(_) => "sub",
1868 Expression::Mul(_) => "mul",
1869 Expression::Div(_) => "div",
1870 Expression::Mod(_) => "mod",
1871 Expression::Eq(_) => "eq",
1872 Expression::Neq(_) => "neq",
1873 Expression::Lt(_) => "lt",
1874 Expression::Lte(_) => "lte",
1875 Expression::Gt(_) => "gt",
1876 Expression::Gte(_) => "gte",
1877 Expression::Like(_) => "like",
1878 Expression::ILike(_) => "i_like",
1879 Expression::Match(_) => "match",
1880 Expression::BitwiseAnd(_) => "bitwise_and",
1881 Expression::BitwiseOr(_) => "bitwise_or",
1882 Expression::BitwiseXor(_) => "bitwise_xor",
1883 Expression::Concat(_) => "concat",
1884 Expression::Adjacent(_) => "adjacent",
1885 Expression::TsMatch(_) => "ts_match",
1886 Expression::PropertyEQ(_) => "property_e_q",
1887 Expression::ArrayContainsAll(_) => "array_contains_all",
1888 Expression::ArrayContainedBy(_) => "array_contained_by",
1889 Expression::ArrayOverlaps(_) => "array_overlaps",
1890 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1891 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1892 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1893 Expression::ExtendsLeft(_) => "extends_left",
1894 Expression::ExtendsRight(_) => "extends_right",
1895 Expression::Not(_) => "not",
1896 Expression::Neg(_) => "neg",
1897 Expression::BitwiseNot(_) => "bitwise_not",
1898 Expression::In(_) => "in",
1899 Expression::Between(_) => "between",
1900 Expression::IsNull(_) => "is_null",
1901 Expression::IsTrue(_) => "is_true",
1902 Expression::IsFalse(_) => "is_false",
1903 Expression::IsJson(_) => "is_json",
1904 Expression::Is(_) => "is",
1905 Expression::Exists(_) => "exists",
1906 Expression::MemberOf(_) => "member_of",
1907 Expression::Function(_) => "function",
1908 Expression::AggregateFunction(_) => "aggregate_function",
1909 Expression::WindowFunction(_) => "window_function",
1910 Expression::From(_) => "from",
1911 Expression::Join(_) => "join",
1912 Expression::JoinedTable(_) => "joined_table",
1913 Expression::Where(_) => "where",
1914 Expression::GroupBy(_) => "group_by",
1915 Expression::Having(_) => "having",
1916 Expression::OrderBy(_) => "order_by",
1917 Expression::Limit(_) => "limit",
1918 Expression::Offset(_) => "offset",
1919 Expression::Qualify(_) => "qualify",
1920 Expression::With(_) => "with",
1921 Expression::Cte(_) => "cte",
1922 Expression::DistributeBy(_) => "distribute_by",
1923 Expression::ClusterBy(_) => "cluster_by",
1924 Expression::SortBy(_) => "sort_by",
1925 Expression::LateralView(_) => "lateral_view",
1926 Expression::Hint(_) => "hint",
1927 Expression::Pseudocolumn(_) => "pseudocolumn",
1928 Expression::Connect(_) => "connect",
1929 Expression::Prior(_) => "prior",
1930 Expression::ConnectByRoot(_) => "connect_by_root",
1931 Expression::MatchRecognize(_) => "match_recognize",
1932 Expression::Ordered(_) => "ordered",
1933 Expression::Window(_) => "window",
1934 Expression::Over(_) => "over",
1935 Expression::WithinGroup(_) => "within_group",
1936 Expression::DataType(_) => "data_type",
1937 Expression::Array(_) => "array",
1938 Expression::Struct(_) => "struct",
1939 Expression::Tuple(_) => "tuple",
1940 Expression::Interval(_) => "interval",
1941 Expression::ConcatWs(_) => "concat_ws",
1942 Expression::Substring(_) => "substring",
1943 Expression::Upper(_) => "upper",
1944 Expression::Lower(_) => "lower",
1945 Expression::Length(_) => "length",
1946 Expression::Trim(_) => "trim",
1947 Expression::LTrim(_) => "l_trim",
1948 Expression::RTrim(_) => "r_trim",
1949 Expression::Replace(_) => "replace",
1950 Expression::Reverse(_) => "reverse",
1951 Expression::Left(_) => "left",
1952 Expression::Right(_) => "right",
1953 Expression::Repeat(_) => "repeat",
1954 Expression::Lpad(_) => "lpad",
1955 Expression::Rpad(_) => "rpad",
1956 Expression::Split(_) => "split",
1957 Expression::RegexpLike(_) => "regexp_like",
1958 Expression::RegexpReplace(_) => "regexp_replace",
1959 Expression::RegexpExtract(_) => "regexp_extract",
1960 Expression::Overlay(_) => "overlay",
1961 Expression::Abs(_) => "abs",
1962 Expression::Round(_) => "round",
1963 Expression::Floor(_) => "floor",
1964 Expression::Ceil(_) => "ceil",
1965 Expression::Power(_) => "power",
1966 Expression::Sqrt(_) => "sqrt",
1967 Expression::Cbrt(_) => "cbrt",
1968 Expression::Ln(_) => "ln",
1969 Expression::Log(_) => "log",
1970 Expression::Exp(_) => "exp",
1971 Expression::Sign(_) => "sign",
1972 Expression::Greatest(_) => "greatest",
1973 Expression::Least(_) => "least",
1974 Expression::CurrentDate(_) => "current_date",
1975 Expression::CurrentTime(_) => "current_time",
1976 Expression::CurrentTimestamp(_) => "current_timestamp",
1977 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1978 Expression::AtTimeZone(_) => "at_time_zone",
1979 Expression::DateAdd(_) => "date_add",
1980 Expression::DateSub(_) => "date_sub",
1981 Expression::DateDiff(_) => "date_diff",
1982 Expression::DateTrunc(_) => "date_trunc",
1983 Expression::Extract(_) => "extract",
1984 Expression::ToDate(_) => "to_date",
1985 Expression::ToTimestamp(_) => "to_timestamp",
1986 Expression::Date(_) => "date",
1987 Expression::Time(_) => "time",
1988 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1989 Expression::UnixDate(_) => "unix_date",
1990 Expression::UnixSeconds(_) => "unix_seconds",
1991 Expression::UnixMillis(_) => "unix_millis",
1992 Expression::UnixMicros(_) => "unix_micros",
1993 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1994 Expression::TimeStrToDate(_) => "time_str_to_date",
1995 Expression::DateToDi(_) => "date_to_di",
1996 Expression::DiToDate(_) => "di_to_date",
1997 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
1998 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
1999 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
2000 Expression::YearOfWeek(_) => "year_of_week",
2001 Expression::YearOfWeekIso(_) => "year_of_week_iso",
2002 Expression::Coalesce(_) => "coalesce",
2003 Expression::NullIf(_) => "null_if",
2004 Expression::IfFunc(_) => "if_func",
2005 Expression::IfNull(_) => "if_null",
2006 Expression::Nvl(_) => "nvl",
2007 Expression::Nvl2(_) => "nvl2",
2008 Expression::TryCast(_) => "try_cast",
2009 Expression::SafeCast(_) => "safe_cast",
2010 Expression::Count(_) => "count",
2011 Expression::Sum(_) => "sum",
2012 Expression::Avg(_) => "avg",
2013 Expression::Min(_) => "min",
2014 Expression::Max(_) => "max",
2015 Expression::GroupConcat(_) => "group_concat",
2016 Expression::StringAgg(_) => "string_agg",
2017 Expression::ListAgg(_) => "list_agg",
2018 Expression::ArrayAgg(_) => "array_agg",
2019 Expression::CountIf(_) => "count_if",
2020 Expression::SumIf(_) => "sum_if",
2021 Expression::Stddev(_) => "stddev",
2022 Expression::StddevPop(_) => "stddev_pop",
2023 Expression::StddevSamp(_) => "stddev_samp",
2024 Expression::Variance(_) => "variance",
2025 Expression::VarPop(_) => "var_pop",
2026 Expression::VarSamp(_) => "var_samp",
2027 Expression::Median(_) => "median",
2028 Expression::Mode(_) => "mode",
2029 Expression::First(_) => "first",
2030 Expression::Last(_) => "last",
2031 Expression::AnyValue(_) => "any_value",
2032 Expression::ApproxDistinct(_) => "approx_distinct",
2033 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2034 Expression::ApproxPercentile(_) => "approx_percentile",
2035 Expression::Percentile(_) => "percentile",
2036 Expression::LogicalAnd(_) => "logical_and",
2037 Expression::LogicalOr(_) => "logical_or",
2038 Expression::Skewness(_) => "skewness",
2039 Expression::BitwiseCount(_) => "bitwise_count",
2040 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2041 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2042 Expression::BoolXorAgg(_) => "bool_xor_agg",
2043 Expression::RowNumber(_) => "row_number",
2044 Expression::Rank(_) => "rank",
2045 Expression::DenseRank(_) => "dense_rank",
2046 Expression::NTile(_) => "n_tile",
2047 Expression::Lead(_) => "lead",
2048 Expression::Lag(_) => "lag",
2049 Expression::FirstValue(_) => "first_value",
2050 Expression::LastValue(_) => "last_value",
2051 Expression::NthValue(_) => "nth_value",
2052 Expression::PercentRank(_) => "percent_rank",
2053 Expression::CumeDist(_) => "cume_dist",
2054 Expression::PercentileCont(_) => "percentile_cont",
2055 Expression::PercentileDisc(_) => "percentile_disc",
2056 Expression::Contains(_) => "contains",
2057 Expression::StartsWith(_) => "starts_with",
2058 Expression::EndsWith(_) => "ends_with",
2059 Expression::Position(_) => "position",
2060 Expression::Initcap(_) => "initcap",
2061 Expression::Ascii(_) => "ascii",
2062 Expression::Chr(_) => "chr",
2063 Expression::CharFunc(_) => "char_func",
2064 Expression::Soundex(_) => "soundex",
2065 Expression::Levenshtein(_) => "levenshtein",
2066 Expression::ByteLength(_) => "byte_length",
2067 Expression::Hex(_) => "hex",
2068 Expression::LowerHex(_) => "lower_hex",
2069 Expression::Unicode(_) => "unicode",
2070 Expression::ModFunc(_) => "mod_func",
2071 Expression::Random(_) => "random",
2072 Expression::Rand(_) => "rand",
2073 Expression::TruncFunc(_) => "trunc_func",
2074 Expression::Pi(_) => "pi",
2075 Expression::Radians(_) => "radians",
2076 Expression::Degrees(_) => "degrees",
2077 Expression::Sin(_) => "sin",
2078 Expression::Cos(_) => "cos",
2079 Expression::Tan(_) => "tan",
2080 Expression::Asin(_) => "asin",
2081 Expression::Acos(_) => "acos",
2082 Expression::Atan(_) => "atan",
2083 Expression::Atan2(_) => "atan2",
2084 Expression::IsNan(_) => "is_nan",
2085 Expression::IsInf(_) => "is_inf",
2086 Expression::IntDiv(_) => "int_div",
2087 Expression::Decode(_) => "decode",
2088 Expression::DateFormat(_) => "date_format",
2089 Expression::FormatDate(_) => "format_date",
2090 Expression::Year(_) => "year",
2091 Expression::Month(_) => "month",
2092 Expression::Day(_) => "day",
2093 Expression::Hour(_) => "hour",
2094 Expression::Minute(_) => "minute",
2095 Expression::Second(_) => "second",
2096 Expression::DayOfWeek(_) => "day_of_week",
2097 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2098 Expression::DayOfMonth(_) => "day_of_month",
2099 Expression::DayOfYear(_) => "day_of_year",
2100 Expression::WeekOfYear(_) => "week_of_year",
2101 Expression::Quarter(_) => "quarter",
2102 Expression::AddMonths(_) => "add_months",
2103 Expression::MonthsBetween(_) => "months_between",
2104 Expression::LastDay(_) => "last_day",
2105 Expression::NextDay(_) => "next_day",
2106 Expression::Epoch(_) => "epoch",
2107 Expression::EpochMs(_) => "epoch_ms",
2108 Expression::FromUnixtime(_) => "from_unixtime",
2109 Expression::UnixTimestamp(_) => "unix_timestamp",
2110 Expression::MakeDate(_) => "make_date",
2111 Expression::MakeTimestamp(_) => "make_timestamp",
2112 Expression::TimestampTrunc(_) => "timestamp_trunc",
2113 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2114 Expression::SessionUser(_) => "session_user",
2115 Expression::SHA(_) => "s_h_a",
2116 Expression::SHA1Digest(_) => "s_h_a1_digest",
2117 Expression::TimeToUnix(_) => "time_to_unix",
2118 Expression::ArrayFunc(_) => "array_func",
2119 Expression::ArrayLength(_) => "array_length",
2120 Expression::ArraySize(_) => "array_size",
2121 Expression::Cardinality(_) => "cardinality",
2122 Expression::ArrayContains(_) => "array_contains",
2123 Expression::ArrayPosition(_) => "array_position",
2124 Expression::ArrayAppend(_) => "array_append",
2125 Expression::ArrayPrepend(_) => "array_prepend",
2126 Expression::ArrayConcat(_) => "array_concat",
2127 Expression::ArraySort(_) => "array_sort",
2128 Expression::ArrayReverse(_) => "array_reverse",
2129 Expression::ArrayDistinct(_) => "array_distinct",
2130 Expression::ArrayJoin(_) => "array_join",
2131 Expression::ArrayToString(_) => "array_to_string",
2132 Expression::Unnest(_) => "unnest",
2133 Expression::Explode(_) => "explode",
2134 Expression::ExplodeOuter(_) => "explode_outer",
2135 Expression::ArrayFilter(_) => "array_filter",
2136 Expression::ArrayTransform(_) => "array_transform",
2137 Expression::ArrayFlatten(_) => "array_flatten",
2138 Expression::ArrayCompact(_) => "array_compact",
2139 Expression::ArrayIntersect(_) => "array_intersect",
2140 Expression::ArrayUnion(_) => "array_union",
2141 Expression::ArrayExcept(_) => "array_except",
2142 Expression::ArrayRemove(_) => "array_remove",
2143 Expression::ArrayZip(_) => "array_zip",
2144 Expression::Sequence(_) => "sequence",
2145 Expression::Generate(_) => "generate",
2146 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2147 Expression::ToArray(_) => "to_array",
2148 Expression::StarMap(_) => "star_map",
2149 Expression::StructFunc(_) => "struct_func",
2150 Expression::StructExtract(_) => "struct_extract",
2151 Expression::NamedStruct(_) => "named_struct",
2152 Expression::MapFunc(_) => "map_func",
2153 Expression::MapFromEntries(_) => "map_from_entries",
2154 Expression::MapFromArrays(_) => "map_from_arrays",
2155 Expression::MapKeys(_) => "map_keys",
2156 Expression::MapValues(_) => "map_values",
2157 Expression::MapContainsKey(_) => "map_contains_key",
2158 Expression::MapConcat(_) => "map_concat",
2159 Expression::ElementAt(_) => "element_at",
2160 Expression::TransformKeys(_) => "transform_keys",
2161 Expression::TransformValues(_) => "transform_values",
2162 Expression::FunctionEmits(_) => "function_emits",
2163 Expression::JsonExtract(_) => "json_extract",
2164 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2165 Expression::JsonExtractPath(_) => "json_extract_path",
2166 Expression::JsonArray(_) => "json_array",
2167 Expression::JsonObject(_) => "json_object",
2168 Expression::JsonQuery(_) => "json_query",
2169 Expression::JsonValue(_) => "json_value",
2170 Expression::JsonArrayLength(_) => "json_array_length",
2171 Expression::JsonKeys(_) => "json_keys",
2172 Expression::JsonType(_) => "json_type",
2173 Expression::ParseJson(_) => "parse_json",
2174 Expression::ToJson(_) => "to_json",
2175 Expression::JsonSet(_) => "json_set",
2176 Expression::JsonInsert(_) => "json_insert",
2177 Expression::JsonRemove(_) => "json_remove",
2178 Expression::JsonMergePatch(_) => "json_merge_patch",
2179 Expression::JsonArrayAgg(_) => "json_array_agg",
2180 Expression::JsonObjectAgg(_) => "json_object_agg",
2181 Expression::Convert(_) => "convert",
2182 Expression::Typeof(_) => "typeof",
2183 Expression::Lambda(_) => "lambda",
2184 Expression::Parameter(_) => "parameter",
2185 Expression::Placeholder(_) => "placeholder",
2186 Expression::NamedArgument(_) => "named_argument",
2187 Expression::TableArgument(_) => "table_argument",
2188 Expression::SqlComment(_) => "sql_comment",
2189 Expression::NullSafeEq(_) => "null_safe_eq",
2190 Expression::NullSafeNeq(_) => "null_safe_neq",
2191 Expression::Glob(_) => "glob",
2192 Expression::SimilarTo(_) => "similar_to",
2193 Expression::Any(_) => "any",
2194 Expression::All(_) => "all",
2195 Expression::Overlaps(_) => "overlaps",
2196 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2197 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2198 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2199 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2200 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2201 Expression::Subscript(_) => "subscript",
2202 Expression::Dot(_) => "dot",
2203 Expression::MethodCall(_) => "method_call",
2204 Expression::ArraySlice(_) => "array_slice",
2205 Expression::CreateTable(_) => "create_table",
2206 Expression::DropTable(_) => "drop_table",
2207 Expression::Undrop(_) => "undrop",
2208 Expression::AlterTable(_) => "alter_table",
2209 Expression::SplitTable(_) => "split_table",
2210 Expression::FlashbackTable(_) => "flashback_table",
2211 Expression::CreateIndex(_) => "create_index",
2212 Expression::DropIndex(_) => "drop_index",
2213 Expression::CreateView(_) => "create_view",
2214 Expression::DropView(_) => "drop_view",
2215 Expression::AlterView(_) => "alter_view",
2216 Expression::AlterIndex(_) => "alter_index",
2217 Expression::Truncate(_) => "truncate",
2218 Expression::Use(_) => "use",
2219 Expression::Cache(_) => "cache",
2220 Expression::Uncache(_) => "uncache",
2221 Expression::LoadData(_) => "load_data",
2222 Expression::Pragma(_) => "pragma",
2223 Expression::Grant(_) => "grant",
2224 Expression::Revoke(_) => "revoke",
2225 Expression::Comment(_) => "comment",
2226 Expression::SetStatement(_) => "set_statement",
2227 Expression::CreateSchema(_) => "create_schema",
2228 Expression::DropSchema(_) => "drop_schema",
2229 Expression::DropNamespace(_) => "drop_namespace",
2230 Expression::CreateDatabase(_) => "create_database",
2231 Expression::DropDatabase(_) => "drop_database",
2232 Expression::CreateFunction(_) => "create_function",
2233 Expression::DropFunction(_) => "drop_function",
2234 Expression::CreateProcedure(_) => "create_procedure",
2235 Expression::DropProcedure(_) => "drop_procedure",
2236 Expression::CreateSequence(_) => "create_sequence",
2237 Expression::CreateSynonym(_) => "create_synonym",
2238 Expression::DropSequence(_) => "drop_sequence",
2239 Expression::AlterSequence(_) => "alter_sequence",
2240 Expression::CreateTrigger(_) => "create_trigger",
2241 Expression::DropTrigger(_) => "drop_trigger",
2242 Expression::CreateType(_) => "create_type",
2243 Expression::DropType(_) => "drop_type",
2244 Expression::Describe(_) => "describe",
2245 Expression::Show(_) => "show",
2246 Expression::Command(_) => "command",
2247 Expression::TryCatch(_) => "try_catch",
2248 Expression::Kill(_) => "kill",
2249 Expression::Prepare(_) => "prepare",
2250 Expression::Execute(_) => "execute",
2251 Expression::Raw(_) => "raw",
2252 Expression::CreateTask(_) => "create_task",
2253 Expression::Paren(_) => "paren",
2254 Expression::Annotated(_) => "annotated",
2255 Expression::Refresh(_) => "refresh",
2256 Expression::LockingStatement(_) => "locking_statement",
2257 Expression::SequenceProperties(_) => "sequence_properties",
2258 Expression::TruncateTable(_) => "truncate_table",
2259 Expression::Clone(_) => "clone",
2260 Expression::Attach(_) => "attach",
2261 Expression::Detach(_) => "detach",
2262 Expression::Install(_) => "install",
2263 Expression::Summarize(_) => "summarize",
2264 Expression::Declare(_) => "declare",
2265 Expression::DeclareItem(_) => "declare_item",
2266 Expression::Set(_) => "set",
2267 Expression::Heredoc(_) => "heredoc",
2268 Expression::SetItem(_) => "set_item",
2269 Expression::QueryBand(_) => "query_band",
2270 Expression::UserDefinedFunction(_) => "user_defined_function",
2271 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2272 Expression::ProjectionDef(_) => "projection_def",
2273 Expression::TableAlias(_) => "table_alias",
2274 Expression::ByteString(_) => "byte_string",
2275 Expression::HexStringExpr(_) => "hex_string_expr",
2276 Expression::UnicodeString(_) => "unicode_string",
2277 Expression::ColumnPosition(_) => "column_position",
2278 Expression::ColumnDef(_) => "column_def",
2279 Expression::AlterColumn(_) => "alter_column",
2280 Expression::AlterSortKey(_) => "alter_sort_key",
2281 Expression::AlterSet(_) => "alter_set",
2282 Expression::RenameColumn(_) => "rename_column",
2283 Expression::Comprehension(_) => "comprehension",
2284 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2285 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2286 Expression::IndexConstraintOption(_) => "index_constraint_option",
2287 Expression::ColumnConstraint(_) => "column_constraint",
2288 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2289 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2290 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2291 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2292 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2293 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2294 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2295 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2296 Expression::WithOperator(_) => "with_operator",
2297 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2298 "generated_as_identity_column_constraint"
2299 }
2300 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2301 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2302 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2303 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2304 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2305 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2306 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2307 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2308 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2309 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2310 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2311 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2312 Expression::PathColumnConstraint(_) => "path_column_constraint",
2313 Expression::Constraint(_) => "constraint",
2314 Expression::Export(_) => "export",
2315 Expression::Filter(_) => "filter",
2316 Expression::Changes(_) => "changes",
2317 Expression::CopyParameter(_) => "copy_parameter",
2318 Expression::Credentials(_) => "credentials",
2319 Expression::Directory(_) => "directory",
2320 Expression::ForeignKey(_) => "foreign_key",
2321 Expression::ColumnPrefix(_) => "column_prefix",
2322 Expression::PrimaryKey(_) => "primary_key",
2323 Expression::IntoClause(_) => "into_clause",
2324 Expression::JoinHint(_) => "join_hint",
2325 Expression::Opclass(_) => "opclass",
2326 Expression::Index(_) => "index",
2327 Expression::IndexParameters(_) => "index_parameters",
2328 Expression::ConditionalInsert(_) => "conditional_insert",
2329 Expression::MultitableInserts(_) => "multitable_inserts",
2330 Expression::OnConflict(_) => "on_conflict",
2331 Expression::OnCondition(_) => "on_condition",
2332 Expression::Returning(_) => "returning",
2333 Expression::Introducer(_) => "introducer",
2334 Expression::PartitionRange(_) => "partition_range",
2335 Expression::Fetch(_) => "fetch",
2336 Expression::Group(_) => "group",
2337 Expression::Cube(_) => "cube",
2338 Expression::Rollup(_) => "rollup",
2339 Expression::GroupingSets(_) => "grouping_sets",
2340 Expression::LimitOptions(_) => "limit_options",
2341 Expression::Lateral(_) => "lateral",
2342 Expression::TableFromRows(_) => "table_from_rows",
2343 Expression::RowsFrom(_) => "rows_from",
2344 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2345 Expression::WithFill(_) => "with_fill",
2346 Expression::Property(_) => "property",
2347 Expression::GrantPrivilege(_) => "grant_privilege",
2348 Expression::GrantPrincipal(_) => "grant_principal",
2349 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2350 Expression::AlgorithmProperty(_) => "algorithm_property",
2351 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2352 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2353 Expression::BackupProperty(_) => "backup_property",
2354 Expression::BuildProperty(_) => "build_property",
2355 Expression::BlockCompressionProperty(_) => "block_compression_property",
2356 Expression::CharacterSetProperty(_) => "character_set_property",
2357 Expression::ChecksumProperty(_) => "checksum_property",
2358 Expression::CollateProperty(_) => "collate_property",
2359 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2360 Expression::DataDeletionProperty(_) => "data_deletion_property",
2361 Expression::DefinerProperty(_) => "definer_property",
2362 Expression::DistKeyProperty(_) => "dist_key_property",
2363 Expression::DistributedByProperty(_) => "distributed_by_property",
2364 Expression::DistStyleProperty(_) => "dist_style_property",
2365 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2366 Expression::EngineProperty(_) => "engine_property",
2367 Expression::ToTableProperty(_) => "to_table_property",
2368 Expression::ExecuteAsProperty(_) => "execute_as_property",
2369 Expression::ExternalProperty(_) => "external_property",
2370 Expression::FallbackProperty(_) => "fallback_property",
2371 Expression::FileFormatProperty(_) => "file_format_property",
2372 Expression::CredentialsProperty(_) => "credentials_property",
2373 Expression::FreespaceProperty(_) => "freespace_property",
2374 Expression::InheritsProperty(_) => "inherits_property",
2375 Expression::InputModelProperty(_) => "input_model_property",
2376 Expression::OutputModelProperty(_) => "output_model_property",
2377 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2378 Expression::JournalProperty(_) => "journal_property",
2379 Expression::LanguageProperty(_) => "language_property",
2380 Expression::EnviromentProperty(_) => "enviroment_property",
2381 Expression::ClusteredByProperty(_) => "clustered_by_property",
2382 Expression::DictProperty(_) => "dict_property",
2383 Expression::DictRange(_) => "dict_range",
2384 Expression::OnCluster(_) => "on_cluster",
2385 Expression::LikeProperty(_) => "like_property",
2386 Expression::LocationProperty(_) => "location_property",
2387 Expression::LockProperty(_) => "lock_property",
2388 Expression::LockingProperty(_) => "locking_property",
2389 Expression::LogProperty(_) => "log_property",
2390 Expression::MaterializedProperty(_) => "materialized_property",
2391 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2392 Expression::OnProperty(_) => "on_property",
2393 Expression::OnCommitProperty(_) => "on_commit_property",
2394 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2395 Expression::PartitionByProperty(_) => "partition_by_property",
2396 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2397 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2398 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2399 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2400 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2401 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2402 Expression::PartitionList(_) => "partition_list",
2403 Expression::Partition(_) => "partition",
2404 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2405 Expression::UniqueKeyProperty(_) => "unique_key_property",
2406 Expression::RollupProperty(_) => "rollup_property",
2407 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2408 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2409 Expression::RemoteWithConnectionModelProperty(_) => {
2410 "remote_with_connection_model_property"
2411 }
2412 Expression::ReturnsProperty(_) => "returns_property",
2413 Expression::RowFormatProperty(_) => "row_format_property",
2414 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2415 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2416 Expression::QueryTransform(_) => "query_transform",
2417 Expression::SampleProperty(_) => "sample_property",
2418 Expression::SecurityProperty(_) => "security_property",
2419 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2420 Expression::SemanticView(_) => "semantic_view",
2421 Expression::SerdeProperties(_) => "serde_properties",
2422 Expression::SetProperty(_) => "set_property",
2423 Expression::SharingProperty(_) => "sharing_property",
2424 Expression::SetConfigProperty(_) => "set_config_property",
2425 Expression::SettingsProperty(_) => "settings_property",
2426 Expression::SortKeyProperty(_) => "sort_key_property",
2427 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2428 Expression::SqlSecurityProperty(_) => "sql_security_property",
2429 Expression::StabilityProperty(_) => "stability_property",
2430 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2431 Expression::TemporaryProperty(_) => "temporary_property",
2432 Expression::Tags(_) => "tags",
2433 Expression::TransformModelProperty(_) => "transform_model_property",
2434 Expression::TransientProperty(_) => "transient_property",
2435 Expression::UsingTemplateProperty(_) => "using_template_property",
2436 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2437 Expression::VolatileProperty(_) => "volatile_property",
2438 Expression::WithDataProperty(_) => "with_data_property",
2439 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2440 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2441 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2442 Expression::WithProcedureOptions(_) => "with_procedure_options",
2443 Expression::EncodeProperty(_) => "encode_property",
2444 Expression::IncludeProperty(_) => "include_property",
2445 Expression::Properties(_) => "properties",
2446 Expression::OptionsProperty(_) => "options_property",
2447 Expression::InputOutputFormat(_) => "input_output_format",
2448 Expression::Reference(_) => "reference",
2449 Expression::QueryOption(_) => "query_option",
2450 Expression::WithTableHint(_) => "with_table_hint",
2451 Expression::IndexTableHint(_) => "index_table_hint",
2452 Expression::HistoricalData(_) => "historical_data",
2453 Expression::Get(_) => "get",
2454 Expression::SetOperation(_) => "set_operation",
2455 Expression::Var(_) => "var",
2456 Expression::Variadic(_) => "variadic",
2457 Expression::Version(_) => "version",
2458 Expression::Schema(_) => "schema",
2459 Expression::Lock(_) => "lock",
2460 Expression::TableSample(_) => "table_sample",
2461 Expression::Tag(_) => "tag",
2462 Expression::UnpivotColumns(_) => "unpivot_columns",
2463 Expression::WindowSpec(_) => "window_spec",
2464 Expression::SessionParameter(_) => "session_parameter",
2465 Expression::PseudoType(_) => "pseudo_type",
2466 Expression::ObjectIdentifier(_) => "object_identifier",
2467 Expression::Transaction(_) => "transaction",
2468 Expression::Commit(_) => "commit",
2469 Expression::Rollback(_) => "rollback",
2470 Expression::AlterSession(_) => "alter_session",
2471 Expression::Analyze(_) => "analyze",
2472 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2473 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2474 Expression::AnalyzeSample(_) => "analyze_sample",
2475 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2476 Expression::AnalyzeDelete(_) => "analyze_delete",
2477 Expression::AnalyzeWith(_) => "analyze_with",
2478 Expression::AnalyzeValidate(_) => "analyze_validate",
2479 Expression::AddPartition(_) => "add_partition",
2480 Expression::AttachOption(_) => "attach_option",
2481 Expression::DropPartition(_) => "drop_partition",
2482 Expression::ReplacePartition(_) => "replace_partition",
2483 Expression::DPipe(_) => "d_pipe",
2484 Expression::Operator(_) => "operator",
2485 Expression::PivotAny(_) => "pivot_any",
2486 Expression::Aliases(_) => "aliases",
2487 Expression::AtIndex(_) => "at_index",
2488 Expression::FromTimeZone(_) => "from_time_zone",
2489 Expression::FormatPhrase(_) => "format_phrase",
2490 Expression::ForIn(_) => "for_in",
2491 Expression::TimeUnit(_) => "time_unit",
2492 Expression::IntervalOp(_) => "interval_op",
2493 Expression::IntervalSpan(_) => "interval_span",
2494 Expression::HavingMax(_) => "having_max",
2495 Expression::CosineDistance(_) => "cosine_distance",
2496 Expression::DotProduct(_) => "dot_product",
2497 Expression::EuclideanDistance(_) => "euclidean_distance",
2498 Expression::ManhattanDistance(_) => "manhattan_distance",
2499 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2500 Expression::Booland(_) => "booland",
2501 Expression::Boolor(_) => "boolor",
2502 Expression::ParameterizedAgg(_) => "parameterized_agg",
2503 Expression::ArgMax(_) => "arg_max",
2504 Expression::ArgMin(_) => "arg_min",
2505 Expression::ApproxTopK(_) => "approx_top_k",
2506 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2507 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2508 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2509 Expression::ApproxTopSum(_) => "approx_top_sum",
2510 Expression::ApproxQuantiles(_) => "approx_quantiles",
2511 Expression::Minhash(_) => "minhash",
2512 Expression::FarmFingerprint(_) => "farm_fingerprint",
2513 Expression::Float64(_) => "float64",
2514 Expression::Transform(_) => "transform",
2515 Expression::Translate(_) => "translate",
2516 Expression::Grouping(_) => "grouping",
2517 Expression::GroupingId(_) => "grouping_id",
2518 Expression::Anonymous(_) => "anonymous",
2519 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2520 Expression::CombinedAggFunc(_) => "combined_agg_func",
2521 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2522 Expression::HashAgg(_) => "hash_agg",
2523 Expression::Hll(_) => "hll",
2524 Expression::Apply(_) => "apply",
2525 Expression::ToBoolean(_) => "to_boolean",
2526 Expression::List(_) => "list",
2527 Expression::ToMap(_) => "to_map",
2528 Expression::Pad(_) => "pad",
2529 Expression::ToChar(_) => "to_char",
2530 Expression::ToNumber(_) => "to_number",
2531 Expression::ToDouble(_) => "to_double",
2532 Expression::Int64(_) => "int64",
2533 Expression::StringFunc(_) => "string_func",
2534 Expression::ToDecfloat(_) => "to_decfloat",
2535 Expression::TryToDecfloat(_) => "try_to_decfloat",
2536 Expression::ToFile(_) => "to_file",
2537 Expression::Columns(_) => "columns",
2538 Expression::ConvertToCharset(_) => "convert_to_charset",
2539 Expression::ConvertTimezone(_) => "convert_timezone",
2540 Expression::GenerateSeries(_) => "generate_series",
2541 Expression::AIAgg(_) => "a_i_agg",
2542 Expression::AIClassify(_) => "a_i_classify",
2543 Expression::ArrayAll(_) => "array_all",
2544 Expression::ArrayAny(_) => "array_any",
2545 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2546 Expression::StPoint(_) => "st_point",
2547 Expression::StDistance(_) => "st_distance",
2548 Expression::StringToArray(_) => "string_to_array",
2549 Expression::ArraySum(_) => "array_sum",
2550 Expression::ObjectAgg(_) => "object_agg",
2551 Expression::CastToStrType(_) => "cast_to_str_type",
2552 Expression::CheckJson(_) => "check_json",
2553 Expression::CheckXml(_) => "check_xml",
2554 Expression::TranslateCharacters(_) => "translate_characters",
2555 Expression::CurrentSchemas(_) => "current_schemas",
2556 Expression::CurrentDatetime(_) => "current_datetime",
2557 Expression::Localtime(_) => "localtime",
2558 Expression::Localtimestamp(_) => "localtimestamp",
2559 Expression::Systimestamp(_) => "systimestamp",
2560 Expression::CurrentSchema(_) => "current_schema",
2561 Expression::CurrentUser(_) => "current_user",
2562 Expression::UtcTime(_) => "utc_time",
2563 Expression::UtcTimestamp(_) => "utc_timestamp",
2564 Expression::Timestamp(_) => "timestamp",
2565 Expression::DateBin(_) => "date_bin",
2566 Expression::Datetime(_) => "datetime",
2567 Expression::DatetimeAdd(_) => "datetime_add",
2568 Expression::DatetimeSub(_) => "datetime_sub",
2569 Expression::DatetimeDiff(_) => "datetime_diff",
2570 Expression::DatetimeTrunc(_) => "datetime_trunc",
2571 Expression::Dayname(_) => "dayname",
2572 Expression::MakeInterval(_) => "make_interval",
2573 Expression::PreviousDay(_) => "previous_day",
2574 Expression::Elt(_) => "elt",
2575 Expression::TimestampAdd(_) => "timestamp_add",
2576 Expression::TimestampSub(_) => "timestamp_sub",
2577 Expression::TimestampDiff(_) => "timestamp_diff",
2578 Expression::TimeSlice(_) => "time_slice",
2579 Expression::TimeAdd(_) => "time_add",
2580 Expression::TimeSub(_) => "time_sub",
2581 Expression::TimeDiff(_) => "time_diff",
2582 Expression::TimeTrunc(_) => "time_trunc",
2583 Expression::DateFromParts(_) => "date_from_parts",
2584 Expression::TimeFromParts(_) => "time_from_parts",
2585 Expression::DecodeCase(_) => "decode_case",
2586 Expression::Decrypt(_) => "decrypt",
2587 Expression::DecryptRaw(_) => "decrypt_raw",
2588 Expression::Encode(_) => "encode",
2589 Expression::Encrypt(_) => "encrypt",
2590 Expression::EncryptRaw(_) => "encrypt_raw",
2591 Expression::EqualNull(_) => "equal_null",
2592 Expression::ToBinary(_) => "to_binary",
2593 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2594 Expression::Base64DecodeString(_) => "base64_decode_string",
2595 Expression::Base64Encode(_) => "base64_encode",
2596 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2597 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2598 Expression::GapFill(_) => "gap_fill",
2599 Expression::GenerateDateArray(_) => "generate_date_array",
2600 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2601 Expression::GetExtract(_) => "get_extract",
2602 Expression::Getbit(_) => "getbit",
2603 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2604 Expression::HexEncode(_) => "hex_encode",
2605 Expression::Compress(_) => "compress",
2606 Expression::DecompressBinary(_) => "decompress_binary",
2607 Expression::DecompressString(_) => "decompress_string",
2608 Expression::Xor(_) => "xor",
2609 Expression::Nullif(_) => "nullif",
2610 Expression::JSON(_) => "j_s_o_n",
2611 Expression::JSONPath(_) => "j_s_o_n_path",
2612 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2613 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2614 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2615 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2616 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2617 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2618 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2619 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2620 Expression::Format(_) => "format",
2621 Expression::JSONKeys(_) => "j_s_o_n_keys",
2622 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2623 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2624 Expression::JSONObject(_) => "j_s_o_n_object",
2625 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2626 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2627 Expression::JSONArray(_) => "j_s_o_n_array",
2628 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2629 Expression::JSONExists(_) => "j_s_o_n_exists",
2630 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2631 Expression::JSONSchema(_) => "j_s_o_n_schema",
2632 Expression::JSONSet(_) => "j_s_o_n_set",
2633 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2634 Expression::JSONValue(_) => "j_s_o_n_value",
2635 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2636 Expression::JSONRemove(_) => "j_s_o_n_remove",
2637 Expression::JSONTable(_) => "j_s_o_n_table",
2638 Expression::JSONType(_) => "j_s_o_n_type",
2639 Expression::ObjectInsert(_) => "object_insert",
2640 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2641 Expression::OpenJSON(_) => "open_j_s_o_n",
2642 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2643 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2644 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2645 Expression::JSONCast(_) => "j_s_o_n_cast",
2646 Expression::JSONExtract(_) => "j_s_o_n_extract",
2647 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2648 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2649 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2650 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2651 Expression::JSONFormat(_) => "j_s_o_n_format",
2652 Expression::JSONBool(_) => "j_s_o_n_bool",
2653 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2654 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2655 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2656 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2657 Expression::ParseJSON(_) => "parse_j_s_o_n",
2658 Expression::ParseUrl(_) => "parse_url",
2659 Expression::ParseIp(_) => "parse_ip",
2660 Expression::ParseTime(_) => "parse_time",
2661 Expression::ParseDatetime(_) => "parse_datetime",
2662 Expression::Map(_) => "map",
2663 Expression::MapCat(_) => "map_cat",
2664 Expression::MapDelete(_) => "map_delete",
2665 Expression::MapInsert(_) => "map_insert",
2666 Expression::MapPick(_) => "map_pick",
2667 Expression::ScopeResolution(_) => "scope_resolution",
2668 Expression::Slice(_) => "slice",
2669 Expression::VarMap(_) => "var_map",
2670 Expression::MatchAgainst(_) => "match_against",
2671 Expression::MD5Digest(_) => "m_d5_digest",
2672 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2673 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2674 Expression::Monthname(_) => "monthname",
2675 Expression::Ntile(_) => "ntile",
2676 Expression::Normalize(_) => "normalize",
2677 Expression::Normal(_) => "normal",
2678 Expression::Predict(_) => "predict",
2679 Expression::MLTranslate(_) => "m_l_translate",
2680 Expression::FeaturesAtTime(_) => "features_at_time",
2681 Expression::GenerateEmbedding(_) => "generate_embedding",
2682 Expression::MLForecast(_) => "m_l_forecast",
2683 Expression::ModelAttribute(_) => "model_attribute",
2684 Expression::VectorSearch(_) => "vector_search",
2685 Expression::Quantile(_) => "quantile",
2686 Expression::ApproxQuantile(_) => "approx_quantile",
2687 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2688 Expression::Randn(_) => "randn",
2689 Expression::Randstr(_) => "randstr",
2690 Expression::RangeN(_) => "range_n",
2691 Expression::RangeBucket(_) => "range_bucket",
2692 Expression::ReadCSV(_) => "read_c_s_v",
2693 Expression::ReadParquet(_) => "read_parquet",
2694 Expression::Reduce(_) => "reduce",
2695 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2696 Expression::RegexpILike(_) => "regexp_i_like",
2697 Expression::RegexpFullMatch(_) => "regexp_full_match",
2698 Expression::RegexpInstr(_) => "regexp_instr",
2699 Expression::RegexpSplit(_) => "regexp_split",
2700 Expression::RegexpCount(_) => "regexp_count",
2701 Expression::RegrValx(_) => "regr_valx",
2702 Expression::RegrValy(_) => "regr_valy",
2703 Expression::RegrAvgy(_) => "regr_avgy",
2704 Expression::RegrAvgx(_) => "regr_avgx",
2705 Expression::RegrCount(_) => "regr_count",
2706 Expression::RegrIntercept(_) => "regr_intercept",
2707 Expression::RegrR2(_) => "regr_r2",
2708 Expression::RegrSxx(_) => "regr_sxx",
2709 Expression::RegrSxy(_) => "regr_sxy",
2710 Expression::RegrSyy(_) => "regr_syy",
2711 Expression::RegrSlope(_) => "regr_slope",
2712 Expression::SafeAdd(_) => "safe_add",
2713 Expression::SafeDivide(_) => "safe_divide",
2714 Expression::SafeMultiply(_) => "safe_multiply",
2715 Expression::SafeSubtract(_) => "safe_subtract",
2716 Expression::SHA2(_) => "s_h_a2",
2717 Expression::SHA2Digest(_) => "s_h_a2_digest",
2718 Expression::SortArray(_) => "sort_array",
2719 Expression::SplitPart(_) => "split_part",
2720 Expression::SubstringIndex(_) => "substring_index",
2721 Expression::StandardHash(_) => "standard_hash",
2722 Expression::StrPosition(_) => "str_position",
2723 Expression::Search(_) => "search",
2724 Expression::SearchIp(_) => "search_ip",
2725 Expression::StrToDate(_) => "str_to_date",
2726 Expression::DateStrToDate(_) => "date_str_to_date",
2727 Expression::DateToDateStr(_) => "date_to_date_str",
2728 Expression::StrToTime(_) => "str_to_time",
2729 Expression::StrToUnix(_) => "str_to_unix",
2730 Expression::StrToMap(_) => "str_to_map",
2731 Expression::NumberToStr(_) => "number_to_str",
2732 Expression::FromBase(_) => "from_base",
2733 Expression::Stuff(_) => "stuff",
2734 Expression::TimeToStr(_) => "time_to_str",
2735 Expression::TimeStrToTime(_) => "time_str_to_time",
2736 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2737 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2738 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2739 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2740 Expression::Unhex(_) => "unhex",
2741 Expression::Uniform(_) => "uniform",
2742 Expression::UnixToStr(_) => "unix_to_str",
2743 Expression::UnixToTime(_) => "unix_to_time",
2744 Expression::Uuid(_) => "uuid",
2745 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2746 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2747 Expression::Corr(_) => "corr",
2748 Expression::WidthBucket(_) => "width_bucket",
2749 Expression::CovarSamp(_) => "covar_samp",
2750 Expression::CovarPop(_) => "covar_pop",
2751 Expression::Week(_) => "week",
2752 Expression::XMLElement(_) => "x_m_l_element",
2753 Expression::XMLGet(_) => "x_m_l_get",
2754 Expression::XMLTable(_) => "x_m_l_table",
2755 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2756 Expression::Zipf(_) => "zipf",
2757 Expression::Merge(_) => "merge",
2758 Expression::When(_) => "when",
2759 Expression::Whens(_) => "whens",
2760 Expression::NextValueFor(_) => "next_value_for",
2761 Expression::ReturnStmt(_) => "return_stmt",
2762 }
2763 }
2764
2765 pub fn get_this(&self) -> Option<&Expression> {
2767 match self {
2768 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2770 Expression::Upper(f)
2772 | Expression::Lower(f)
2773 | Expression::Length(f)
2774 | Expression::LTrim(f)
2775 | Expression::RTrim(f)
2776 | Expression::Reverse(f)
2777 | Expression::Abs(f)
2778 | Expression::Sqrt(f)
2779 | Expression::Cbrt(f)
2780 | Expression::Ln(f)
2781 | Expression::Exp(f)
2782 | Expression::Sign(f)
2783 | Expression::Date(f)
2784 | Expression::Time(f)
2785 | Expression::Initcap(f)
2786 | Expression::Ascii(f)
2787 | Expression::Chr(f)
2788 | Expression::Soundex(f)
2789 | Expression::ByteLength(f)
2790 | Expression::Hex(f)
2791 | Expression::LowerHex(f)
2792 | Expression::Unicode(f)
2793 | Expression::Typeof(f)
2794 | Expression::Explode(f)
2795 | Expression::ExplodeOuter(f)
2796 | Expression::MapFromEntries(f)
2797 | Expression::MapKeys(f)
2798 | Expression::MapValues(f)
2799 | Expression::ArrayLength(f)
2800 | Expression::ArraySize(f)
2801 | Expression::Cardinality(f)
2802 | Expression::ArrayReverse(f)
2803 | Expression::ArrayDistinct(f)
2804 | Expression::ArrayFlatten(f)
2805 | Expression::ArrayCompact(f)
2806 | Expression::ToArray(f)
2807 | Expression::JsonArrayLength(f)
2808 | Expression::JsonKeys(f)
2809 | Expression::JsonType(f)
2810 | Expression::ParseJson(f)
2811 | Expression::ToJson(f)
2812 | Expression::Radians(f)
2813 | Expression::Degrees(f)
2814 | Expression::Sin(f)
2815 | Expression::Cos(f)
2816 | Expression::Tan(f)
2817 | Expression::Asin(f)
2818 | Expression::Acos(f)
2819 | Expression::Atan(f)
2820 | Expression::IsNan(f)
2821 | Expression::IsInf(f)
2822 | Expression::Year(f)
2823 | Expression::Month(f)
2824 | Expression::Day(f)
2825 | Expression::Hour(f)
2826 | Expression::Minute(f)
2827 | Expression::Second(f)
2828 | Expression::DayOfWeek(f)
2829 | Expression::DayOfWeekIso(f)
2830 | Expression::DayOfMonth(f)
2831 | Expression::DayOfYear(f)
2832 | Expression::WeekOfYear(f)
2833 | Expression::Quarter(f)
2834 | Expression::Epoch(f)
2835 | Expression::EpochMs(f)
2836 | Expression::BitwiseCount(f)
2837 | Expression::DateFromUnixDate(f)
2838 | Expression::UnixDate(f)
2839 | Expression::UnixSeconds(f)
2840 | Expression::UnixMillis(f)
2841 | Expression::UnixMicros(f)
2842 | Expression::TimeStrToDate(f)
2843 | Expression::DateToDi(f)
2844 | Expression::DiToDate(f)
2845 | Expression::TsOrDiToDi(f)
2846 | Expression::TsOrDsToDatetime(f)
2847 | Expression::TsOrDsToTimestamp(f)
2848 | Expression::YearOfWeek(f)
2849 | Expression::YearOfWeekIso(f)
2850 | Expression::SHA(f)
2851 | Expression::SHA1Digest(f)
2852 | Expression::TimeToUnix(f)
2853 | Expression::TimeStrToUnix(f)
2854 | Expression::Int64(f)
2855 | Expression::JSONBool(f)
2856 | Expression::MD5NumberLower64(f)
2857 | Expression::MD5NumberUpper64(f)
2858 | Expression::DateStrToDate(f)
2859 | Expression::DateToDateStr(f) => Some(&f.this),
2860 Expression::Power(f)
2862 | Expression::NullIf(f)
2863 | Expression::IfNull(f)
2864 | Expression::Nvl(f)
2865 | Expression::Contains(f)
2866 | Expression::StartsWith(f)
2867 | Expression::EndsWith(f)
2868 | Expression::Levenshtein(f)
2869 | Expression::ModFunc(f)
2870 | Expression::IntDiv(f)
2871 | Expression::Atan2(f)
2872 | Expression::AddMonths(f)
2873 | Expression::MonthsBetween(f)
2874 | Expression::NextDay(f)
2875 | Expression::UnixToTimeStr(f)
2876 | Expression::ArrayContains(f)
2877 | Expression::ArrayPosition(f)
2878 | Expression::ArrayAppend(f)
2879 | Expression::ArrayPrepend(f)
2880 | Expression::ArrayUnion(f)
2881 | Expression::ArrayExcept(f)
2882 | Expression::ArrayRemove(f)
2883 | Expression::StarMap(f)
2884 | Expression::MapFromArrays(f)
2885 | Expression::MapContainsKey(f)
2886 | Expression::ElementAt(f)
2887 | Expression::JsonMergePatch(f)
2888 | Expression::JSONBContains(f)
2889 | Expression::JSONBExtract(f) => Some(&f.this),
2890 Expression::Sum(af)
2892 | Expression::Avg(af)
2893 | Expression::Min(af)
2894 | Expression::Max(af)
2895 | Expression::ArrayAgg(af)
2896 | Expression::CountIf(af)
2897 | Expression::Stddev(af)
2898 | Expression::StddevPop(af)
2899 | Expression::StddevSamp(af)
2900 | Expression::Variance(af)
2901 | Expression::VarPop(af)
2902 | Expression::VarSamp(af)
2903 | Expression::Median(af)
2904 | Expression::Mode(af)
2905 | Expression::First(af)
2906 | Expression::Last(af)
2907 | Expression::AnyValue(af)
2908 | Expression::ApproxDistinct(af)
2909 | Expression::ApproxCountDistinct(af)
2910 | Expression::LogicalAnd(af)
2911 | Expression::LogicalOr(af)
2912 | Expression::Skewness(af)
2913 | Expression::ArrayConcatAgg(af)
2914 | Expression::ArrayUniqueAgg(af)
2915 | Expression::BoolXorAgg(af)
2916 | Expression::BitwiseAndAgg(af)
2917 | Expression::BitwiseOrAgg(af)
2918 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2919 Expression::And(op)
2921 | Expression::Or(op)
2922 | Expression::Add(op)
2923 | Expression::Sub(op)
2924 | Expression::Mul(op)
2925 | Expression::Div(op)
2926 | Expression::Mod(op)
2927 | Expression::Eq(op)
2928 | Expression::Neq(op)
2929 | Expression::Lt(op)
2930 | Expression::Lte(op)
2931 | Expression::Gt(op)
2932 | Expression::Gte(op)
2933 | Expression::BitwiseAnd(op)
2934 | Expression::BitwiseOr(op)
2935 | Expression::BitwiseXor(op)
2936 | Expression::Concat(op)
2937 | Expression::Adjacent(op)
2938 | Expression::TsMatch(op)
2939 | Expression::PropertyEQ(op)
2940 | Expression::ArrayContainsAll(op)
2941 | Expression::ArrayContainedBy(op)
2942 | Expression::ArrayOverlaps(op)
2943 | Expression::JSONBContainsAllTopKeys(op)
2944 | Expression::JSONBContainsAnyTopKeys(op)
2945 | Expression::JSONBDeleteAtPath(op)
2946 | Expression::ExtendsLeft(op)
2947 | Expression::ExtendsRight(op)
2948 | Expression::Is(op)
2949 | Expression::MemberOf(op)
2950 | Expression::Match(op)
2951 | Expression::NullSafeEq(op)
2952 | Expression::NullSafeNeq(op)
2953 | Expression::Glob(op)
2954 | Expression::BitwiseLeftShift(op)
2955 | Expression::BitwiseRightShift(op) => Some(&op.left),
2956 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2958 Expression::Alias(a) => Some(&a.this),
2960 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2961 Expression::Paren(p) => Some(&p.this),
2962 Expression::Annotated(a) => Some(&a.this),
2963 Expression::Subquery(s) => Some(&s.this),
2964 Expression::Where(w) => Some(&w.this),
2965 Expression::Having(h) => Some(&h.this),
2966 Expression::Qualify(q) => Some(&q.this),
2967 Expression::IsNull(i) => Some(&i.this),
2968 Expression::Exists(e) => Some(&e.this),
2969 Expression::Ordered(o) => Some(&o.this),
2970 Expression::WindowFunction(wf) => Some(&wf.this),
2971 Expression::Cte(cte) => Some(&cte.this),
2972 Expression::Between(b) => Some(&b.this),
2973 Expression::In(i) => Some(&i.this),
2974 Expression::ReturnStmt(e) => Some(e),
2975 _ => None,
2976 }
2977 }
2978
2979 pub fn get_expression(&self) -> Option<&Expression> {
2981 match self {
2982 Expression::And(op)
2984 | Expression::Or(op)
2985 | Expression::Add(op)
2986 | Expression::Sub(op)
2987 | Expression::Mul(op)
2988 | Expression::Div(op)
2989 | Expression::Mod(op)
2990 | Expression::Eq(op)
2991 | Expression::Neq(op)
2992 | Expression::Lt(op)
2993 | Expression::Lte(op)
2994 | Expression::Gt(op)
2995 | Expression::Gte(op)
2996 | Expression::BitwiseAnd(op)
2997 | Expression::BitwiseOr(op)
2998 | Expression::BitwiseXor(op)
2999 | Expression::Concat(op)
3000 | Expression::Adjacent(op)
3001 | Expression::TsMatch(op)
3002 | Expression::PropertyEQ(op)
3003 | Expression::ArrayContainsAll(op)
3004 | Expression::ArrayContainedBy(op)
3005 | Expression::ArrayOverlaps(op)
3006 | Expression::JSONBContainsAllTopKeys(op)
3007 | Expression::JSONBContainsAnyTopKeys(op)
3008 | Expression::JSONBDeleteAtPath(op)
3009 | Expression::ExtendsLeft(op)
3010 | Expression::ExtendsRight(op)
3011 | Expression::Is(op)
3012 | Expression::MemberOf(op)
3013 | Expression::Match(op)
3014 | Expression::NullSafeEq(op)
3015 | Expression::NullSafeNeq(op)
3016 | Expression::Glob(op)
3017 | Expression::BitwiseLeftShift(op)
3018 | Expression::BitwiseRightShift(op) => Some(&op.right),
3019 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3021 Expression::Power(f)
3023 | Expression::NullIf(f)
3024 | Expression::IfNull(f)
3025 | Expression::Nvl(f)
3026 | Expression::Contains(f)
3027 | Expression::StartsWith(f)
3028 | Expression::EndsWith(f)
3029 | Expression::Levenshtein(f)
3030 | Expression::ModFunc(f)
3031 | Expression::IntDiv(f)
3032 | Expression::Atan2(f)
3033 | Expression::AddMonths(f)
3034 | Expression::MonthsBetween(f)
3035 | Expression::NextDay(f)
3036 | Expression::UnixToTimeStr(f)
3037 | Expression::ArrayContains(f)
3038 | Expression::ArrayPosition(f)
3039 | Expression::ArrayAppend(f)
3040 | Expression::ArrayPrepend(f)
3041 | Expression::ArrayUnion(f)
3042 | Expression::ArrayExcept(f)
3043 | Expression::ArrayRemove(f)
3044 | Expression::StarMap(f)
3045 | Expression::MapFromArrays(f)
3046 | Expression::MapContainsKey(f)
3047 | Expression::ElementAt(f)
3048 | Expression::JsonMergePatch(f)
3049 | Expression::JSONBContains(f)
3050 | Expression::JSONBExtract(f) => Some(&f.expression),
3051 _ => None,
3052 }
3053 }
3054
3055 pub fn get_expressions(&self) -> &[Expression] {
3057 match self {
3058 Expression::Select(s) => &s.expressions,
3059 Expression::Function(f) => &f.args,
3060 Expression::AggregateFunction(f) => &f.args,
3061 Expression::From(f) => &f.expressions,
3062 Expression::GroupBy(g) => &g.expressions,
3063 Expression::In(i) => &i.expressions,
3064 Expression::Array(a) => &a.expressions,
3065 Expression::Tuple(t) => &t.expressions,
3066 Expression::Coalesce(f)
3067 | Expression::Greatest(f)
3068 | Expression::Least(f)
3069 | Expression::ArrayConcat(f)
3070 | Expression::ArrayIntersect(f)
3071 | Expression::ArrayZip(f)
3072 | Expression::MapConcat(f)
3073 | Expression::JsonArray(f) => &f.expressions,
3074 _ => &[],
3075 }
3076 }
3077
3078 pub fn get_name(&self) -> &str {
3080 match self {
3081 Expression::Identifier(id) => &id.name,
3082 Expression::Column(col) => &col.name.name,
3083 Expression::Table(t) => &t.name.name,
3084 Expression::Literal(lit) => lit.value_str(),
3085 Expression::Star(_) => "*",
3086 Expression::Function(f) => &f.name,
3087 Expression::AggregateFunction(f) => &f.name,
3088 Expression::Alias(a) => a.this.get_name(),
3089 Expression::Boolean(b) => {
3090 if b.value {
3091 "TRUE"
3092 } else {
3093 "FALSE"
3094 }
3095 }
3096 Expression::Null(_) => "NULL",
3097 _ => "",
3098 }
3099 }
3100
3101 pub fn get_alias(&self) -> &str {
3103 match self {
3104 Expression::Alias(a) => &a.alias.name,
3105 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3106 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3107 _ => "",
3108 }
3109 }
3110
3111 pub fn get_output_name(&self) -> &str {
3113 match self {
3114 Expression::Alias(a) => &a.alias.name,
3115 Expression::Column(c) => &c.name.name,
3116 Expression::Identifier(id) => &id.name,
3117 Expression::Literal(lit) => lit.value_str(),
3118 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3119 Expression::Star(_) => "*",
3120 _ => "",
3121 }
3122 }
3123
3124 pub fn get_comments(&self) -> Vec<&str> {
3126 match self {
3127 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3128 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3129 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3130 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3131 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3132 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3133 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3134 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3135 }
3136 Expression::And(op)
3137 | Expression::Or(op)
3138 | Expression::Add(op)
3139 | Expression::Sub(op)
3140 | Expression::Mul(op)
3141 | Expression::Div(op)
3142 | Expression::Mod(op)
3143 | Expression::Eq(op)
3144 | Expression::Neq(op)
3145 | Expression::Lt(op)
3146 | Expression::Lte(op)
3147 | Expression::Gt(op)
3148 | Expression::Gte(op)
3149 | Expression::Concat(op)
3150 | Expression::BitwiseAnd(op)
3151 | Expression::BitwiseOr(op)
3152 | Expression::BitwiseXor(op) => {
3153 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3154 }
3155 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3156 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3157 _ => Vec::new(),
3158 }
3159 }
3160}
3161
3162impl fmt::Display for Expression {
3163 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3164 match self {
3166 Expression::Literal(lit) => write!(f, "{}", lit),
3167 Expression::Identifier(id) => write!(f, "{}", id),
3168 Expression::Column(col) => write!(f, "{}", col),
3169 Expression::Star(_) => write!(f, "*"),
3170 Expression::Null(_) => write!(f, "NULL"),
3171 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3172 Expression::Select(_) => write!(f, "SELECT ..."),
3173 _ => write!(f, "{:?}", self),
3174 }
3175 }
3176}
3177
3178#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3188#[cfg_attr(feature = "bindings", derive(TS))]
3189#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3190pub enum Literal {
3191 String(String),
3193 Number(String),
3195 HexString(String),
3197 HexNumber(String),
3199 BitString(String),
3200 ByteString(String),
3202 NationalString(String),
3204 Date(String),
3206 Time(String),
3208 Timestamp(String),
3210 Datetime(String),
3212 TripleQuotedString(String, char),
3215 EscapeString(String),
3217 DollarString(String),
3219 RawString(String),
3223}
3224
3225impl Literal {
3226 pub fn value_str(&self) -> &str {
3228 match self {
3229 Literal::String(s)
3230 | Literal::Number(s)
3231 | Literal::HexString(s)
3232 | Literal::HexNumber(s)
3233 | Literal::BitString(s)
3234 | Literal::ByteString(s)
3235 | Literal::NationalString(s)
3236 | Literal::Date(s)
3237 | Literal::Time(s)
3238 | Literal::Timestamp(s)
3239 | Literal::Datetime(s)
3240 | Literal::EscapeString(s)
3241 | Literal::DollarString(s)
3242 | Literal::RawString(s) => s.as_str(),
3243 Literal::TripleQuotedString(s, _) => s.as_str(),
3244 }
3245 }
3246
3247 pub fn is_string(&self) -> bool {
3249 matches!(
3250 self,
3251 Literal::String(_)
3252 | Literal::NationalString(_)
3253 | Literal::EscapeString(_)
3254 | Literal::DollarString(_)
3255 | Literal::RawString(_)
3256 | Literal::TripleQuotedString(_, _)
3257 )
3258 }
3259
3260 pub fn is_number(&self) -> bool {
3262 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3263 }
3264}
3265
3266impl fmt::Display for Literal {
3267 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3268 match self {
3269 Literal::String(s) => write!(f, "'{}'", s),
3270 Literal::Number(n) => write!(f, "{}", n),
3271 Literal::HexString(h) => write!(f, "X'{}'", h),
3272 Literal::HexNumber(h) => write!(f, "0x{}", h),
3273 Literal::BitString(b) => write!(f, "B'{}'", b),
3274 Literal::ByteString(b) => write!(f, "b'{}'", b),
3275 Literal::NationalString(s) => write!(f, "N'{}'", s),
3276 Literal::Date(d) => write!(f, "DATE '{}'", d),
3277 Literal::Time(t) => write!(f, "TIME '{}'", t),
3278 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3279 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3280 Literal::TripleQuotedString(s, q) => {
3281 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3282 }
3283 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3284 Literal::DollarString(s) => write!(f, "$${}$$", s),
3285 Literal::RawString(s) => write!(f, "r'{}'", s),
3286 }
3287 }
3288}
3289
3290#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3292#[cfg_attr(feature = "bindings", derive(TS))]
3293pub struct BooleanLiteral {
3294 pub value: bool,
3295}
3296
3297#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3299#[cfg_attr(feature = "bindings", derive(TS))]
3300pub struct Null;
3301
3302#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3309#[cfg_attr(feature = "bindings", derive(TS))]
3310pub struct Identifier {
3311 pub name: String,
3313 pub quoted: bool,
3315 #[serde(default)]
3316 pub trailing_comments: Vec<String>,
3317 #[serde(default, skip_serializing_if = "Option::is_none")]
3319 pub span: Option<Span>,
3320}
3321
3322impl Identifier {
3323 pub fn new(name: impl Into<String>) -> Self {
3324 Self {
3325 name: name.into(),
3326 quoted: false,
3327 trailing_comments: Vec::new(),
3328 span: None,
3329 }
3330 }
3331
3332 pub fn quoted(name: impl Into<String>) -> Self {
3333 Self {
3334 name: name.into(),
3335 quoted: true,
3336 trailing_comments: Vec::new(),
3337 span: None,
3338 }
3339 }
3340
3341 pub fn empty() -> Self {
3342 Self {
3343 name: String::new(),
3344 quoted: false,
3345 trailing_comments: Vec::new(),
3346 span: None,
3347 }
3348 }
3349
3350 pub fn is_empty(&self) -> bool {
3351 self.name.is_empty()
3352 }
3353
3354 pub fn with_span(mut self, span: Span) -> Self {
3356 self.span = Some(span);
3357 self
3358 }
3359}
3360
3361impl fmt::Display for Identifier {
3362 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3363 if self.quoted {
3364 write!(f, "\"{}\"", self.name)
3365 } else {
3366 write!(f, "{}", self.name)
3367 }
3368 }
3369}
3370
3371#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3377#[cfg_attr(feature = "bindings", derive(TS))]
3378pub struct Column {
3379 pub name: Identifier,
3381 pub table: Option<Identifier>,
3383 #[serde(default)]
3385 pub join_mark: bool,
3386 #[serde(default)]
3388 pub trailing_comments: Vec<String>,
3389 #[serde(default, skip_serializing_if = "Option::is_none")]
3391 pub span: Option<Span>,
3392 #[serde(default, skip_serializing_if = "Option::is_none")]
3394 #[ast(skip)]
3395 pub inferred_type: Option<DataType>,
3396}
3397
3398impl fmt::Display for Column {
3399 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3400 if let Some(table) = &self.table {
3401 write!(f, "{}.{}", table, self.name)
3402 } else {
3403 write!(f, "{}", self.name)
3404 }
3405 }
3406}
3407
3408#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3415#[cfg_attr(feature = "bindings", derive(TS))]
3416pub struct TableRef {
3417 pub name: Identifier,
3419 pub schema: Option<Identifier>,
3421 pub catalog: Option<Identifier>,
3423 pub alias: Option<Identifier>,
3425 #[serde(default)]
3427 pub alias_explicit_as: bool,
3428 #[serde(default)]
3430 pub column_aliases: Vec<Identifier>,
3431 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3433 pub leading_comments: Vec<String>,
3434 #[serde(default)]
3436 pub trailing_comments: Vec<String>,
3437 #[serde(default)]
3439 pub when: Option<Box<HistoricalData>>,
3440 #[serde(default)]
3442 pub only: bool,
3443 #[serde(default)]
3445 pub final_: bool,
3446 #[serde(default, skip_serializing_if = "Option::is_none")]
3448 pub table_sample: Option<Box<Sample>>,
3449 #[serde(default)]
3451 pub hints: Vec<Expression>,
3452 #[serde(default, skip_serializing_if = "Option::is_none")]
3455 pub system_time: Option<String>,
3456 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3458 pub partitions: Vec<Identifier>,
3459 #[serde(default, skip_serializing_if = "Option::is_none")]
3462 pub identifier_func: Option<Box<Expression>>,
3463 #[serde(default, skip_serializing_if = "Option::is_none")]
3465 pub changes: Option<Box<Changes>>,
3466 #[serde(default, skip_serializing_if = "Option::is_none")]
3468 pub version: Option<Box<Version>>,
3469 #[serde(default, skip_serializing_if = "Option::is_none")]
3471 pub span: Option<Span>,
3472}
3473
3474impl TableRef {
3475 pub fn new(name: impl Into<String>) -> Self {
3476 Self {
3477 name: Identifier::new(name),
3478 schema: None,
3479 catalog: None,
3480 alias: None,
3481 alias_explicit_as: false,
3482 column_aliases: Vec::new(),
3483 leading_comments: Vec::new(),
3484 trailing_comments: Vec::new(),
3485 when: None,
3486 only: false,
3487 final_: false,
3488 table_sample: None,
3489 hints: Vec::new(),
3490 system_time: None,
3491 partitions: Vec::new(),
3492 identifier_func: None,
3493 changes: None,
3494 version: None,
3495 span: None,
3496 }
3497 }
3498
3499 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3501 let mut t = Self::new(name);
3502 t.schema = Some(Identifier::new(schema));
3503 t
3504 }
3505
3506 pub fn new_with_catalog(
3508 name: impl Into<String>,
3509 schema: impl Into<String>,
3510 catalog: impl Into<String>,
3511 ) -> Self {
3512 let mut t = Self::new(name);
3513 t.schema = Some(Identifier::new(schema));
3514 t.catalog = Some(Identifier::new(catalog));
3515 t
3516 }
3517
3518 pub fn from_identifier(name: Identifier) -> Self {
3520 Self {
3521 name,
3522 schema: None,
3523 catalog: None,
3524 alias: None,
3525 alias_explicit_as: false,
3526 column_aliases: Vec::new(),
3527 leading_comments: Vec::new(),
3528 trailing_comments: Vec::new(),
3529 when: None,
3530 only: false,
3531 final_: false,
3532 table_sample: None,
3533 hints: Vec::new(),
3534 system_time: None,
3535 partitions: Vec::new(),
3536 identifier_func: None,
3537 changes: None,
3538 version: None,
3539 span: None,
3540 }
3541 }
3542
3543 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3544 self.alias = Some(Identifier::new(alias));
3545 self
3546 }
3547
3548 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3549 self.schema = Some(Identifier::new(schema));
3550 self
3551 }
3552}
3553
3554#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3559#[cfg_attr(feature = "bindings", derive(TS))]
3560pub struct Star {
3561 pub table: Option<Identifier>,
3563 pub except: Option<Vec<Identifier>>,
3565 pub replace: Option<Vec<Alias>>,
3567 pub rename: Option<Vec<(Identifier, Identifier)>>,
3569 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3571 pub trailing_comments: Vec<String>,
3572 #[serde(default, skip_serializing_if = "Option::is_none")]
3574 pub span: Option<Span>,
3575}
3576
3577#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3601#[cfg_attr(feature = "bindings", derive(TS))]
3602pub struct Select {
3603 pub expressions: Vec<Expression>,
3605 pub from: Option<From>,
3607 pub joins: Vec<Join>,
3609 pub lateral_views: Vec<LateralView>,
3610 #[serde(default, skip_serializing_if = "Option::is_none")]
3612 pub prewhere: Option<Expression>,
3613 pub where_clause: Option<Where>,
3614 pub group_by: Option<GroupBy>,
3615 pub having: Option<Having>,
3616 pub qualify: Option<Qualify>,
3617 pub order_by: Option<OrderBy>,
3618 pub distribute_by: Option<DistributeBy>,
3619 pub cluster_by: Option<ClusterBy>,
3620 pub sort_by: Option<SortBy>,
3621 pub limit: Option<Limit>,
3622 pub offset: Option<Offset>,
3623 #[serde(default, skip_serializing_if = "Option::is_none")]
3625 pub limit_by: Option<Vec<Expression>>,
3626 pub fetch: Option<Fetch>,
3627 pub distinct: bool,
3628 pub distinct_on: Option<Vec<Expression>>,
3629 pub top: Option<Top>,
3630 pub with: Option<With>,
3631 pub sample: Option<Sample>,
3632 #[serde(default, skip_serializing_if = "Option::is_none")]
3634 pub settings: Option<Vec<Expression>>,
3635 #[serde(default, skip_serializing_if = "Option::is_none")]
3637 pub format: Option<Expression>,
3638 pub windows: Option<Vec<NamedWindow>>,
3639 pub hint: Option<Hint>,
3640 pub connect: Option<Connect>,
3642 pub into: Option<SelectInto>,
3644 #[serde(default)]
3646 pub locks: Vec<Lock>,
3647 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3649 pub for_xml: Vec<Expression>,
3650 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3652 pub for_json: Vec<Expression>,
3653 #[serde(default)]
3655 pub leading_comments: Vec<String>,
3656 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3659 pub post_select_comments: Vec<String>,
3660 #[serde(default, skip_serializing_if = "Option::is_none")]
3662 pub kind: Option<String>,
3663 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3665 pub operation_modifiers: Vec<String>,
3666 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3668 pub qualify_after_window: bool,
3669 #[serde(default, skip_serializing_if = "Option::is_none")]
3671 pub option: Option<String>,
3672 #[serde(default, skip_serializing_if = "Option::is_none")]
3675 pub exclude: Option<Vec<Expression>>,
3676}
3677
3678impl Select {
3679 pub fn new() -> Self {
3680 Self {
3681 expressions: Vec::new(),
3682 from: None,
3683 joins: Vec::new(),
3684 lateral_views: Vec::new(),
3685 prewhere: None,
3686 where_clause: None,
3687 group_by: None,
3688 having: None,
3689 qualify: None,
3690 order_by: None,
3691 distribute_by: None,
3692 cluster_by: None,
3693 sort_by: None,
3694 limit: None,
3695 offset: None,
3696 limit_by: None,
3697 fetch: None,
3698 distinct: false,
3699 distinct_on: None,
3700 top: None,
3701 with: None,
3702 sample: None,
3703 settings: None,
3704 format: None,
3705 windows: None,
3706 hint: None,
3707 connect: None,
3708 into: None,
3709 locks: Vec::new(),
3710 for_xml: Vec::new(),
3711 for_json: Vec::new(),
3712 leading_comments: Vec::new(),
3713 post_select_comments: Vec::new(),
3714 kind: None,
3715 operation_modifiers: Vec::new(),
3716 qualify_after_window: false,
3717 option: None,
3718 exclude: None,
3719 }
3720 }
3721
3722 pub fn column(mut self, expr: Expression) -> Self {
3724 self.expressions.push(expr);
3725 self
3726 }
3727
3728 pub fn from(mut self, table: Expression) -> Self {
3730 self.from = Some(From {
3731 expressions: vec![table],
3732 });
3733 self
3734 }
3735
3736 pub fn where_(mut self, condition: Expression) -> Self {
3738 self.where_clause = Some(Where { this: condition });
3739 self
3740 }
3741
3742 pub fn distinct(mut self) -> Self {
3744 self.distinct = true;
3745 self
3746 }
3747
3748 pub fn join(mut self, join: Join) -> Self {
3750 self.joins.push(join);
3751 self
3752 }
3753
3754 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3756 self.order_by = Some(OrderBy {
3757 expressions,
3758 siblings: false,
3759 comments: Vec::new(),
3760 });
3761 self
3762 }
3763
3764 pub fn limit(mut self, n: Expression) -> Self {
3766 self.limit = Some(Limit {
3767 this: n,
3768 percent: false,
3769 comments: Vec::new(),
3770 });
3771 self
3772 }
3773
3774 pub fn offset(mut self, n: Expression) -> Self {
3776 self.offset = Some(Offset {
3777 this: n,
3778 rows: None,
3779 });
3780 self
3781 }
3782}
3783
3784impl Default for Select {
3785 fn default() -> Self {
3786 Self::new()
3787 }
3788}
3789
3790#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3796#[cfg_attr(feature = "bindings", derive(TS))]
3797pub struct Union {
3798 pub left: Expression,
3800 pub right: Expression,
3802 pub all: bool,
3804 #[serde(default)]
3806 pub distinct: bool,
3807 pub with: Option<With>,
3809 pub order_by: Option<OrderBy>,
3811 pub limit: Option<Box<Expression>>,
3813 pub offset: Option<Box<Expression>>,
3815 #[serde(default, skip_serializing_if = "Option::is_none")]
3817 pub distribute_by: Option<DistributeBy>,
3818 #[serde(default, skip_serializing_if = "Option::is_none")]
3820 pub sort_by: Option<SortBy>,
3821 #[serde(default, skip_serializing_if = "Option::is_none")]
3823 pub cluster_by: Option<ClusterBy>,
3824 #[serde(default)]
3826 pub by_name: bool,
3827 #[serde(default, skip_serializing_if = "Option::is_none")]
3829 pub side: Option<String>,
3830 #[serde(default, skip_serializing_if = "Option::is_none")]
3832 pub kind: Option<String>,
3833 #[serde(default)]
3835 pub corresponding: bool,
3836 #[serde(default)]
3838 pub strict: bool,
3839 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3841 pub on_columns: Vec<Expression>,
3842}
3843
3844impl Drop for Union {
3847 fn drop(&mut self) {
3848 loop {
3849 if let Expression::Union(ref mut inner) = self.left {
3850 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3851 let old_left = std::mem::replace(&mut self.left, next_left);
3852 drop(old_left);
3853 } else {
3854 break;
3855 }
3856 }
3857 }
3858}
3859
3860#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3865#[cfg_attr(feature = "bindings", derive(TS))]
3866pub struct Intersect {
3867 pub left: Expression,
3869 pub right: Expression,
3871 pub all: bool,
3873 #[serde(default)]
3875 pub distinct: bool,
3876 pub with: Option<With>,
3878 pub order_by: Option<OrderBy>,
3880 pub limit: Option<Box<Expression>>,
3882 pub offset: Option<Box<Expression>>,
3884 #[serde(default, skip_serializing_if = "Option::is_none")]
3886 pub distribute_by: Option<DistributeBy>,
3887 #[serde(default, skip_serializing_if = "Option::is_none")]
3889 pub sort_by: Option<SortBy>,
3890 #[serde(default, skip_serializing_if = "Option::is_none")]
3892 pub cluster_by: Option<ClusterBy>,
3893 #[serde(default)]
3895 pub by_name: bool,
3896 #[serde(default, skip_serializing_if = "Option::is_none")]
3898 pub side: Option<String>,
3899 #[serde(default, skip_serializing_if = "Option::is_none")]
3901 pub kind: Option<String>,
3902 #[serde(default)]
3904 pub corresponding: bool,
3905 #[serde(default)]
3907 pub strict: bool,
3908 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3910 pub on_columns: Vec<Expression>,
3911}
3912
3913impl Drop for Intersect {
3914 fn drop(&mut self) {
3915 loop {
3916 if let Expression::Intersect(ref mut inner) = self.left {
3917 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3918 let old_left = std::mem::replace(&mut self.left, next_left);
3919 drop(old_left);
3920 } else {
3921 break;
3922 }
3923 }
3924 }
3925}
3926
3927#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3932#[cfg_attr(feature = "bindings", derive(TS))]
3933pub struct Except {
3934 pub left: Expression,
3936 pub right: Expression,
3938 pub all: bool,
3940 #[serde(default)]
3942 pub distinct: bool,
3943 pub with: Option<With>,
3945 pub order_by: Option<OrderBy>,
3947 pub limit: Option<Box<Expression>>,
3949 pub offset: Option<Box<Expression>>,
3951 #[serde(default, skip_serializing_if = "Option::is_none")]
3953 pub distribute_by: Option<DistributeBy>,
3954 #[serde(default, skip_serializing_if = "Option::is_none")]
3956 pub sort_by: Option<SortBy>,
3957 #[serde(default, skip_serializing_if = "Option::is_none")]
3959 pub cluster_by: Option<ClusterBy>,
3960 #[serde(default)]
3962 pub by_name: bool,
3963 #[serde(default, skip_serializing_if = "Option::is_none")]
3965 pub side: Option<String>,
3966 #[serde(default, skip_serializing_if = "Option::is_none")]
3968 pub kind: Option<String>,
3969 #[serde(default)]
3971 pub corresponding: bool,
3972 #[serde(default)]
3974 pub strict: bool,
3975 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3977 pub on_columns: Vec<Expression>,
3978}
3979
3980impl Drop for Except {
3981 fn drop(&mut self) {
3982 loop {
3983 if let Expression::Except(ref mut inner) = self.left {
3984 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3985 let old_left = std::mem::replace(&mut self.left, next_left);
3986 drop(old_left);
3987 } else {
3988 break;
3989 }
3990 }
3991 }
3992}
3993
3994#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3996#[cfg_attr(feature = "bindings", derive(TS))]
3997pub struct SelectInto {
3998 pub this: Expression,
4000 #[serde(default)]
4002 pub temporary: bool,
4003 #[serde(default)]
4005 pub unlogged: bool,
4006 #[serde(default)]
4008 pub bulk_collect: bool,
4009 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4011 pub expressions: Vec<Expression>,
4012}
4013
4014#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4024#[cfg_attr(feature = "bindings", derive(TS))]
4025pub struct Subquery {
4026 pub this: Expression,
4028 pub alias: Option<Identifier>,
4030 pub column_aliases: Vec<Identifier>,
4032 #[serde(default)]
4034 pub alias_explicit_as: bool,
4035 #[serde(skip_serializing_if = "Option::is_none", default)]
4037 pub alias_keyword: Option<String>,
4038 pub order_by: Option<OrderBy>,
4040 pub limit: Option<Limit>,
4042 pub offset: Option<Offset>,
4044 #[serde(default, skip_serializing_if = "Option::is_none")]
4046 pub distribute_by: Option<DistributeBy>,
4047 #[serde(default, skip_serializing_if = "Option::is_none")]
4049 pub sort_by: Option<SortBy>,
4050 #[serde(default, skip_serializing_if = "Option::is_none")]
4052 pub cluster_by: Option<ClusterBy>,
4053 #[serde(default)]
4055 pub lateral: bool,
4056 #[serde(default)]
4060 pub modifiers_inside: bool,
4061 #[serde(default)]
4063 pub trailing_comments: Vec<String>,
4064 #[serde(default, skip_serializing_if = "Option::is_none")]
4066 #[ast(skip)]
4067 pub inferred_type: Option<DataType>,
4068}
4069
4070#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4075#[cfg_attr(feature = "bindings", derive(TS))]
4076pub struct PipeOperator {
4077 pub this: Expression,
4079 pub expression: Expression,
4081}
4082
4083#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4085#[cfg_attr(feature = "bindings", derive(TS))]
4086pub struct Values {
4087 pub expressions: Vec<Tuple>,
4089 pub alias: Option<Identifier>,
4091 pub column_aliases: Vec<Identifier>,
4093}
4094
4095#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4105#[cfg_attr(feature = "bindings", derive(TS))]
4106pub struct Pivot {
4107 pub this: Expression,
4109 #[serde(default)]
4112 pub expressions: Vec<Expression>,
4113 #[serde(default)]
4115 pub fields: Vec<Expression>,
4116 #[serde(default)]
4118 pub using: Vec<Expression>,
4119 #[serde(default)]
4121 pub group: Option<Box<Expression>>,
4122 #[serde(default)]
4124 pub unpivot: bool,
4125 #[serde(default)]
4127 pub into: Option<Box<Expression>>,
4128 #[serde(default)]
4130 pub alias: Option<Identifier>,
4131 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4133 pub alias_columns: Vec<Identifier>,
4134 #[serde(default)]
4136 pub include_nulls: Option<bool>,
4137 #[serde(default)]
4139 pub default_on_null: Option<Box<Expression>>,
4140 #[serde(default, skip_serializing_if = "Option::is_none")]
4142 pub with: Option<With>,
4143}
4144
4145#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4147#[cfg_attr(feature = "bindings", derive(TS))]
4148pub struct Unpivot {
4149 pub this: Expression,
4150 pub value_column: Identifier,
4151 pub name_column: Identifier,
4152 pub columns: Vec<Expression>,
4153 pub alias: Option<Identifier>,
4154 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4156 pub alias_columns: Vec<Identifier>,
4157 #[serde(default)]
4159 pub value_column_parenthesized: bool,
4160 #[serde(default)]
4162 pub include_nulls: Option<bool>,
4163 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4165 pub extra_value_columns: Vec<Identifier>,
4166}
4167
4168#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4171#[cfg_attr(feature = "bindings", derive(TS))]
4172pub struct PivotAlias {
4173 pub this: Expression,
4174 pub alias: Expression,
4175}
4176
4177#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4179#[cfg_attr(feature = "bindings", derive(TS))]
4180pub struct PreWhere {
4181 pub this: Expression,
4182}
4183
4184#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4186#[cfg_attr(feature = "bindings", derive(TS))]
4187pub struct Stream {
4188 pub this: Expression,
4189 #[serde(skip_serializing_if = "Option::is_none")]
4190 pub on: Option<Expression>,
4191 #[serde(skip_serializing_if = "Option::is_none")]
4192 pub show_initial_rows: Option<bool>,
4193}
4194
4195#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4197#[cfg_attr(feature = "bindings", derive(TS))]
4198pub struct UsingData {
4199 pub this: Expression,
4200}
4201
4202#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4204#[cfg_attr(feature = "bindings", derive(TS))]
4205pub struct XmlNamespace {
4206 pub this: Expression,
4207 #[serde(skip_serializing_if = "Option::is_none")]
4208 pub alias: Option<Identifier>,
4209}
4210
4211#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4213#[cfg_attr(feature = "bindings", derive(TS))]
4214pub struct RowFormat {
4215 pub delimited: bool,
4216 pub fields_terminated_by: Option<String>,
4217 pub collection_items_terminated_by: Option<String>,
4218 pub map_keys_terminated_by: Option<String>,
4219 pub lines_terminated_by: Option<String>,
4220 pub null_defined_as: Option<String>,
4221}
4222
4223#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4225#[cfg_attr(feature = "bindings", derive(TS))]
4226pub struct DirectoryInsert {
4227 pub local: bool,
4228 pub path: String,
4229 pub row_format: Option<RowFormat>,
4230 #[serde(default)]
4232 pub stored_as: Option<String>,
4233}
4234
4235#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4237#[cfg_attr(feature = "bindings", derive(TS))]
4238pub struct Insert {
4239 pub table: TableRef,
4240 pub columns: Vec<Identifier>,
4241 pub values: Vec<Vec<Expression>>,
4242 pub query: Option<Expression>,
4243 pub overwrite: bool,
4245 pub partition: Vec<(Identifier, Option<Expression>)>,
4247 #[serde(default)]
4249 pub directory: Option<DirectoryInsert>,
4250 #[serde(default)]
4252 pub returning: Vec<Expression>,
4253 #[serde(default)]
4255 pub output: Option<OutputClause>,
4256 #[serde(default)]
4258 pub on_conflict: Option<Box<Expression>>,
4259 #[serde(default)]
4261 pub leading_comments: Vec<String>,
4262 #[serde(default)]
4264 pub if_exists: bool,
4265 #[serde(default)]
4267 pub with: Option<With>,
4268 #[serde(default)]
4270 pub ignore: bool,
4271 #[serde(default)]
4273 pub source_alias: Option<Identifier>,
4274 #[serde(default)]
4276 pub alias: Option<Identifier>,
4277 #[serde(default)]
4279 pub alias_explicit_as: bool,
4280 #[serde(default)]
4282 pub default_values: bool,
4283 #[serde(default)]
4285 pub by_name: bool,
4286 #[serde(default, skip_serializing_if = "Option::is_none")]
4288 pub conflict_action: Option<String>,
4289 #[serde(default)]
4291 pub is_replace: bool,
4292 #[serde(default, skip_serializing_if = "Option::is_none")]
4294 pub hint: Option<Hint>,
4295 #[serde(default)]
4297 pub replace_where: Option<Box<Expression>>,
4298 #[serde(default)]
4300 pub source: Option<Box<Expression>>,
4301 #[serde(default, skip_serializing_if = "Option::is_none")]
4303 pub function_target: Option<Box<Expression>>,
4304 #[serde(default, skip_serializing_if = "Option::is_none")]
4306 pub partition_by: Option<Box<Expression>>,
4307 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4309 pub settings: Vec<Expression>,
4310}
4311
4312#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4314#[cfg_attr(feature = "bindings", derive(TS))]
4315pub struct OutputClause {
4316 pub columns: Vec<Expression>,
4318 #[serde(default)]
4320 pub into_table: Option<Expression>,
4321}
4322
4323#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4325#[cfg_attr(feature = "bindings", derive(TS))]
4326pub struct Update {
4327 pub table: TableRef,
4328 #[serde(default)]
4329 pub hint: Option<Hint>,
4330 #[serde(default)]
4332 pub extra_tables: Vec<TableRef>,
4333 #[serde(default)]
4335 pub table_joins: Vec<Join>,
4336 pub set: Vec<(Identifier, Expression)>,
4337 pub from_clause: Option<From>,
4338 #[serde(default)]
4340 pub from_joins: Vec<Join>,
4341 pub where_clause: Option<Where>,
4342 #[serde(default)]
4344 pub returning: Vec<Expression>,
4345 #[serde(default)]
4347 pub output: Option<OutputClause>,
4348 #[serde(default)]
4350 pub with: Option<With>,
4351 #[serde(default)]
4353 pub leading_comments: Vec<String>,
4354 #[serde(default)]
4356 pub limit: Option<Expression>,
4357 #[serde(default)]
4359 pub order_by: Option<OrderBy>,
4360 #[serde(default)]
4362 pub from_before_set: bool,
4363}
4364
4365#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4367#[cfg_attr(feature = "bindings", derive(TS))]
4368pub struct Delete {
4369 pub table: TableRef,
4370 #[serde(default)]
4371 pub hint: Option<Hint>,
4372 #[serde(default, skip_serializing_if = "Option::is_none")]
4374 pub on_cluster: Option<OnCluster>,
4375 pub alias: Option<Identifier>,
4377 #[serde(default)]
4379 pub alias_explicit_as: bool,
4380 pub using: Vec<TableRef>,
4382 pub where_clause: Option<Where>,
4383 #[serde(default)]
4385 pub output: Option<OutputClause>,
4386 #[serde(default)]
4388 pub leading_comments: Vec<String>,
4389 #[serde(default)]
4391 pub with: Option<With>,
4392 #[serde(default)]
4394 pub limit: Option<Expression>,
4395 #[serde(default)]
4397 pub order_by: Option<OrderBy>,
4398 #[serde(default)]
4400 pub returning: Vec<Expression>,
4401 #[serde(default)]
4404 pub tables: Vec<TableRef>,
4405 #[serde(default)]
4408 pub tables_from_using: bool,
4409 #[serde(default)]
4411 pub joins: Vec<Join>,
4412 #[serde(default)]
4414 pub force_index: Option<String>,
4415 #[serde(default)]
4417 pub no_from: bool,
4418}
4419
4420#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4422#[cfg_attr(feature = "bindings", derive(TS))]
4423pub struct CopyStmt {
4424 pub this: Expression,
4426 pub kind: bool,
4428 pub files: Vec<Expression>,
4430 #[serde(default)]
4432 pub params: Vec<CopyParameter>,
4433 #[serde(default)]
4435 pub credentials: Option<Box<Credentials>>,
4436 #[serde(default)]
4438 pub is_into: bool,
4439 #[serde(default)]
4441 pub with_wrapped: bool,
4442}
4443
4444#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4446#[cfg_attr(feature = "bindings", derive(TS))]
4447pub struct CopyParameter {
4448 pub name: String,
4449 pub value: Option<Expression>,
4450 pub values: Vec<Expression>,
4451 #[serde(default)]
4453 pub eq: bool,
4454}
4455
4456#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4458#[cfg_attr(feature = "bindings", derive(TS))]
4459pub struct Credentials {
4460 pub credentials: Vec<(String, String)>,
4461 pub encryption: Option<String>,
4462 pub storage: Option<String>,
4463}
4464
4465#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4467#[cfg_attr(feature = "bindings", derive(TS))]
4468pub struct PutStmt {
4469 pub source: String,
4471 #[serde(default)]
4473 pub source_quoted: bool,
4474 pub target: Expression,
4476 #[serde(default)]
4478 pub params: Vec<CopyParameter>,
4479}
4480
4481#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4483#[cfg_attr(feature = "bindings", derive(TS))]
4484pub struct StageReference {
4485 pub name: String,
4487 #[serde(default)]
4489 pub path: Option<String>,
4490 #[serde(default)]
4492 pub file_format: Option<Expression>,
4493 #[serde(default)]
4495 pub pattern: Option<String>,
4496 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4498 pub quoted: bool,
4499}
4500
4501#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4503#[cfg_attr(feature = "bindings", derive(TS))]
4504pub struct HistoricalData {
4505 pub this: Box<Expression>,
4507 pub kind: String,
4509 pub expression: Box<Expression>,
4511}
4512
4513#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4518#[cfg_attr(feature = "bindings", derive(TS))]
4519pub struct Alias {
4520 pub this: Expression,
4522 pub alias: Identifier,
4524 #[serde(default)]
4526 pub column_aliases: Vec<Identifier>,
4527 #[serde(default)]
4529 pub alias_explicit_as: bool,
4530 #[serde(skip_serializing_if = "Option::is_none", default)]
4532 pub alias_keyword: Option<String>,
4533 #[serde(default)]
4535 pub pre_alias_comments: Vec<String>,
4536 #[serde(default)]
4538 pub trailing_comments: Vec<String>,
4539 #[serde(default, skip_serializing_if = "Option::is_none")]
4541 #[ast(skip)]
4542 pub inferred_type: Option<DataType>,
4543}
4544
4545impl Alias {
4546 pub fn new(this: Expression, alias: Identifier) -> Self {
4548 Self {
4549 this,
4550 alias,
4551 column_aliases: Vec::new(),
4552 alias_explicit_as: false,
4553 alias_keyword: None,
4554 pre_alias_comments: Vec::new(),
4555 trailing_comments: Vec::new(),
4556 inferred_type: None,
4557 }
4558 }
4559
4560 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4562 Self {
4563 this,
4564 alias: Identifier::empty(),
4565 column_aliases,
4566 alias_explicit_as: false,
4567 alias_keyword: None,
4568 pre_alias_comments: Vec::new(),
4569 trailing_comments: Vec::new(),
4570 inferred_type: None,
4571 }
4572 }
4573}
4574
4575#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4582#[cfg_attr(feature = "bindings", derive(TS))]
4583pub struct Cast {
4584 pub this: Expression,
4586 pub to: DataType,
4588 #[serde(default)]
4589 pub trailing_comments: Vec<String>,
4590 #[serde(default)]
4592 pub double_colon_syntax: bool,
4593 #[serde(skip_serializing_if = "Option::is_none", default)]
4595 pub format: Option<Box<Expression>>,
4596 #[serde(skip_serializing_if = "Option::is_none", default)]
4598 pub default: Option<Box<Expression>>,
4599 #[serde(default, skip_serializing_if = "Option::is_none")]
4601 #[ast(skip)]
4602 pub inferred_type: Option<DataType>,
4603}
4604
4605#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4607#[cfg_attr(feature = "bindings", derive(TS))]
4608pub struct CollationExpr {
4609 pub this: Expression,
4610 pub collation: String,
4611 #[serde(default)]
4613 pub quoted: bool,
4614 #[serde(default)]
4616 pub double_quoted: bool,
4617}
4618
4619#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4625#[cfg_attr(feature = "bindings", derive(TS))]
4626pub struct Case {
4627 pub operand: Option<Expression>,
4629 pub whens: Vec<(Expression, Expression)>,
4631 pub else_: Option<Expression>,
4633 #[serde(default)]
4635 #[serde(skip_serializing_if = "Vec::is_empty")]
4636 pub comments: Vec<String>,
4637 #[serde(default, skip_serializing_if = "Option::is_none")]
4639 #[ast(skip)]
4640 pub inferred_type: Option<DataType>,
4641}
4642
4643#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4651#[cfg_attr(feature = "bindings", derive(TS))]
4652pub struct BinaryOp {
4653 pub left: Expression,
4654 pub right: Expression,
4655 #[serde(default)]
4657 pub left_comments: Vec<String>,
4658 #[serde(default)]
4660 pub operator_comments: Vec<String>,
4661 #[serde(default)]
4663 pub trailing_comments: Vec<String>,
4664 #[serde(default, skip_serializing_if = "Option::is_none")]
4666 #[ast(skip)]
4667 pub inferred_type: Option<DataType>,
4668}
4669
4670impl BinaryOp {
4671 pub fn new(left: Expression, right: Expression) -> Self {
4672 Self {
4673 left,
4674 right,
4675 left_comments: Vec::new(),
4676 operator_comments: Vec::new(),
4677 trailing_comments: Vec::new(),
4678 inferred_type: None,
4679 }
4680 }
4681}
4682
4683#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4685#[cfg_attr(feature = "bindings", derive(TS))]
4686pub struct LikeOp {
4687 pub left: Expression,
4688 pub right: Expression,
4689 #[serde(default)]
4691 pub escape: Option<Expression>,
4692 #[serde(default)]
4694 pub quantifier: Option<String>,
4695 #[serde(default, skip_serializing_if = "Option::is_none")]
4697 #[ast(skip)]
4698 pub inferred_type: Option<DataType>,
4699}
4700
4701impl LikeOp {
4702 pub fn new(left: Expression, right: Expression) -> Self {
4703 Self {
4704 left,
4705 right,
4706 escape: None,
4707 quantifier: None,
4708 inferred_type: None,
4709 }
4710 }
4711
4712 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4713 Self {
4714 left,
4715 right,
4716 escape: Some(escape),
4717 quantifier: None,
4718 inferred_type: None,
4719 }
4720 }
4721}
4722
4723#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4727#[cfg_attr(feature = "bindings", derive(TS))]
4728pub struct UnaryOp {
4729 pub this: Expression,
4731 #[serde(default, skip_serializing_if = "Option::is_none")]
4733 #[ast(skip)]
4734 pub inferred_type: Option<DataType>,
4735}
4736
4737impl UnaryOp {
4738 pub fn new(this: Expression) -> Self {
4739 Self {
4740 this,
4741 inferred_type: None,
4742 }
4743 }
4744}
4745
4746#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4751#[cfg_attr(feature = "bindings", derive(TS))]
4752pub struct In {
4753 pub this: Expression,
4755 pub expressions: Vec<Expression>,
4757 pub query: Option<Expression>,
4759 pub not: bool,
4761 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4762 pub global: bool,
4763 #[serde(default, skip_serializing_if = "Option::is_none")]
4765 pub unnest: Option<Box<Expression>>,
4766 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4770 pub is_field: bool,
4771}
4772
4773#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4775#[cfg_attr(feature = "bindings", derive(TS))]
4776pub struct Between {
4777 pub this: Expression,
4779 pub low: Expression,
4781 pub high: Expression,
4783 pub not: bool,
4785 #[serde(default)]
4787 pub symmetric: Option<bool>,
4788}
4789
4790#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4792#[cfg_attr(feature = "bindings", derive(TS))]
4793pub struct IsNull {
4794 pub this: Expression,
4795 pub not: bool,
4796 #[serde(default)]
4798 pub postfix_form: bool,
4799}
4800
4801#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4803#[cfg_attr(feature = "bindings", derive(TS))]
4804pub struct IsTrueFalse {
4805 pub this: Expression,
4806 pub not: bool,
4807}
4808
4809#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4812#[cfg_attr(feature = "bindings", derive(TS))]
4813pub struct IsJson {
4814 pub this: Expression,
4815 pub json_type: Option<String>,
4817 pub unique_keys: Option<JsonUniqueKeys>,
4819 pub negated: bool,
4821}
4822
4823#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4825#[cfg_attr(feature = "bindings", derive(TS))]
4826pub enum JsonUniqueKeys {
4827 With,
4829 Without,
4831 Shorthand,
4833}
4834
4835#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4837#[cfg_attr(feature = "bindings", derive(TS))]
4838pub struct Exists {
4839 pub this: Expression,
4841 pub not: bool,
4843}
4844
4845#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4852#[cfg_attr(feature = "bindings", derive(TS))]
4853pub struct Function {
4854 pub name: String,
4856 pub args: Vec<Expression>,
4858 pub distinct: bool,
4860 #[serde(default)]
4861 pub trailing_comments: Vec<String>,
4862 #[serde(default)]
4864 pub use_bracket_syntax: bool,
4865 #[serde(default)]
4867 pub no_parens: bool,
4868 #[serde(default)]
4870 pub quoted: bool,
4871 #[serde(default, skip_serializing_if = "Option::is_none")]
4873 pub span: Option<Span>,
4874 #[serde(default, skip_serializing_if = "Option::is_none")]
4876 #[ast(skip)]
4877 pub inferred_type: Option<DataType>,
4878}
4879
4880impl Default for Function {
4881 fn default() -> Self {
4882 Self {
4883 name: String::new(),
4884 args: Vec::new(),
4885 distinct: false,
4886 trailing_comments: Vec::new(),
4887 use_bracket_syntax: false,
4888 no_parens: false,
4889 quoted: false,
4890 span: None,
4891 inferred_type: None,
4892 }
4893 }
4894}
4895
4896impl Function {
4897 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4898 Self {
4899 name: name.into(),
4900 args,
4901 distinct: false,
4902 trailing_comments: Vec::new(),
4903 use_bracket_syntax: false,
4904 no_parens: false,
4905 quoted: false,
4906 span: None,
4907 inferred_type: None,
4908 }
4909 }
4910}
4911
4912#[derive(
4919 polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Default, Serialize, Deserialize,
4920)]
4921#[cfg_attr(feature = "bindings", derive(TS))]
4922pub struct AggregateFunction {
4923 pub name: String,
4925 pub args: Vec<Expression>,
4927 pub distinct: bool,
4929 pub filter: Option<Expression>,
4931 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4933 pub order_by: Vec<Ordered>,
4934 #[serde(default, skip_serializing_if = "Option::is_none")]
4936 pub limit: Option<Box<Expression>>,
4937 #[serde(default, skip_serializing_if = "Option::is_none")]
4939 pub ignore_nulls: Option<bool>,
4940 #[serde(default, skip_serializing_if = "Option::is_none")]
4942 #[ast(skip)]
4943 pub inferred_type: Option<DataType>,
4944}
4945
4946#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4953#[cfg_attr(feature = "bindings", derive(TS))]
4954pub struct WindowFunction {
4955 pub this: Expression,
4957 pub over: Over,
4959 #[serde(default, skip_serializing_if = "Option::is_none")]
4961 pub keep: Option<Keep>,
4962 #[serde(default, skip_serializing_if = "Option::is_none")]
4964 #[ast(skip)]
4965 pub inferred_type: Option<DataType>,
4966}
4967
4968#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4971#[cfg_attr(feature = "bindings", derive(TS))]
4972pub struct Keep {
4973 pub first: bool,
4975 pub order_by: Vec<Ordered>,
4977}
4978
4979#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4981#[cfg_attr(feature = "bindings", derive(TS))]
4982pub struct WithinGroup {
4983 pub this: Expression,
4985 pub order_by: Vec<Ordered>,
4987}
4988
4989#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4994#[cfg_attr(feature = "bindings", derive(TS))]
4995pub struct From {
4996 pub expressions: Vec<Expression>,
4998}
4999
5000#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5006#[cfg_attr(feature = "bindings", derive(TS))]
5007pub struct Join {
5008 pub this: Expression,
5010 pub on: Option<Expression>,
5012 pub using: Vec<Identifier>,
5014 pub kind: JoinKind,
5016 pub use_inner_keyword: bool,
5018 pub use_outer_keyword: bool,
5020 pub deferred_condition: bool,
5022 #[serde(default, skip_serializing_if = "Option::is_none")]
5024 pub join_hint: Option<String>,
5025 #[serde(default, skip_serializing_if = "Option::is_none")]
5027 pub match_condition: Option<Expression>,
5028 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5030 pub pivots: Vec<Expression>,
5031 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5033 pub comments: Vec<String>,
5034 #[serde(default)]
5038 pub nesting_group: usize,
5039 #[serde(default)]
5041 pub directed: bool,
5042}
5043
5044#[derive(
5051 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5052)]
5053#[cfg_attr(feature = "bindings", derive(TS))]
5054pub enum JoinKind {
5055 Inner,
5056 Left,
5057 Right,
5058 Full,
5059 Outer, Cross,
5061 Natural,
5062 NaturalLeft,
5063 NaturalRight,
5064 NaturalFull,
5065 Semi,
5066 Anti,
5067 LeftSemi,
5069 LeftAnti,
5070 RightSemi,
5071 RightAnti,
5072 CrossApply,
5074 OuterApply,
5075 AsOf,
5077 AsOfLeft,
5078 AsOfRight,
5079 Lateral,
5081 LeftLateral,
5082 Straight,
5084 Implicit,
5086 Array,
5088 LeftArray,
5089 Paste,
5091 Positional,
5093}
5094
5095impl Default for JoinKind {
5096 fn default() -> Self {
5097 JoinKind::Inner
5098 }
5099}
5100
5101#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5104#[cfg_attr(feature = "bindings", derive(TS))]
5105pub struct JoinedTable {
5106 pub left: Expression,
5108 pub joins: Vec<Join>,
5110 pub lateral_views: Vec<LateralView>,
5112 pub alias: Option<Identifier>,
5114}
5115
5116#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5118#[cfg_attr(feature = "bindings", derive(TS))]
5119pub struct Where {
5120 pub this: Expression,
5122}
5123
5124#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5129#[cfg_attr(feature = "bindings", derive(TS))]
5130pub struct GroupBy {
5131 pub expressions: Vec<Expression>,
5133 #[serde(default)]
5135 pub all: Option<bool>,
5136 #[serde(default)]
5138 pub totals: bool,
5139 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5141 pub comments: Vec<String>,
5142}
5143
5144#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5146#[cfg_attr(feature = "bindings", derive(TS))]
5147pub struct Having {
5148 pub this: Expression,
5150 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5152 pub comments: Vec<String>,
5153}
5154
5155#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5157#[cfg_attr(feature = "bindings", derive(TS))]
5158pub struct OrderBy {
5159 pub expressions: Vec<Ordered>,
5161 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5163 pub siblings: bool,
5164 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5166 pub comments: Vec<String>,
5167}
5168
5169#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5176#[cfg_attr(feature = "bindings", derive(TS))]
5177pub struct Ordered {
5178 pub this: Expression,
5180 pub desc: bool,
5182 pub nulls_first: Option<bool>,
5184 #[serde(default)]
5186 pub explicit_asc: bool,
5187 #[serde(default, skip_serializing_if = "Option::is_none")]
5189 pub with_fill: Option<Box<WithFill>>,
5190}
5191
5192impl Ordered {
5193 pub fn asc(expr: Expression) -> Self {
5194 Self {
5195 this: expr,
5196 desc: false,
5197 nulls_first: None,
5198 explicit_asc: false,
5199 with_fill: None,
5200 }
5201 }
5202
5203 pub fn desc(expr: Expression) -> Self {
5204 Self {
5205 this: expr,
5206 desc: true,
5207 nulls_first: None,
5208 explicit_asc: false,
5209 with_fill: None,
5210 }
5211 }
5212}
5213
5214#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5217#[cfg_attr(feature = "bindings", derive(TS))]
5218#[cfg_attr(feature = "bindings", ts(export))]
5219pub struct DistributeBy {
5220 pub expressions: Vec<Expression>,
5221}
5222
5223#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5226#[cfg_attr(feature = "bindings", derive(TS))]
5227#[cfg_attr(feature = "bindings", ts(export))]
5228pub struct ClusterBy {
5229 pub expressions: Vec<Ordered>,
5230}
5231
5232#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5235#[cfg_attr(feature = "bindings", derive(TS))]
5236#[cfg_attr(feature = "bindings", ts(export))]
5237pub struct SortBy {
5238 pub expressions: Vec<Ordered>,
5239}
5240
5241#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5244#[cfg_attr(feature = "bindings", derive(TS))]
5245#[cfg_attr(feature = "bindings", ts(export))]
5246pub struct LateralView {
5247 pub this: Expression,
5249 pub table_alias: Option<Identifier>,
5251 pub column_aliases: Vec<Identifier>,
5253 pub outer: bool,
5255}
5256
5257#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5259#[cfg_attr(feature = "bindings", derive(TS))]
5260#[cfg_attr(feature = "bindings", ts(export))]
5261pub struct Hint {
5262 pub expressions: Vec<HintExpression>,
5263}
5264
5265#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5267#[cfg_attr(feature = "bindings", derive(TS))]
5268#[cfg_attr(feature = "bindings", ts(export))]
5269pub enum HintExpression {
5270 Function { name: String, args: Vec<Expression> },
5272 Identifier(String),
5274 Raw(String),
5276}
5277
5278#[derive(
5280 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5281)]
5282#[cfg_attr(feature = "bindings", derive(TS))]
5283#[cfg_attr(feature = "bindings", ts(export))]
5284pub enum PseudocolumnType {
5285 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5292
5293impl PseudocolumnType {
5294 pub fn as_str(&self) -> &'static str {
5295 match self {
5296 PseudocolumnType::Rownum => "ROWNUM",
5297 PseudocolumnType::Rowid => "ROWID",
5298 PseudocolumnType::Level => "LEVEL",
5299 PseudocolumnType::Sysdate => "SYSDATE",
5300 PseudocolumnType::ObjectId => "OBJECT_ID",
5301 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5302 }
5303 }
5304
5305 pub fn from_str(s: &str) -> Option<Self> {
5306 match s.to_uppercase().as_str() {
5307 "ROWNUM" => Some(PseudocolumnType::Rownum),
5308 "ROWID" => Some(PseudocolumnType::Rowid),
5309 "LEVEL" => Some(PseudocolumnType::Level),
5310 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5311 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5312 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5313 _ => None,
5314 }
5315 }
5316}
5317
5318#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5321#[cfg_attr(feature = "bindings", derive(TS))]
5322#[cfg_attr(feature = "bindings", ts(export))]
5323pub struct Pseudocolumn {
5324 pub kind: PseudocolumnType,
5325}
5326
5327impl Pseudocolumn {
5328 pub fn rownum() -> Self {
5329 Self {
5330 kind: PseudocolumnType::Rownum,
5331 }
5332 }
5333
5334 pub fn rowid() -> Self {
5335 Self {
5336 kind: PseudocolumnType::Rowid,
5337 }
5338 }
5339
5340 pub fn level() -> Self {
5341 Self {
5342 kind: PseudocolumnType::Level,
5343 }
5344 }
5345}
5346
5347#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5349#[cfg_attr(feature = "bindings", derive(TS))]
5350#[cfg_attr(feature = "bindings", ts(export))]
5351pub struct Connect {
5352 pub start: Option<Expression>,
5354 pub connect: Expression,
5356 pub nocycle: bool,
5358}
5359
5360#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5362#[cfg_attr(feature = "bindings", derive(TS))]
5363#[cfg_attr(feature = "bindings", ts(export))]
5364pub struct Prior {
5365 pub this: Expression,
5366}
5367
5368#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5370#[cfg_attr(feature = "bindings", derive(TS))]
5371#[cfg_attr(feature = "bindings", ts(export))]
5372pub struct ConnectByRoot {
5373 pub this: Expression,
5374}
5375
5376#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5378#[cfg_attr(feature = "bindings", derive(TS))]
5379#[cfg_attr(feature = "bindings", ts(export))]
5380pub struct MatchRecognize {
5381 pub this: Option<Box<Expression>>,
5383 pub partition_by: Option<Vec<Expression>>,
5385 pub order_by: Option<Vec<Ordered>>,
5387 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5389 pub rows: Option<MatchRecognizeRows>,
5391 pub after: Option<MatchRecognizeAfter>,
5393 pub pattern: Option<String>,
5395 pub define: Option<Vec<(Identifier, Expression)>>,
5397 pub alias: Option<Identifier>,
5399 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5401 pub alias_explicit_as: bool,
5402}
5403
5404#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5406#[cfg_attr(feature = "bindings", derive(TS))]
5407#[cfg_attr(feature = "bindings", ts(export))]
5408pub struct MatchRecognizeMeasure {
5409 pub this: Expression,
5411 pub window_frame: Option<MatchRecognizeSemantics>,
5413}
5414
5415#[derive(
5417 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5418)]
5419#[cfg_attr(feature = "bindings", derive(TS))]
5420#[cfg_attr(feature = "bindings", ts(export))]
5421pub enum MatchRecognizeSemantics {
5422 Running,
5423 Final,
5424}
5425
5426#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5428#[cfg_attr(feature = "bindings", derive(TS))]
5429#[cfg_attr(feature = "bindings", ts(export))]
5430pub enum MatchRecognizeRows {
5431 OneRowPerMatch,
5432 AllRowsPerMatch,
5433 AllRowsPerMatchShowEmptyMatches,
5434 AllRowsPerMatchOmitEmptyMatches,
5435 AllRowsPerMatchWithUnmatchedRows,
5436}
5437
5438#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5440#[cfg_attr(feature = "bindings", derive(TS))]
5441#[cfg_attr(feature = "bindings", ts(export))]
5442pub enum MatchRecognizeAfter {
5443 PastLastRow,
5444 ToNextRow,
5445 ToFirst(Identifier),
5446 ToLast(Identifier),
5447}
5448
5449#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5451#[cfg_attr(feature = "bindings", derive(TS))]
5452pub struct Limit {
5453 pub this: Expression,
5455 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5457 pub percent: bool,
5458 #[serde(default)]
5460 #[serde(skip_serializing_if = "Vec::is_empty")]
5461 pub comments: Vec<String>,
5462}
5463
5464#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5466#[cfg_attr(feature = "bindings", derive(TS))]
5467pub struct Offset {
5468 pub this: Expression,
5469 #[serde(skip_serializing_if = "Option::is_none", default)]
5471 pub rows: Option<bool>,
5472}
5473
5474#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5476#[cfg_attr(feature = "bindings", derive(TS))]
5477pub struct Top {
5478 pub this: Expression,
5479 pub percent: bool,
5480 pub with_ties: bool,
5481 #[serde(default)]
5483 pub parenthesized: bool,
5484}
5485
5486#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5488#[cfg_attr(feature = "bindings", derive(TS))]
5489pub struct Fetch {
5490 pub direction: String,
5492 pub count: Option<Expression>,
5494 pub percent: bool,
5496 pub rows: bool,
5498 pub with_ties: bool,
5500}
5501
5502#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5508#[cfg_attr(feature = "bindings", derive(TS))]
5509pub struct Qualify {
5510 pub this: Expression,
5512}
5513
5514#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5516#[cfg_attr(feature = "bindings", derive(TS))]
5517pub struct Sample {
5518 pub method: SampleMethod,
5519 pub size: Expression,
5520 pub seed: Option<Expression>,
5521 #[serde(default)]
5523 pub offset: Option<Expression>,
5524 pub unit_after_size: bool,
5526 #[serde(default)]
5528 pub use_sample_keyword: bool,
5529 #[serde(default)]
5531 pub explicit_method: bool,
5532 #[serde(default)]
5534 pub method_before_size: bool,
5535 #[serde(default)]
5537 pub use_seed_keyword: bool,
5538 pub bucket_numerator: Option<Box<Expression>>,
5540 pub bucket_denominator: Option<Box<Expression>>,
5542 pub bucket_field: Option<Box<Expression>>,
5544 #[serde(default)]
5546 pub is_using_sample: bool,
5547 #[serde(default)]
5549 pub is_percent: bool,
5550 #[serde(default)]
5552 pub suppress_method_output: bool,
5553}
5554
5555#[derive(
5557 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5558)]
5559#[cfg_attr(feature = "bindings", derive(TS))]
5560pub enum SampleMethod {
5561 Bernoulli,
5562 System,
5563 Block,
5564 Row,
5565 Percent,
5566 Bucket,
5568 Reservoir,
5570}
5571
5572#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5574#[cfg_attr(feature = "bindings", derive(TS))]
5575pub struct NamedWindow {
5576 pub name: Identifier,
5577 pub spec: Over,
5578}
5579
5580#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5586#[cfg_attr(feature = "bindings", derive(TS))]
5587pub struct With {
5588 pub ctes: Vec<Cte>,
5590 pub recursive: bool,
5592 #[serde(default)]
5594 pub leading_comments: Vec<String>,
5595 #[serde(default, skip_serializing_if = "Option::is_none")]
5597 pub search: Option<Box<Expression>>,
5598}
5599
5600#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5607#[cfg_attr(feature = "bindings", derive(TS))]
5608pub struct Cte {
5609 pub alias: Identifier,
5611 pub this: Expression,
5613 pub columns: Vec<Identifier>,
5615 pub materialized: Option<bool>,
5617 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5619 pub key_expressions: Vec<Identifier>,
5620 #[serde(default)]
5622 pub alias_first: bool,
5623 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5625 pub comments: Vec<String>,
5626}
5627
5628#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5630#[cfg_attr(feature = "bindings", derive(TS))]
5631pub struct WindowSpec {
5632 pub partition_by: Vec<Expression>,
5633 pub order_by: Vec<Ordered>,
5634 pub frame: Option<WindowFrame>,
5635}
5636
5637#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5639#[cfg_attr(feature = "bindings", derive(TS))]
5640pub struct Over {
5641 pub window_name: Option<Identifier>,
5643 pub partition_by: Vec<Expression>,
5644 pub order_by: Vec<Ordered>,
5645 pub frame: Option<WindowFrame>,
5646 pub alias: Option<Identifier>,
5647}
5648
5649#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5651#[cfg_attr(feature = "bindings", derive(TS))]
5652pub struct WindowFrame {
5653 pub kind: WindowFrameKind,
5654 pub start: WindowFrameBound,
5655 pub end: Option<WindowFrameBound>,
5656 pub exclude: Option<WindowFrameExclude>,
5657 #[serde(default, skip_serializing_if = "Option::is_none")]
5659 pub kind_text: Option<String>,
5660 #[serde(default, skip_serializing_if = "Option::is_none")]
5662 pub start_side_text: Option<String>,
5663 #[serde(default, skip_serializing_if = "Option::is_none")]
5665 pub end_side_text: Option<String>,
5666}
5667
5668#[derive(
5669 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5670)]
5671#[cfg_attr(feature = "bindings", derive(TS))]
5672pub enum WindowFrameKind {
5673 Rows,
5674 Range,
5675 Groups,
5676}
5677
5678#[derive(
5680 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5681)]
5682#[cfg_attr(feature = "bindings", derive(TS))]
5683pub enum WindowFrameExclude {
5684 CurrentRow,
5685 Group,
5686 Ties,
5687 NoOthers,
5688}
5689
5690#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5691#[cfg_attr(feature = "bindings", derive(TS))]
5692pub enum WindowFrameBound {
5693 CurrentRow,
5694 UnboundedPreceding,
5695 UnboundedFollowing,
5696 Preceding(Box<Expression>),
5697 Following(Box<Expression>),
5698 BarePreceding,
5700 BareFollowing,
5702 Value(Box<Expression>),
5704}
5705
5706#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5708#[cfg_attr(feature = "bindings", derive(TS))]
5709pub struct StructField {
5710 pub name: String,
5711 pub data_type: DataType,
5712 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5713 pub options: Vec<Expression>,
5714 #[serde(default, skip_serializing_if = "Option::is_none")]
5715 pub comment: Option<String>,
5716}
5717
5718impl StructField {
5719 pub fn new(name: String, data_type: DataType) -> Self {
5721 Self {
5722 name,
5723 data_type,
5724 options: Vec::new(),
5725 comment: None,
5726 }
5727 }
5728
5729 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5731 Self {
5732 name,
5733 data_type,
5734 options,
5735 comment: None,
5736 }
5737 }
5738
5739 pub fn with_options_and_comment(
5741 name: String,
5742 data_type: DataType,
5743 options: Vec<Expression>,
5744 comment: Option<String>,
5745 ) -> Self {
5746 Self {
5747 name,
5748 data_type,
5749 options,
5750 comment,
5751 }
5752 }
5753}
5754
5755#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5762#[cfg_attr(feature = "bindings", derive(TS))]
5763#[serde(tag = "oracle_data_type", rename_all = "snake_case")]
5764pub enum OracleDataType {
5765 Number {
5766 precision: Option<u32>,
5767 scale: Option<i32>,
5768 },
5769 BinaryFloat,
5770 BinaryDouble,
5771 Float {
5772 precision: Option<u32>,
5773 },
5774 Character {
5775 kind: OracleCharacterKind,
5776 length: Option<u32>,
5777 semantics: Option<OracleCharacterLengthSemantics>,
5778 },
5779 Date,
5780 Timestamp {
5781 precision: Option<u32>,
5782 timezone: OracleTimestampTimeZone,
5783 },
5784 IntervalYearToMonth {
5785 year_precision: Option<u32>,
5786 },
5787 IntervalDayToSecond {
5788 day_precision: Option<u32>,
5789 fractional_seconds_precision: Option<u32>,
5790 },
5791 Clob {
5792 national: bool,
5793 },
5794 Blob,
5795 Raw {
5796 length: Option<u32>,
5797 },
5798 Long {
5799 raw: bool,
5800 },
5801 RowId,
5802}
5803
5804#[derive(
5805 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5806)]
5807#[cfg_attr(feature = "bindings", derive(TS))]
5808#[serde(rename_all = "snake_case")]
5809pub enum OracleCharacterKind {
5810 Char,
5811 VarChar,
5812 NChar,
5813 NVarChar,
5814}
5815
5816#[derive(
5817 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5818)]
5819#[cfg_attr(feature = "bindings", derive(TS))]
5820#[serde(rename_all = "snake_case")]
5821pub enum OracleCharacterLengthSemantics {
5822 Byte,
5823 Char,
5824}
5825
5826#[derive(
5827 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5828)]
5829#[cfg_attr(feature = "bindings", derive(TS))]
5830#[serde(rename_all = "snake_case")]
5831pub enum OracleTimestampTimeZone {
5832 None,
5833 WithTimeZone,
5834 WithLocalTimeZone,
5835}
5836
5837#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5849#[cfg_attr(feature = "bindings", derive(TS))]
5850#[serde(tag = "data_type", rename_all = "snake_case")]
5851pub enum DataType {
5852 Boolean,
5854 TinyInt {
5855 length: Option<u32>,
5856 },
5857 SmallInt {
5858 length: Option<u32>,
5859 },
5860 Int {
5864 length: Option<u32>,
5865 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5866 integer_spelling: bool,
5867 },
5868 BigInt {
5869 length: Option<u32>,
5870 },
5871 Float {
5875 precision: Option<u32>,
5876 scale: Option<u32>,
5877 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5878 real_spelling: bool,
5879 },
5880 Double {
5881 precision: Option<u32>,
5882 scale: Option<u32>,
5883 },
5884 Decimal {
5885 precision: Option<u32>,
5886 scale: Option<u32>,
5887 },
5888 Oracle {
5890 oracle_type: OracleDataType,
5891 },
5892
5893 Char {
5895 length: Option<u32>,
5896 },
5897 VarChar {
5900 length: Option<u32>,
5901 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5902 parenthesized_length: bool,
5903 },
5904 String {
5906 length: Option<u32>,
5907 },
5908 Text,
5909 TextWithLength {
5911 length: u32,
5912 },
5913
5914 Binary {
5916 length: Option<u32>,
5917 },
5918 VarBinary {
5919 length: Option<u32>,
5920 },
5921 Blob,
5922
5923 Bit {
5925 length: Option<u32>,
5926 },
5927 VarBit {
5928 length: Option<u32>,
5929 },
5930
5931 Date,
5933 Time {
5934 precision: Option<u32>,
5935 #[serde(default)]
5936 timezone: bool,
5937 },
5938 Timestamp {
5939 precision: Option<u32>,
5940 timezone: bool,
5941 },
5942 Interval {
5943 unit: Option<String>,
5944 #[serde(default, skip_serializing_if = "Option::is_none")]
5946 to: Option<String>,
5947 },
5948
5949 Json,
5951 JsonB,
5952
5953 Uuid,
5955
5956 Array {
5958 element_type: Box<DataType>,
5959 #[serde(default, skip_serializing_if = "Option::is_none")]
5961 dimension: Option<u32>,
5962 },
5963
5964 List {
5967 element_type: Box<DataType>,
5968 },
5969
5970 Struct {
5974 fields: Vec<StructField>,
5975 nested: bool,
5976 },
5977 Map {
5978 key_type: Box<DataType>,
5979 value_type: Box<DataType>,
5980 },
5981
5982 Enum {
5984 values: Vec<String>,
5985 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5986 assignments: Vec<Option<String>>,
5987 },
5988
5989 Set {
5991 values: Vec<String>,
5992 },
5993
5994 Union {
5996 fields: Vec<(String, DataType)>,
5997 },
5998
5999 Vector {
6001 #[serde(default)]
6002 element_type: Option<Box<DataType>>,
6003 dimension: Option<u32>,
6004 },
6005
6006 Object {
6009 fields: Vec<(String, DataType, bool)>,
6010 modifier: Option<String>,
6011 },
6012
6013 Nullable {
6015 inner: Box<DataType>,
6016 },
6017
6018 Custom {
6020 name: String,
6021 },
6022
6023 Geometry {
6025 subtype: Option<String>,
6026 srid: Option<u32>,
6027 },
6028 Geography {
6029 subtype: Option<String>,
6030 srid: Option<u32>,
6031 },
6032
6033 CharacterSet {
6036 name: String,
6037 },
6038
6039 Unknown,
6041}
6042
6043#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6045#[cfg_attr(feature = "bindings", derive(TS))]
6046#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
6047pub struct Array {
6048 pub expressions: Vec<Expression>,
6049}
6050
6051#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6053#[cfg_attr(feature = "bindings", derive(TS))]
6054pub struct Struct {
6055 pub fields: Vec<(Option<String>, Expression)>,
6056}
6057
6058#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6060#[cfg_attr(feature = "bindings", derive(TS))]
6061pub struct Tuple {
6062 pub expressions: Vec<Expression>,
6063}
6064
6065#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6067#[cfg_attr(feature = "bindings", derive(TS))]
6068pub struct Interval {
6069 pub this: Option<Expression>,
6071 pub unit: Option<IntervalUnitSpec>,
6073}
6074
6075#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6077#[cfg_attr(feature = "bindings", derive(TS))]
6078#[serde(tag = "type", rename_all = "snake_case")]
6079pub enum IntervalUnitSpec {
6080 Simple {
6082 unit: IntervalUnit,
6083 use_plural: bool,
6085 },
6086 Span(IntervalSpan),
6088 ExprSpan(IntervalSpanExpr),
6091 Expr(Box<Expression>),
6093}
6094
6095#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6097#[cfg_attr(feature = "bindings", derive(TS))]
6098pub struct IntervalSpan {
6099 pub this: IntervalUnit,
6101 pub expression: IntervalUnit,
6103}
6104
6105#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6108#[cfg_attr(feature = "bindings", derive(TS))]
6109pub struct IntervalSpanExpr {
6110 pub this: Box<Expression>,
6112 pub expression: Box<Expression>,
6114}
6115
6116#[derive(
6117 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
6118)]
6119#[cfg_attr(feature = "bindings", derive(TS))]
6120pub enum IntervalUnit {
6121 Year,
6122 Quarter,
6123 Month,
6124 Week,
6125 Day,
6126 Hour,
6127 Minute,
6128 Second,
6129 Millisecond,
6130 Microsecond,
6131 Nanosecond,
6132}
6133
6134#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6136#[cfg_attr(feature = "bindings", derive(TS))]
6137pub struct Command {
6138 pub this: String,
6140}
6141
6142#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6145#[cfg_attr(feature = "bindings", derive(TS))]
6146pub struct PrepareStatement {
6147 pub name: Identifier,
6149 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6151 pub parameter_types: Vec<DataType>,
6152 pub statement: Expression,
6154}
6155
6156#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6158#[cfg_attr(feature = "bindings", derive(TS))]
6159pub struct TryCatch {
6160 #[serde(default)]
6162 pub try_body: Vec<Expression>,
6163 #[serde(default, skip_serializing_if = "Option::is_none")]
6165 pub catch_body: Option<Vec<Expression>>,
6166}
6167
6168#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6171#[cfg_attr(feature = "bindings", derive(TS))]
6172pub struct ExecuteStatement {
6173 pub this: Expression,
6175 #[serde(default)]
6177 pub parameters: Vec<ExecuteParameter>,
6178 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6180 pub arguments: Vec<Expression>,
6181 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6183 pub prepared: bool,
6184 #[serde(default, skip_serializing_if = "Option::is_none")]
6186 pub suffix: Option<String>,
6187}
6188
6189#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6191#[cfg_attr(feature = "bindings", derive(TS))]
6192pub struct ExecuteParameter {
6193 pub name: String,
6195 pub value: Expression,
6197 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6199 pub positional: bool,
6200 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6202 pub output: bool,
6203}
6204
6205#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6208#[cfg_attr(feature = "bindings", derive(TS))]
6209pub struct Kill {
6210 pub this: Expression,
6212 pub kind: Option<String>,
6214}
6215
6216#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6218#[cfg_attr(feature = "bindings", derive(TS))]
6219pub struct CreateTask {
6220 pub or_replace: bool,
6221 pub if_not_exists: bool,
6222 pub name: String,
6224 pub properties: String,
6226 pub body: Expression,
6228}
6229
6230#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6232#[cfg_attr(feature = "bindings", derive(TS))]
6233pub struct Raw {
6234 pub sql: String,
6235}
6236
6237#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6243#[cfg_attr(feature = "bindings", derive(TS))]
6244pub struct UnaryFunc {
6245 pub this: Expression,
6246 #[serde(skip_serializing_if = "Option::is_none", default)]
6248 pub original_name: Option<String>,
6249 #[serde(default, skip_serializing_if = "Option::is_none")]
6251 #[ast(skip)]
6252 pub inferred_type: Option<DataType>,
6253}
6254
6255impl UnaryFunc {
6256 pub fn new(this: Expression) -> Self {
6258 Self {
6259 this,
6260 original_name: None,
6261 inferred_type: None,
6262 }
6263 }
6264
6265 pub fn with_name(this: Expression, name: String) -> Self {
6267 Self {
6268 this,
6269 original_name: Some(name),
6270 inferred_type: None,
6271 }
6272 }
6273}
6274
6275#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6279#[cfg_attr(feature = "bindings", derive(TS))]
6280pub struct CharFunc {
6281 pub args: Vec<Expression>,
6282 #[serde(skip_serializing_if = "Option::is_none", default)]
6283 pub charset: Option<String>,
6284 #[serde(skip_serializing_if = "Option::is_none", default)]
6286 pub name: Option<String>,
6287}
6288
6289#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6291#[cfg_attr(feature = "bindings", derive(TS))]
6292pub struct BinaryFunc {
6293 pub this: Expression,
6294 pub expression: Expression,
6295 #[serde(skip_serializing_if = "Option::is_none", default)]
6297 pub original_name: Option<String>,
6298 #[serde(default, skip_serializing_if = "Option::is_none")]
6300 #[ast(skip)]
6301 pub inferred_type: Option<DataType>,
6302}
6303
6304#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6306#[cfg_attr(feature = "bindings", derive(TS))]
6307pub struct VarArgFunc {
6308 pub expressions: Vec<Expression>,
6309 #[serde(skip_serializing_if = "Option::is_none", default)]
6311 pub original_name: Option<String>,
6312 #[serde(default, skip_serializing_if = "Option::is_none")]
6314 #[ast(skip)]
6315 pub inferred_type: Option<DataType>,
6316}
6317
6318#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6320#[cfg_attr(feature = "bindings", derive(TS))]
6321pub struct ConcatWs {
6322 pub separator: Expression,
6323 pub expressions: Vec<Expression>,
6324}
6325
6326#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6328#[cfg_attr(feature = "bindings", derive(TS))]
6329pub struct SubstringFunc {
6330 pub this: Expression,
6331 pub start: Expression,
6332 pub length: Option<Expression>,
6333 #[serde(default)]
6335 pub from_for_syntax: bool,
6336}
6337
6338#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6340#[cfg_attr(feature = "bindings", derive(TS))]
6341pub struct OverlayFunc {
6342 pub this: Expression,
6343 pub replacement: Expression,
6344 pub from: Expression,
6345 pub length: Option<Expression>,
6346}
6347
6348#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6350#[cfg_attr(feature = "bindings", derive(TS))]
6351pub struct TrimFunc {
6352 pub this: Expression,
6353 pub characters: Option<Expression>,
6354 pub position: TrimPosition,
6355 #[serde(default)]
6357 pub sql_standard_syntax: bool,
6358 #[serde(default)]
6360 pub position_explicit: bool,
6361}
6362
6363#[derive(
6364 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
6365)]
6366#[cfg_attr(feature = "bindings", derive(TS))]
6367pub enum TrimPosition {
6368 Both,
6369 Leading,
6370 Trailing,
6371}
6372
6373#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6375#[cfg_attr(feature = "bindings", derive(TS))]
6376pub struct ReplaceFunc {
6377 pub this: Expression,
6378 pub old: Expression,
6379 pub new: Expression,
6380}
6381
6382#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6384#[cfg_attr(feature = "bindings", derive(TS))]
6385pub struct LeftRightFunc {
6386 pub this: Expression,
6387 pub length: Expression,
6388}
6389
6390#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6392#[cfg_attr(feature = "bindings", derive(TS))]
6393pub struct RepeatFunc {
6394 pub this: Expression,
6395 pub times: Expression,
6396}
6397
6398#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6400#[cfg_attr(feature = "bindings", derive(TS))]
6401pub struct PadFunc {
6402 pub this: Expression,
6403 pub length: Expression,
6404 pub fill: Option<Expression>,
6405}
6406
6407#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6409#[cfg_attr(feature = "bindings", derive(TS))]
6410pub struct SplitFunc {
6411 pub this: Expression,
6412 pub delimiter: Expression,
6413}
6414
6415#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6417#[cfg_attr(feature = "bindings", derive(TS))]
6418pub struct RegexpFunc {
6419 pub this: Expression,
6420 pub pattern: Expression,
6421 pub flags: Option<Expression>,
6422}
6423
6424#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6426#[cfg_attr(feature = "bindings", derive(TS))]
6427pub struct RegexpReplaceFunc {
6428 pub this: Expression,
6429 pub pattern: Expression,
6430 pub replacement: Expression,
6431 pub flags: Option<Expression>,
6432}
6433
6434#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6436#[cfg_attr(feature = "bindings", derive(TS))]
6437pub struct RegexpExtractFunc {
6438 pub this: Expression,
6439 pub pattern: Expression,
6440 pub group: Option<Expression>,
6441}
6442
6443#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6445#[cfg_attr(feature = "bindings", derive(TS))]
6446pub struct RoundFunc {
6447 pub this: Expression,
6448 pub decimals: Option<Expression>,
6449}
6450
6451#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6453#[cfg_attr(feature = "bindings", derive(TS))]
6454pub struct FloorFunc {
6455 pub this: Expression,
6456 pub scale: Option<Expression>,
6457 #[serde(skip_serializing_if = "Option::is_none", default)]
6459 pub to: Option<Expression>,
6460}
6461
6462#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6464#[cfg_attr(feature = "bindings", derive(TS))]
6465pub struct CeilFunc {
6466 pub this: Expression,
6467 #[serde(skip_serializing_if = "Option::is_none", default)]
6468 pub decimals: Option<Expression>,
6469 #[serde(skip_serializing_if = "Option::is_none", default)]
6471 pub to: Option<Expression>,
6472}
6473
6474#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6476#[cfg_attr(feature = "bindings", derive(TS))]
6477pub struct LogFunc {
6478 pub this: Expression,
6479 pub base: Option<Expression>,
6480}
6481
6482#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6484#[cfg_attr(feature = "bindings", derive(TS))]
6485pub struct CurrentDate;
6486
6487#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6489#[cfg_attr(feature = "bindings", derive(TS))]
6490pub struct CurrentTime {
6491 pub precision: Option<u32>,
6492}
6493
6494#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6496#[cfg_attr(feature = "bindings", derive(TS))]
6497pub struct CurrentTimestamp {
6498 pub precision: Option<u32>,
6499 #[serde(default)]
6501 pub sysdate: bool,
6502}
6503
6504#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6506#[cfg_attr(feature = "bindings", derive(TS))]
6507pub struct CurrentTimestampLTZ {
6508 pub precision: Option<u32>,
6509}
6510
6511#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6513#[cfg_attr(feature = "bindings", derive(TS))]
6514pub struct AtTimeZone {
6515 pub this: Expression,
6517 pub zone: Expression,
6519}
6520
6521#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6523#[cfg_attr(feature = "bindings", derive(TS))]
6524pub struct DateAddFunc {
6525 pub this: Expression,
6526 pub interval: Expression,
6527 pub unit: IntervalUnit,
6528}
6529
6530#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6532#[cfg_attr(feature = "bindings", derive(TS))]
6533pub struct DateDiffFunc {
6534 pub this: Expression,
6535 pub expression: Expression,
6536 pub unit: Option<IntervalUnit>,
6537}
6538
6539#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6541#[cfg_attr(feature = "bindings", derive(TS))]
6542pub struct DateTruncFunc {
6543 pub this: Expression,
6544 pub unit: DateTimeField,
6545}
6546
6547#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6549#[cfg_attr(feature = "bindings", derive(TS))]
6550pub struct ExtractFunc {
6551 pub this: Expression,
6552 pub field: DateTimeField,
6553}
6554
6555#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6556#[cfg_attr(feature = "bindings", derive(TS))]
6557pub enum DateTimeField {
6558 Year,
6559 Month,
6560 Day,
6561 Hour,
6562 Minute,
6563 Second,
6564 Millisecond,
6565 Microsecond,
6566 DayOfWeek,
6567 DayOfYear,
6568 Week,
6569 WeekWithModifier(String),
6571 Quarter,
6572 Epoch,
6573 Timezone,
6574 TimezoneHour,
6575 TimezoneMinute,
6576 Date,
6577 Time,
6578 Custom(String),
6580}
6581
6582#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6584#[cfg_attr(feature = "bindings", derive(TS))]
6585pub struct ToDateFunc {
6586 pub this: Expression,
6587 pub format: Option<Expression>,
6588}
6589
6590#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6592#[cfg_attr(feature = "bindings", derive(TS))]
6593pub struct ToTimestampFunc {
6594 pub this: Expression,
6595 pub format: Option<Expression>,
6596}
6597
6598#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6600#[cfg_attr(feature = "bindings", derive(TS))]
6601pub struct IfFunc {
6602 pub condition: Expression,
6603 pub true_value: Expression,
6604 pub false_value: Option<Expression>,
6605 #[serde(skip_serializing_if = "Option::is_none", default)]
6607 pub original_name: Option<String>,
6608 #[serde(default, skip_serializing_if = "Option::is_none")]
6610 #[ast(skip)]
6611 pub inferred_type: Option<DataType>,
6612}
6613
6614#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6616#[cfg_attr(feature = "bindings", derive(TS))]
6617pub struct Nvl2Func {
6618 pub this: Expression,
6619 pub true_value: Expression,
6620 pub false_value: Expression,
6621 #[serde(default, skip_serializing_if = "Option::is_none")]
6623 #[ast(skip)]
6624 pub inferred_type: Option<DataType>,
6625}
6626
6627#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6633#[cfg_attr(feature = "bindings", derive(TS))]
6634pub struct AggFunc {
6635 pub this: Expression,
6636 pub distinct: bool,
6637 pub filter: Option<Expression>,
6638 pub order_by: Vec<Ordered>,
6639 #[serde(skip_serializing_if = "Option::is_none", default)]
6641 pub name: Option<String>,
6642 #[serde(skip_serializing_if = "Option::is_none", default)]
6644 pub ignore_nulls: Option<bool>,
6645 #[serde(skip_serializing_if = "Option::is_none", default)]
6648 pub having_max: Option<(Box<Expression>, bool)>,
6649 #[serde(skip_serializing_if = "Option::is_none", default)]
6651 pub limit: Option<Box<Expression>>,
6652 #[serde(default, skip_serializing_if = "Option::is_none")]
6654 #[ast(skip)]
6655 pub inferred_type: Option<DataType>,
6656}
6657
6658#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6660#[cfg_attr(feature = "bindings", derive(TS))]
6661pub struct CountFunc {
6662 pub this: Option<Expression>,
6663 pub star: bool,
6664 pub distinct: bool,
6665 pub filter: Option<Expression>,
6666 #[serde(default, skip_serializing_if = "Option::is_none")]
6668 pub ignore_nulls: Option<bool>,
6669 #[serde(default, skip_serializing_if = "Option::is_none")]
6671 pub original_name: Option<String>,
6672 #[serde(default, skip_serializing_if = "Option::is_none")]
6674 #[ast(skip)]
6675 pub inferred_type: Option<DataType>,
6676}
6677
6678#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6680#[cfg_attr(feature = "bindings", derive(TS))]
6681pub struct GroupConcatFunc {
6682 pub this: Expression,
6683 pub separator: Option<Expression>,
6684 pub order_by: Option<Vec<Ordered>>,
6685 pub distinct: bool,
6686 pub filter: Option<Expression>,
6687 #[serde(default, skip_serializing_if = "Option::is_none")]
6689 pub limit: Option<Box<Expression>>,
6690 #[serde(default, skip_serializing_if = "Option::is_none")]
6692 #[ast(skip)]
6693 pub inferred_type: Option<DataType>,
6694}
6695
6696#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6698#[cfg_attr(feature = "bindings", derive(TS))]
6699pub struct StringAggFunc {
6700 pub this: Expression,
6701 #[serde(default)]
6702 pub separator: Option<Expression>,
6703 #[serde(default)]
6704 pub order_by: Option<Vec<Ordered>>,
6705 #[serde(default)]
6706 pub distinct: bool,
6707 #[serde(default)]
6708 pub filter: Option<Expression>,
6709 #[serde(default, skip_serializing_if = "Option::is_none")]
6711 pub limit: Option<Box<Expression>>,
6712 #[serde(default, skip_serializing_if = "Option::is_none")]
6714 #[ast(skip)]
6715 pub inferred_type: Option<DataType>,
6716}
6717
6718#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6720#[cfg_attr(feature = "bindings", derive(TS))]
6721pub struct ListAggFunc {
6722 pub this: Expression,
6723 pub separator: Option<Expression>,
6724 pub on_overflow: Option<ListAggOverflow>,
6725 pub order_by: Option<Vec<Ordered>>,
6726 pub distinct: bool,
6727 pub filter: Option<Expression>,
6728 #[serde(default, skip_serializing_if = "Option::is_none")]
6730 #[ast(skip)]
6731 pub inferred_type: Option<DataType>,
6732}
6733
6734#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6736#[cfg_attr(feature = "bindings", derive(TS))]
6737pub enum ListAggOverflow {
6738 Error,
6739 Truncate {
6740 filler: Option<Expression>,
6741 with_count: bool,
6742 },
6743}
6744
6745#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6747#[cfg_attr(feature = "bindings", derive(TS))]
6748pub struct SumIfFunc {
6749 pub this: Expression,
6750 pub condition: Expression,
6751 pub filter: Option<Expression>,
6752 #[serde(default, skip_serializing_if = "Option::is_none")]
6754 #[ast(skip)]
6755 pub inferred_type: Option<DataType>,
6756}
6757
6758#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6760#[cfg_attr(feature = "bindings", derive(TS))]
6761pub struct ApproxPercentileFunc {
6762 pub this: Expression,
6763 pub percentile: Expression,
6764 pub accuracy: Option<Expression>,
6765 pub filter: Option<Expression>,
6766}
6767
6768#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6770#[cfg_attr(feature = "bindings", derive(TS))]
6771pub struct PercentileFunc {
6772 pub this: Expression,
6773 pub percentile: Expression,
6774 pub order_by: Option<Vec<Ordered>>,
6775 pub filter: Option<Expression>,
6776}
6777
6778#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6784#[cfg_attr(feature = "bindings", derive(TS))]
6785pub struct RowNumber;
6786
6787#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6789#[cfg_attr(feature = "bindings", derive(TS))]
6790pub struct Rank {
6791 #[serde(default, skip_serializing_if = "Option::is_none")]
6793 pub order_by: Option<Vec<Ordered>>,
6794 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6796 pub args: Vec<Expression>,
6797}
6798
6799#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6801#[cfg_attr(feature = "bindings", derive(TS))]
6802pub struct DenseRank {
6803 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6805 pub args: Vec<Expression>,
6806}
6807
6808#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6810#[cfg_attr(feature = "bindings", derive(TS))]
6811pub struct NTileFunc {
6812 #[serde(default, skip_serializing_if = "Option::is_none")]
6814 pub num_buckets: Option<Expression>,
6815 #[serde(default, skip_serializing_if = "Option::is_none")]
6817 pub order_by: Option<Vec<Ordered>>,
6818}
6819
6820#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6822#[cfg_attr(feature = "bindings", derive(TS))]
6823pub struct LeadLagFunc {
6824 pub this: Expression,
6825 pub offset: Option<Expression>,
6826 pub default: Option<Expression>,
6827 #[serde(default, skip_serializing_if = "Option::is_none")]
6829 pub ignore_nulls: Option<bool>,
6830}
6831
6832#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6834#[cfg_attr(feature = "bindings", derive(TS))]
6835pub struct ValueFunc {
6836 pub this: Expression,
6837 #[serde(default, skip_serializing_if = "Option::is_none")]
6839 pub ignore_nulls: Option<bool>,
6840 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6842 pub order_by: Vec<Ordered>,
6843}
6844
6845#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6847#[cfg_attr(feature = "bindings", derive(TS))]
6848pub struct NthValueFunc {
6849 pub this: Expression,
6850 pub offset: Expression,
6851 #[serde(default, skip_serializing_if = "Option::is_none")]
6853 pub ignore_nulls: Option<bool>,
6854 #[serde(default, skip_serializing_if = "Option::is_none")]
6857 pub from_first: Option<bool>,
6858}
6859
6860#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6862#[cfg_attr(feature = "bindings", derive(TS))]
6863pub struct PercentRank {
6864 #[serde(default, skip_serializing_if = "Option::is_none")]
6866 pub order_by: Option<Vec<Ordered>>,
6867 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6869 pub args: Vec<Expression>,
6870}
6871
6872#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6874#[cfg_attr(feature = "bindings", derive(TS))]
6875pub struct CumeDist {
6876 #[serde(default, skip_serializing_if = "Option::is_none")]
6878 pub order_by: Option<Vec<Ordered>>,
6879 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6881 pub args: Vec<Expression>,
6882}
6883
6884#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6890#[cfg_attr(feature = "bindings", derive(TS))]
6891pub struct PositionFunc {
6892 pub substring: Expression,
6893 pub string: Expression,
6894 pub start: Option<Expression>,
6895}
6896
6897#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6903#[cfg_attr(feature = "bindings", derive(TS))]
6904pub struct Random;
6905
6906#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6908#[cfg_attr(feature = "bindings", derive(TS))]
6909pub struct Rand {
6910 pub seed: Option<Box<Expression>>,
6911 #[serde(default)]
6913 pub lower: Option<Box<Expression>>,
6914 #[serde(default)]
6916 pub upper: Option<Box<Expression>>,
6917}
6918
6919#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6921#[cfg_attr(feature = "bindings", derive(TS))]
6922pub struct TruncateFunc {
6923 pub this: Expression,
6924 pub decimals: Option<Expression>,
6925}
6926
6927#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6929#[cfg_attr(feature = "bindings", derive(TS))]
6930pub struct Pi;
6931
6932#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6938#[cfg_attr(feature = "bindings", derive(TS))]
6939pub struct DecodeFunc {
6940 pub this: Expression,
6941 pub search_results: Vec<(Expression, Expression)>,
6942 pub default: Option<Expression>,
6943}
6944
6945#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6951#[cfg_attr(feature = "bindings", derive(TS))]
6952pub struct DateFormatFunc {
6953 pub this: Expression,
6954 pub format: Expression,
6955}
6956
6957#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6959#[cfg_attr(feature = "bindings", derive(TS))]
6960pub struct FromUnixtimeFunc {
6961 pub this: Expression,
6962 pub format: Option<Expression>,
6963}
6964
6965#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6967#[cfg_attr(feature = "bindings", derive(TS))]
6968pub struct UnixTimestampFunc {
6969 pub this: Option<Expression>,
6970 pub format: Option<Expression>,
6971}
6972
6973#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6975#[cfg_attr(feature = "bindings", derive(TS))]
6976pub struct MakeDateFunc {
6977 pub year: Expression,
6978 pub month: Expression,
6979 pub day: Expression,
6980}
6981
6982#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6984#[cfg_attr(feature = "bindings", derive(TS))]
6985pub struct MakeTimestampFunc {
6986 pub year: Expression,
6987 pub month: Expression,
6988 pub day: Expression,
6989 pub hour: Expression,
6990 pub minute: Expression,
6991 pub second: Expression,
6992 pub timezone: Option<Expression>,
6993}
6994
6995#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6997#[cfg_attr(feature = "bindings", derive(TS))]
6998pub struct LastDayFunc {
6999 pub this: Expression,
7000 #[serde(skip_serializing_if = "Option::is_none", default)]
7002 pub unit: Option<DateTimeField>,
7003}
7004
7005#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7011#[cfg_attr(feature = "bindings", derive(TS))]
7012pub struct ArrayConstructor {
7013 pub expressions: Vec<Expression>,
7014 pub bracket_notation: bool,
7015 pub use_list_keyword: bool,
7017}
7018
7019#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7021#[cfg_attr(feature = "bindings", derive(TS))]
7022pub struct ArraySortFunc {
7023 pub this: Expression,
7024 pub comparator: Option<Expression>,
7025 pub desc: bool,
7026 pub nulls_first: Option<bool>,
7027}
7028
7029#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7031#[cfg_attr(feature = "bindings", derive(TS))]
7032pub struct ArrayJoinFunc {
7033 pub this: Expression,
7034 pub separator: Expression,
7035 pub null_replacement: Option<Expression>,
7036}
7037
7038#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7040#[cfg_attr(feature = "bindings", derive(TS))]
7041pub struct UnnestFunc {
7042 pub this: Expression,
7043 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7045 pub expressions: Vec<Expression>,
7046 pub with_ordinality: bool,
7047 pub alias: Option<Identifier>,
7048 #[serde(default, skip_serializing_if = "Option::is_none")]
7050 pub offset_alias: Option<Identifier>,
7051 #[serde(default, skip_serializing_if = "Option::is_none")]
7053 #[ast(skip)]
7054 pub inferred_type: Option<DataType>,
7055}
7056
7057#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7059#[cfg_attr(feature = "bindings", derive(TS))]
7060pub struct ArrayFilterFunc {
7061 pub this: Expression,
7062 pub filter: Expression,
7063}
7064
7065#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7067#[cfg_attr(feature = "bindings", derive(TS))]
7068pub struct ArrayTransformFunc {
7069 pub this: Expression,
7070 pub transform: Expression,
7071}
7072
7073#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7075#[cfg_attr(feature = "bindings", derive(TS))]
7076pub struct SequenceFunc {
7077 pub start: Expression,
7078 pub stop: Expression,
7079 pub step: Option<Expression>,
7080}
7081
7082#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7088#[cfg_attr(feature = "bindings", derive(TS))]
7089pub struct StructConstructor {
7090 pub fields: Vec<(Option<Identifier>, Expression)>,
7091}
7092
7093#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7095#[cfg_attr(feature = "bindings", derive(TS))]
7096pub struct StructExtractFunc {
7097 pub this: Expression,
7098 pub field: Identifier,
7099}
7100
7101#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7103#[cfg_attr(feature = "bindings", derive(TS))]
7104pub struct NamedStructFunc {
7105 pub pairs: Vec<(Expression, Expression)>,
7106}
7107
7108#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7114#[cfg_attr(feature = "bindings", derive(TS))]
7115pub struct MapConstructor {
7116 pub keys: Vec<Expression>,
7117 pub values: Vec<Expression>,
7118 #[serde(default)]
7120 pub curly_brace_syntax: bool,
7121 #[serde(default)]
7123 pub with_map_keyword: bool,
7124}
7125
7126#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7128#[cfg_attr(feature = "bindings", derive(TS))]
7129pub struct TransformFunc {
7130 pub this: Expression,
7131 pub transform: Expression,
7132}
7133
7134#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7137#[cfg_attr(feature = "bindings", derive(TS))]
7138pub struct FunctionEmits {
7139 pub this: Expression,
7141 pub emits: Expression,
7143}
7144
7145#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7151#[cfg_attr(feature = "bindings", derive(TS))]
7152pub struct JsonExtractFunc {
7153 pub this: Expression,
7154 pub path: Expression,
7155 pub returning: Option<DataType>,
7156 #[serde(default)]
7158 pub arrow_syntax: bool,
7159 #[serde(default)]
7161 pub hash_arrow_syntax: bool,
7162 #[serde(default)]
7164 pub wrapper_option: Option<String>,
7165 #[serde(default)]
7167 pub quotes_option: Option<String>,
7168 #[serde(default)]
7170 pub on_scalar_string: bool,
7171 #[serde(default)]
7173 pub on_error: Option<String>,
7174}
7175
7176#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7178#[cfg_attr(feature = "bindings", derive(TS))]
7179pub struct JsonPathFunc {
7180 pub this: Expression,
7181 pub paths: Vec<Expression>,
7182}
7183
7184#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7186#[cfg_attr(feature = "bindings", derive(TS))]
7187pub struct JsonObjectFunc {
7188 pub pairs: Vec<(Expression, Expression)>,
7189 pub null_handling: Option<JsonNullHandling>,
7190 #[serde(default)]
7191 pub with_unique_keys: bool,
7192 #[serde(default)]
7193 pub returning_type: Option<DataType>,
7194 #[serde(default)]
7195 pub format_json: bool,
7196 #[serde(default)]
7197 pub encoding: Option<String>,
7198 #[serde(default)]
7200 pub star: bool,
7201}
7202
7203#[derive(
7205 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
7206)]
7207#[cfg_attr(feature = "bindings", derive(TS))]
7208pub enum JsonNullHandling {
7209 NullOnNull,
7210 AbsentOnNull,
7211}
7212
7213#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7215#[cfg_attr(feature = "bindings", derive(TS))]
7216pub struct JsonModifyFunc {
7217 pub this: Expression,
7218 pub path_values: Vec<(Expression, Expression)>,
7219}
7220
7221#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7223#[cfg_attr(feature = "bindings", derive(TS))]
7224pub struct JsonArrayAggFunc {
7225 pub this: Expression,
7226 pub order_by: Option<Vec<Ordered>>,
7227 pub null_handling: Option<JsonNullHandling>,
7228 pub filter: Option<Expression>,
7229}
7230
7231#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7233#[cfg_attr(feature = "bindings", derive(TS))]
7234pub struct JsonObjectAggFunc {
7235 pub key: Expression,
7236 pub value: Expression,
7237 pub null_handling: Option<JsonNullHandling>,
7238 pub filter: Option<Expression>,
7239}
7240
7241#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7247#[cfg_attr(feature = "bindings", derive(TS))]
7248pub struct ConvertFunc {
7249 pub this: Expression,
7250 pub to: DataType,
7251 pub style: Option<Expression>,
7252}
7253
7254#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7260#[cfg_attr(feature = "bindings", derive(TS))]
7261pub struct LambdaExpr {
7262 pub parameters: Vec<Identifier>,
7263 pub body: Expression,
7264 #[serde(default)]
7266 pub colon: bool,
7267 #[serde(default)]
7270 pub parameter_types: Vec<Option<DataType>>,
7271}
7272
7273#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7275#[cfg_attr(feature = "bindings", derive(TS))]
7276pub struct Parameter {
7277 pub name: Option<String>,
7278 pub index: Option<u32>,
7279 pub style: ParameterStyle,
7280 #[serde(default)]
7282 pub quoted: bool,
7283 #[serde(default)]
7285 pub string_quoted: bool,
7286 #[serde(default)]
7288 pub expression: Option<String>,
7289}
7290
7291#[derive(
7293 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
7294)]
7295#[cfg_attr(feature = "bindings", derive(TS))]
7296pub enum ParameterStyle {
7297 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7307
7308#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7310#[cfg_attr(feature = "bindings", derive(TS))]
7311pub struct Placeholder {
7312 pub index: Option<u32>,
7313}
7314
7315#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7317#[cfg_attr(feature = "bindings", derive(TS))]
7318pub struct NamedArgument {
7319 pub name: Identifier,
7320 pub value: Expression,
7321 pub separator: NamedArgSeparator,
7323}
7324
7325#[derive(
7327 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
7328)]
7329#[cfg_attr(feature = "bindings", derive(TS))]
7330pub enum NamedArgSeparator {
7331 DArrow,
7333 ColonEq,
7335 Eq,
7337}
7338
7339#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7342#[cfg_attr(feature = "bindings", derive(TS))]
7343pub struct TableArgument {
7344 pub prefix: String,
7346 pub this: Expression,
7348}
7349
7350#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7352#[cfg_attr(feature = "bindings", derive(TS))]
7353pub struct SqlComment {
7354 pub text: String,
7355 pub is_block: bool,
7356}
7357
7358#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7364#[cfg_attr(feature = "bindings", derive(TS))]
7365pub struct SimilarToExpr {
7366 pub this: Expression,
7367 pub pattern: Expression,
7368 pub escape: Option<Expression>,
7369 pub not: bool,
7370}
7371
7372#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7374#[cfg_attr(feature = "bindings", derive(TS))]
7375pub struct QuantifiedExpr {
7376 pub this: Expression,
7377 pub subquery: Expression,
7378 pub op: Option<QuantifiedOp>,
7379}
7380
7381#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7383#[cfg_attr(feature = "bindings", derive(TS))]
7384pub enum QuantifiedOp {
7385 Eq,
7386 Neq,
7387 Lt,
7388 Lte,
7389 Gt,
7390 Gte,
7391}
7392
7393#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7398#[cfg_attr(feature = "bindings", derive(TS))]
7399pub struct OverlapsExpr {
7400 #[serde(skip_serializing_if = "Option::is_none")]
7402 pub this: Option<Expression>,
7403 #[serde(skip_serializing_if = "Option::is_none")]
7405 pub expression: Option<Expression>,
7406 #[serde(skip_serializing_if = "Option::is_none")]
7408 pub left_start: Option<Expression>,
7409 #[serde(skip_serializing_if = "Option::is_none")]
7411 pub left_end: Option<Expression>,
7412 #[serde(skip_serializing_if = "Option::is_none")]
7414 pub right_start: Option<Expression>,
7415 #[serde(skip_serializing_if = "Option::is_none")]
7417 pub right_end: Option<Expression>,
7418}
7419
7420#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7426#[cfg_attr(feature = "bindings", derive(TS))]
7427pub struct Subscript {
7428 pub this: Expression,
7429 pub index: Expression,
7430}
7431
7432#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7434#[cfg_attr(feature = "bindings", derive(TS))]
7435pub struct DotAccess {
7436 pub this: Expression,
7437 pub field: Identifier,
7438}
7439
7440#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7442#[cfg_attr(feature = "bindings", derive(TS))]
7443pub struct MethodCall {
7444 pub this: Expression,
7445 pub method: Identifier,
7446 pub args: Vec<Expression>,
7447}
7448
7449#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7451#[cfg_attr(feature = "bindings", derive(TS))]
7452pub struct ArraySlice {
7453 pub this: Expression,
7454 pub start: Option<Expression>,
7455 pub end: Option<Expression>,
7456}
7457
7458#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7464#[cfg_attr(feature = "bindings", derive(TS))]
7465pub enum OnCommit {
7466 PreserveRows,
7468 DeleteRows,
7470}
7471
7472#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7474#[cfg_attr(feature = "bindings", derive(TS))]
7475pub struct TiDBAutoRandom {
7476 #[serde(default, skip_serializing_if = "Option::is_none")]
7477 pub shard_bits: Option<u64>,
7478 #[serde(default, skip_serializing_if = "Option::is_none")]
7479 pub range_bits: Option<u64>,
7480 #[serde(default)]
7482 pub executable_comment: bool,
7483}
7484
7485#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7487#[cfg_attr(feature = "bindings", derive(TS))]
7488pub struct TiDBTableOption {
7489 pub kind: TiDBTableOptionKind,
7490 #[serde(default)]
7492 pub executable_comment: bool,
7493}
7494
7495#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7497#[cfg_attr(feature = "bindings", derive(TS))]
7498#[serde(tag = "type", rename_all = "snake_case")]
7499pub enum TiDBTableOptionKind {
7500 ShardRowIdBits {
7501 bits: u64,
7502 },
7503 PreSplitRegions {
7504 regions: u64,
7505 },
7506 AutoRandomBase {
7507 value: u64,
7508 },
7509 PlacementPolicy {
7511 policy: Option<Identifier>,
7512 },
7513 Ttl {
7514 column: Identifier,
7515 interval: Interval,
7516 #[serde(default, skip_serializing_if = "Option::is_none")]
7517 enabled: Option<bool>,
7518 },
7519 TtlEnable {
7520 enabled: bool,
7521 },
7522 TtlJobInterval {
7523 interval: String,
7524 },
7525}
7526
7527#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7529#[cfg_attr(feature = "bindings", derive(TS))]
7530pub struct CreateTable {
7531 pub name: TableRef,
7532 #[serde(default, skip_serializing_if = "Option::is_none")]
7534 pub on_cluster: Option<OnCluster>,
7535 pub columns: Vec<ColumnDef>,
7536 pub constraints: Vec<TableConstraint>,
7537 pub if_not_exists: bool,
7538 pub temporary: bool,
7539 pub or_replace: bool,
7540 #[serde(default, skip_serializing_if = "Option::is_none")]
7542 pub table_modifier: Option<String>,
7543 pub as_select: Option<Expression>,
7544 #[serde(default)]
7546 pub as_select_parenthesized: bool,
7547 #[serde(default)]
7549 pub on_commit: Option<OnCommit>,
7550 #[serde(default)]
7552 pub clone_source: Option<TableRef>,
7553 #[serde(default, skip_serializing_if = "Option::is_none")]
7555 pub clone_at_clause: Option<Expression>,
7556 #[serde(default)]
7558 pub is_copy: bool,
7559 #[serde(default)]
7561 pub shallow_clone: bool,
7562 #[serde(default)]
7564 pub deep_clone: bool,
7565 #[serde(default)]
7567 pub leading_comments: Vec<String>,
7568 #[serde(default)]
7570 pub with_properties: Vec<(String, String)>,
7571 #[serde(default)]
7573 pub teradata_post_name_options: Vec<String>,
7574 #[serde(default)]
7576 pub with_data: Option<bool>,
7577 #[serde(default)]
7579 pub with_statistics: Option<bool>,
7580 #[serde(default)]
7582 pub teradata_indexes: Vec<TeradataIndex>,
7583 #[serde(default)]
7585 pub with_cte: Option<With>,
7586 #[serde(default)]
7588 pub properties: Vec<Expression>,
7589 #[serde(default, skip_serializing_if = "Option::is_none")]
7591 pub partition_of: Option<Expression>,
7592 #[serde(default)]
7594 pub post_table_properties: Vec<Expression>,
7595 #[serde(default)]
7597 pub mysql_table_options: Vec<(String, String)>,
7598 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7600 pub tidb_table_options: Vec<TiDBTableOption>,
7601 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7603 pub inherits: Vec<TableRef>,
7604 #[serde(default, skip_serializing_if = "Option::is_none")]
7606 pub on_property: Option<OnProperty>,
7607 #[serde(default)]
7609 pub copy_grants: bool,
7610 #[serde(default, skip_serializing_if = "Option::is_none")]
7612 pub using_template: Option<Box<Expression>>,
7613 #[serde(default, skip_serializing_if = "Option::is_none")]
7615 pub rollup: Option<RollupProperty>,
7616 #[serde(default, skip_serializing_if = "Option::is_none")]
7618 pub uuid: Option<String>,
7619 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7623 pub with_partition_columns: Vec<ColumnDef>,
7624 #[serde(default, skip_serializing_if = "Option::is_none")]
7627 pub with_connection: Option<TableRef>,
7628}
7629
7630#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7632#[cfg_attr(feature = "bindings", derive(TS))]
7633pub struct TeradataIndex {
7634 pub kind: TeradataIndexKind,
7636 pub name: Option<String>,
7638 pub columns: Vec<String>,
7640}
7641
7642#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7644#[cfg_attr(feature = "bindings", derive(TS))]
7645pub enum TeradataIndexKind {
7646 NoPrimary,
7648 Primary,
7650 PrimaryAmp,
7652 Unique,
7654 UniquePrimary,
7656 Secondary,
7658}
7659
7660impl CreateTable {
7661 pub fn new(name: impl Into<String>) -> Self {
7662 Self {
7663 name: TableRef::new(name),
7664 on_cluster: None,
7665 columns: Vec::new(),
7666 constraints: Vec::new(),
7667 if_not_exists: false,
7668 temporary: false,
7669 or_replace: false,
7670 table_modifier: None,
7671 as_select: None,
7672 as_select_parenthesized: false,
7673 on_commit: None,
7674 clone_source: None,
7675 clone_at_clause: None,
7676 shallow_clone: false,
7677 deep_clone: false,
7678 is_copy: false,
7679 leading_comments: Vec::new(),
7680 with_properties: Vec::new(),
7681 teradata_post_name_options: Vec::new(),
7682 with_data: None,
7683 with_statistics: None,
7684 teradata_indexes: Vec::new(),
7685 with_cte: None,
7686 properties: Vec::new(),
7687 partition_of: None,
7688 post_table_properties: Vec::new(),
7689 mysql_table_options: Vec::new(),
7690 tidb_table_options: Vec::new(),
7691 inherits: Vec::new(),
7692 on_property: None,
7693 copy_grants: false,
7694 using_template: None,
7695 rollup: None,
7696 uuid: None,
7697 with_partition_columns: Vec::new(),
7698 with_connection: None,
7699 }
7700 }
7701}
7702
7703#[derive(
7705 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Serialize, Deserialize,
7706)]
7707#[cfg_attr(feature = "bindings", derive(TS))]
7708pub enum SortOrder {
7709 Asc,
7710 Desc,
7711}
7712
7713#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7715#[cfg_attr(feature = "bindings", derive(TS))]
7716pub enum ConstraintType {
7717 NotNull,
7718 Null,
7719 PrimaryKey,
7720 Unique,
7721 Default,
7722 AutoIncrement,
7723 AutoRandom,
7724 Collate,
7725 Comment,
7726 References,
7727 Check,
7728 GeneratedAsIdentity,
7729 Tags,
7731 ComputedColumn,
7733 GeneratedAsRow,
7735 OnUpdate,
7737 Path,
7739 Encode,
7741}
7742
7743#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7745#[cfg_attr(feature = "bindings", derive(TS))]
7746pub struct ColumnDef {
7747 pub name: Identifier,
7748 pub data_type: DataType,
7749 pub nullable: Option<bool>,
7750 pub default: Option<Expression>,
7751 pub primary_key: bool,
7752 #[serde(default)]
7754 pub primary_key_order: Option<SortOrder>,
7755 pub unique: bool,
7756 #[serde(default)]
7758 pub unique_nulls_not_distinct: bool,
7759 pub auto_increment: bool,
7760 #[serde(default, skip_serializing_if = "Option::is_none")]
7762 pub auto_random: Option<TiDBAutoRandom>,
7763 pub comment: Option<String>,
7764 pub constraints: Vec<ColumnConstraint>,
7765 #[serde(default)]
7767 pub constraint_order: Vec<ConstraintType>,
7768 #[serde(default)]
7770 pub format: Option<String>,
7771 #[serde(default)]
7773 pub title: Option<String>,
7774 #[serde(default)]
7776 pub inline_length: Option<u64>,
7777 #[serde(default)]
7779 pub compress: Option<Vec<Expression>>,
7780 #[serde(default)]
7782 pub character_set: Option<String>,
7783 #[serde(default)]
7785 pub uppercase: bool,
7786 #[serde(default)]
7788 pub casespecific: Option<bool>,
7789 #[serde(default)]
7791 pub auto_increment_start: Option<Box<Expression>>,
7792 #[serde(default)]
7794 pub auto_increment_increment: Option<Box<Expression>>,
7795 #[serde(default)]
7797 pub auto_increment_order: Option<bool>,
7798 #[serde(default)]
7800 pub unsigned: bool,
7801 #[serde(default)]
7803 pub zerofill: bool,
7804 #[serde(default, skip_serializing_if = "Option::is_none")]
7806 pub on_update: Option<Expression>,
7807 #[serde(default, skip_serializing_if = "Option::is_none")]
7809 pub visible: Option<bool>,
7810 #[serde(default, skip_serializing_if = "Option::is_none")]
7812 pub unique_constraint_name: Option<String>,
7813 #[serde(default, skip_serializing_if = "Option::is_none")]
7815 pub not_null_constraint_name: Option<String>,
7816 #[serde(default, skip_serializing_if = "Option::is_none")]
7818 pub primary_key_constraint_name: Option<String>,
7819 #[serde(default, skip_serializing_if = "Option::is_none")]
7821 pub check_constraint_name: Option<String>,
7822 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7824 pub options: Vec<Expression>,
7825 #[serde(default)]
7827 pub no_type: bool,
7828 #[serde(default, skip_serializing_if = "Option::is_none")]
7830 pub encoding: Option<String>,
7831 #[serde(default, skip_serializing_if = "Option::is_none")]
7833 pub codec: Option<String>,
7834 #[serde(default, skip_serializing_if = "Option::is_none")]
7836 pub ephemeral: Option<Option<Box<Expression>>>,
7837 #[serde(default, skip_serializing_if = "Option::is_none")]
7839 pub materialized_expr: Option<Box<Expression>>,
7840 #[serde(default, skip_serializing_if = "Option::is_none")]
7842 pub alias_expr: Option<Box<Expression>>,
7843 #[serde(default, skip_serializing_if = "Option::is_none")]
7845 pub ttl_expr: Option<Box<Expression>>,
7846 #[serde(default)]
7848 pub not_for_replication: bool,
7849}
7850
7851impl ColumnDef {
7852 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7853 Self {
7854 name: Identifier::new(name),
7855 data_type,
7856 nullable: None,
7857 default: None,
7858 primary_key: false,
7859 primary_key_order: None,
7860 unique: false,
7861 unique_nulls_not_distinct: false,
7862 auto_increment: false,
7863 auto_random: None,
7864 comment: None,
7865 constraints: Vec::new(),
7866 constraint_order: Vec::new(),
7867 format: None,
7868 title: None,
7869 inline_length: None,
7870 compress: None,
7871 character_set: None,
7872 uppercase: false,
7873 casespecific: None,
7874 auto_increment_start: None,
7875 auto_increment_increment: None,
7876 auto_increment_order: None,
7877 unsigned: false,
7878 zerofill: false,
7879 on_update: None,
7880 visible: None,
7881 unique_constraint_name: None,
7882 not_null_constraint_name: None,
7883 primary_key_constraint_name: None,
7884 check_constraint_name: None,
7885 options: Vec::new(),
7886 no_type: false,
7887 encoding: None,
7888 codec: None,
7889 ephemeral: None,
7890 materialized_expr: None,
7891 alias_expr: None,
7892 ttl_expr: None,
7893 not_for_replication: false,
7894 }
7895 }
7896}
7897
7898#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7900#[cfg_attr(feature = "bindings", derive(TS))]
7901pub enum ColumnConstraint {
7902 NotNull,
7903 Null,
7904 Unique,
7905 PrimaryKey,
7906 Default(Expression),
7907 Check(Expression),
7908 References(ForeignKeyRef),
7909 GeneratedAsIdentity(GeneratedAsIdentity),
7910 Collate(Identifier),
7911 Comment(String),
7912 Tags(Tags),
7914 ComputedColumn(ComputedColumn),
7917 GeneratedAsRow(GeneratedAsRow),
7919 Path(Expression),
7921}
7922
7923#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7925#[cfg_attr(feature = "bindings", derive(TS))]
7926pub struct ComputedColumn {
7927 pub expression: Box<Expression>,
7929 #[serde(default)]
7931 pub persisted: bool,
7932 #[serde(default)]
7934 pub not_null: bool,
7935 #[serde(default)]
7938 pub persistence_kind: Option<String>,
7939 #[serde(default, skip_serializing_if = "Option::is_none")]
7941 pub data_type: Option<DataType>,
7942}
7943
7944#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7946#[cfg_attr(feature = "bindings", derive(TS))]
7947pub struct GeneratedAsRow {
7948 pub start: bool,
7950 #[serde(default)]
7952 pub hidden: bool,
7953}
7954
7955#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7957#[cfg_attr(feature = "bindings", derive(TS))]
7958pub struct GeneratedAsIdentity {
7959 pub always: bool,
7961 pub on_null: bool,
7963 pub start: Option<Box<Expression>>,
7965 pub increment: Option<Box<Expression>>,
7967 pub minvalue: Option<Box<Expression>>,
7969 pub maxvalue: Option<Box<Expression>>,
7971 pub cycle: Option<bool>,
7973}
7974
7975#[derive(
7977 polyglot_sql_ast_derive::AstNode, Debug, Clone, Default, PartialEq, Serialize, Deserialize,
7978)]
7979#[cfg_attr(feature = "bindings", derive(TS))]
7980pub struct ConstraintModifiers {
7981 pub enforced: Option<bool>,
7983 pub deferrable: Option<bool>,
7985 pub initially_deferred: Option<bool>,
7987 pub norely: bool,
7989 pub rely: bool,
7991 #[serde(default)]
7993 pub using: Option<String>,
7994 #[serde(default)]
7996 pub using_before_columns: bool,
7997 #[serde(default, skip_serializing_if = "Option::is_none")]
7999 pub comment: Option<String>,
8000 #[serde(default, skip_serializing_if = "Option::is_none")]
8002 pub visible: Option<bool>,
8003 #[serde(default, skip_serializing_if = "Option::is_none")]
8005 pub engine_attribute: Option<String>,
8006 #[serde(default, skip_serializing_if = "Option::is_none")]
8008 pub with_parser: Option<String>,
8009 #[serde(default)]
8011 pub not_valid: bool,
8012 #[serde(default, skip_serializing_if = "Option::is_none")]
8014 pub clustered: Option<String>,
8015 #[serde(default, skip_serializing_if = "Option::is_none")]
8017 pub on_conflict: Option<String>,
8018 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8020 pub with_options: Vec<(String, String)>,
8021 #[serde(default, skip_serializing_if = "Option::is_none")]
8023 pub on_filegroup: Option<Identifier>,
8024}
8025
8026#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8028#[cfg_attr(feature = "bindings", derive(TS))]
8029pub enum TableConstraint {
8030 PrimaryKey {
8031 name: Option<Identifier>,
8032 columns: Vec<Identifier>,
8033 #[serde(default)]
8035 include_columns: Vec<Identifier>,
8036 #[serde(default)]
8037 modifiers: ConstraintModifiers,
8038 #[serde(default)]
8040 has_constraint_keyword: bool,
8041 },
8042 Unique {
8043 name: Option<Identifier>,
8044 columns: Vec<Identifier>,
8045 #[serde(default)]
8047 columns_parenthesized: bool,
8048 #[serde(default)]
8049 modifiers: ConstraintModifiers,
8050 #[serde(default)]
8052 has_constraint_keyword: bool,
8053 #[serde(default)]
8055 nulls_not_distinct: bool,
8056 },
8057 ForeignKey {
8058 name: Option<Identifier>,
8059 columns: Vec<Identifier>,
8060 #[serde(default)]
8061 references: Option<ForeignKeyRef>,
8062 #[serde(default)]
8064 on_delete: Option<ReferentialAction>,
8065 #[serde(default)]
8067 on_update: Option<ReferentialAction>,
8068 #[serde(default)]
8069 modifiers: ConstraintModifiers,
8070 },
8071 Check {
8072 name: Option<Identifier>,
8073 expression: Expression,
8074 #[serde(default)]
8075 modifiers: ConstraintModifiers,
8076 },
8077 Assume {
8079 name: Option<Identifier>,
8080 expression: Expression,
8081 },
8082 Default {
8084 name: Option<Identifier>,
8085 expression: Expression,
8086 column: Identifier,
8087 },
8088 Index {
8090 name: Option<Identifier>,
8091 columns: Vec<Identifier>,
8092 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8095 key_parts: Vec<IndexKeyPart>,
8096 #[serde(default)]
8098 kind: Option<String>,
8099 #[serde(default)]
8100 modifiers: ConstraintModifiers,
8101 #[serde(default)]
8103 use_key_keyword: bool,
8104 #[serde(default, skip_serializing_if = "Option::is_none")]
8106 expression: Option<Box<Expression>>,
8107 #[serde(default, skip_serializing_if = "Option::is_none")]
8109 index_type: Option<Box<Expression>>,
8110 #[serde(default, skip_serializing_if = "Option::is_none")]
8112 granularity: Option<Box<Expression>>,
8113 },
8114 Projection {
8116 name: Identifier,
8117 expression: Expression,
8118 },
8119 Like {
8121 source: TableRef,
8122 options: Vec<(LikeOptionAction, String)>,
8124 },
8125 PeriodForSystemTime {
8127 start_col: Identifier,
8128 end_col: Identifier,
8129 },
8130 Exclude {
8133 name: Option<Identifier>,
8134 #[serde(default)]
8136 using: Option<String>,
8137 elements: Vec<ExcludeElement>,
8139 #[serde(default)]
8141 include_columns: Vec<Identifier>,
8142 #[serde(default)]
8144 where_clause: Option<Box<Expression>>,
8145 #[serde(default)]
8147 with_params: Vec<(String, String)>,
8148 #[serde(default)]
8150 using_index_tablespace: Option<String>,
8151 #[serde(default)]
8152 modifiers: ConstraintModifiers,
8153 },
8154 Tags(Tags),
8156 InitiallyDeferred {
8160 deferred: bool,
8162 },
8163}
8164
8165#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8167#[cfg_attr(feature = "bindings", derive(TS))]
8168pub struct ExcludeElement {
8169 pub expression: String,
8171 pub operator: String,
8173}
8174
8175#[derive(
8177 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8178)]
8179#[cfg_attr(feature = "bindings", derive(TS))]
8180pub enum LikeOptionAction {
8181 Including,
8182 Excluding,
8183}
8184
8185#[derive(
8187 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8188)]
8189#[cfg_attr(feature = "bindings", derive(TS))]
8190pub enum MatchType {
8191 Full,
8192 Partial,
8193 Simple,
8194}
8195
8196#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8198#[cfg_attr(feature = "bindings", derive(TS))]
8199pub struct ForeignKeyRef {
8200 pub table: TableRef,
8201 pub columns: Vec<Identifier>,
8202 pub on_delete: Option<ReferentialAction>,
8203 pub on_update: Option<ReferentialAction>,
8204 #[serde(default)]
8206 pub on_update_first: bool,
8207 #[serde(default)]
8209 pub match_type: Option<MatchType>,
8210 #[serde(default)]
8212 pub match_after_actions: bool,
8213 #[serde(default)]
8215 pub constraint_name: Option<String>,
8216 #[serde(default)]
8218 pub deferrable: Option<bool>,
8219 #[serde(default)]
8221 pub has_foreign_key_keywords: bool,
8222}
8223
8224#[derive(
8226 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8227)]
8228#[cfg_attr(feature = "bindings", derive(TS))]
8229pub enum ReferentialAction {
8230 Cascade,
8231 SetNull,
8232 SetDefault,
8233 Restrict,
8234 NoAction,
8235}
8236
8237#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8239#[cfg_attr(feature = "bindings", derive(TS))]
8240pub struct DropTable {
8241 pub names: Vec<TableRef>,
8242 pub if_exists: bool,
8243 pub cascade: bool,
8244 #[serde(default)]
8246 pub cascade_constraints: bool,
8247 #[serde(default)]
8249 pub purge: bool,
8250 #[serde(default)]
8252 pub leading_comments: Vec<String>,
8253 #[serde(default, skip_serializing_if = "Option::is_none")]
8256 pub object_id_args: Option<String>,
8257 #[serde(default)]
8259 pub sync: bool,
8260 #[serde(default)]
8262 pub iceberg: bool,
8263 #[serde(default)]
8265 pub restrict: bool,
8266}
8267
8268impl DropTable {
8269 pub fn new(name: impl Into<String>) -> Self {
8270 Self {
8271 names: vec![TableRef::new(name)],
8272 if_exists: false,
8273 cascade: false,
8274 cascade_constraints: false,
8275 purge: false,
8276 leading_comments: Vec::new(),
8277 object_id_args: None,
8278 sync: false,
8279 iceberg: false,
8280 restrict: false,
8281 }
8282 }
8283}
8284
8285#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8287#[cfg_attr(feature = "bindings", derive(TS))]
8288pub struct Undrop {
8289 pub kind: String,
8291 pub name: TableRef,
8293 #[serde(default)]
8295 pub if_exists: bool,
8296 #[serde(default, skip_serializing_if = "Option::is_none")]
8298 pub rename_to: Option<TableRef>,
8299}
8300
8301#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8303#[cfg_attr(feature = "bindings", derive(TS))]
8304#[serde(tag = "type", rename_all = "snake_case")]
8305pub enum SplitTablePartitionScope {
8306 Table,
8307 AllPartitions,
8308 Partitions { names: Vec<Identifier> },
8309}
8310
8311#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8313#[cfg_attr(feature = "bindings", derive(TS))]
8314#[serde(tag = "type", rename_all = "snake_case")]
8315pub enum SplitTableMode {
8316 Between {
8317 lower: Vec<Expression>,
8318 upper: Vec<Expression>,
8319 regions: u64,
8320 },
8321 By {
8322 points: Vec<Vec<Expression>>,
8323 },
8324}
8325
8326#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8328#[cfg_attr(feature = "bindings", derive(TS))]
8329pub struct SplitTable {
8330 pub table: TableRef,
8331 pub partition_scope: SplitTablePartitionScope,
8332 #[serde(default, skip_serializing_if = "Option::is_none")]
8333 pub index: Option<Identifier>,
8334 pub mode: SplitTableMode,
8335}
8336
8337#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8339#[cfg_attr(feature = "bindings", derive(TS))]
8340pub struct FlashbackTable {
8341 pub table: TableRef,
8342 #[serde(default, skip_serializing_if = "Option::is_none")]
8343 pub rename_to: Option<Identifier>,
8344}
8345
8346#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8348#[cfg_attr(feature = "bindings", derive(TS))]
8349pub struct AlterTable {
8350 pub name: TableRef,
8351 pub actions: Vec<AlterTableAction>,
8352 #[serde(default)]
8354 pub if_exists: bool,
8355 #[serde(default, skip_serializing_if = "Option::is_none")]
8357 pub algorithm: Option<String>,
8358 #[serde(default, skip_serializing_if = "Option::is_none")]
8360 pub lock: Option<String>,
8361 #[serde(default, skip_serializing_if = "Option::is_none")]
8363 pub with_check: Option<String>,
8364 #[serde(default, skip_serializing_if = "Option::is_none")]
8366 pub partition: Option<Vec<(Identifier, Expression)>>,
8367 #[serde(default, skip_serializing_if = "Option::is_none")]
8369 pub on_cluster: Option<OnCluster>,
8370 #[serde(default, skip_serializing_if = "Option::is_none")]
8372 pub table_modifier: Option<String>,
8373}
8374
8375impl AlterTable {
8376 pub fn new(name: impl Into<String>) -> Self {
8377 Self {
8378 name: TableRef::new(name),
8379 actions: Vec::new(),
8380 if_exists: false,
8381 algorithm: None,
8382 lock: None,
8383 with_check: None,
8384 partition: None,
8385 on_cluster: None,
8386 table_modifier: None,
8387 }
8388 }
8389}
8390
8391#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8393#[cfg_attr(feature = "bindings", derive(TS))]
8394pub enum ColumnPosition {
8395 First,
8396 After(Identifier),
8397}
8398
8399#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8401#[cfg_attr(feature = "bindings", derive(TS))]
8402pub enum AlterTableAction {
8403 AddColumn {
8404 column: ColumnDef,
8405 if_not_exists: bool,
8406 position: Option<ColumnPosition>,
8407 },
8408 DropColumn {
8409 name: Identifier,
8410 if_exists: bool,
8411 cascade: bool,
8412 },
8413 RenameColumn {
8414 old_name: Identifier,
8415 new_name: Identifier,
8416 if_exists: bool,
8417 },
8418 AlterColumn {
8419 name: Identifier,
8420 action: AlterColumnAction,
8421 #[serde(default)]
8423 use_modify_keyword: bool,
8424 },
8425 ModifyColumn {
8427 column: ColumnDef,
8428 if_exists: bool,
8429 position: Option<ColumnPosition>,
8430 },
8431 RenameTable(TableRef),
8432 AddConstraint(TableConstraint),
8433 DropConstraint {
8434 name: Identifier,
8435 if_exists: bool,
8436 },
8437 DropForeignKey {
8439 name: Identifier,
8440 },
8441 DropPartition {
8443 partitions: Vec<Vec<(Identifier, Expression)>>,
8445 if_exists: bool,
8446 },
8447 AddPartition {
8449 partition: Expression,
8451 if_not_exists: bool,
8452 location: Option<Expression>,
8453 },
8454 Delete {
8456 where_clause: Expression,
8457 },
8458 SwapWith(TableRef),
8460 SetProperty {
8462 properties: Vec<(String, Expression)>,
8463 },
8464 UnsetProperty {
8466 properties: Vec<String>,
8467 },
8468 ClusterBy {
8470 expressions: Vec<Expression>,
8471 },
8472 SetTag {
8474 expressions: Vec<(String, Expression)>,
8475 },
8476 UnsetTag {
8478 names: Vec<String>,
8479 },
8480 SetOptions {
8482 expressions: Vec<Expression>,
8483 },
8484 AlterIndex {
8486 name: Identifier,
8487 visible: bool,
8488 },
8489 SetAttribute {
8491 attribute: String,
8492 },
8493 SetStageFileFormat {
8495 options: Option<Expression>,
8496 },
8497 SetStageCopyOptions {
8499 options: Option<Expression>,
8500 },
8501 AddColumns {
8503 columns: Vec<ColumnDef>,
8504 cascade: bool,
8505 },
8506 DropColumns {
8508 names: Vec<Identifier>,
8509 },
8510 ChangeColumn {
8513 old_name: Identifier,
8514 new_name: Identifier,
8515 #[serde(default, skip_serializing_if = "Option::is_none")]
8516 data_type: Option<DataType>,
8517 comment: Option<String>,
8518 #[serde(default)]
8519 cascade: bool,
8520 },
8521 AlterSortKey {
8524 this: Option<String>,
8526 expressions: Vec<Expression>,
8528 compound: bool,
8530 },
8531 AlterDistStyle {
8535 style: String,
8537 distkey: Option<Identifier>,
8539 },
8540 SetTableProperties {
8542 properties: Vec<(Expression, Expression)>,
8543 },
8544 SetLocation {
8546 location: String,
8547 },
8548 SetFileFormat {
8550 format: String,
8551 },
8552 ReplacePartition {
8554 partition: Expression,
8555 source: Option<Box<Expression>>,
8556 },
8557 SetTiDBTableOption {
8559 option: TiDBTableOption,
8560 #[serde(default)]
8561 force: bool,
8562 },
8563 RemoveTiDBTtl {
8565 #[serde(default)]
8566 executable_comment: bool,
8567 },
8568 Raw {
8570 sql: String,
8571 },
8572}
8573
8574#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8576#[cfg_attr(feature = "bindings", derive(TS))]
8577pub enum AlterColumnAction {
8578 SetDataType {
8579 data_type: DataType,
8580 using: Option<Expression>,
8582 #[serde(default, skip_serializing_if = "Option::is_none")]
8584 collate: Option<String>,
8585 },
8586 SetDefault(Expression),
8587 DropDefault,
8588 SetNotNull,
8589 DropNotNull,
8590 Comment(String),
8592 SetVisible,
8594 SetInvisible,
8596}
8597
8598#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8600#[cfg_attr(feature = "bindings", derive(TS))]
8601pub struct CreateIndex {
8602 pub name: Identifier,
8603 pub table: TableRef,
8604 pub columns: Vec<IndexColumn>,
8605 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8608 pub key_parts: Vec<IndexKeyPart>,
8609 pub unique: bool,
8610 pub if_not_exists: bool,
8611 pub using: Option<String>,
8612 #[serde(default)]
8614 pub clustered: Option<String>,
8615 #[serde(default)]
8617 pub concurrently: bool,
8618 #[serde(default)]
8620 pub where_clause: Option<Box<Expression>>,
8621 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8623 pub include_columns: Vec<Identifier>,
8624 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8626 pub with_options: Vec<(String, String)>,
8627 #[serde(default)]
8629 pub on_filegroup: Option<String>,
8630}
8631
8632impl CreateIndex {
8633 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8634 Self {
8635 name: Identifier::new(name),
8636 table: TableRef::new(table),
8637 columns: Vec::new(),
8638 key_parts: Vec::new(),
8639 unique: false,
8640 if_not_exists: false,
8641 using: None,
8642 clustered: None,
8643 concurrently: false,
8644 where_clause: None,
8645 include_columns: Vec::new(),
8646 with_options: Vec::new(),
8647 on_filegroup: None,
8648 }
8649 }
8650}
8651
8652#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8654#[cfg_attr(feature = "bindings", derive(TS))]
8655pub struct IndexColumn {
8656 pub column: Identifier,
8657 pub desc: bool,
8658 #[serde(default)]
8660 pub asc: bool,
8661 pub nulls_first: Option<bool>,
8662 #[serde(default, skip_serializing_if = "Option::is_none")]
8664 pub opclass: Option<String>,
8665}
8666
8667#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8669#[cfg_attr(feature = "bindings", derive(TS))]
8670pub struct IndexKeyPart {
8671 pub expression: Box<Expression>,
8672 #[serde(default, skip_serializing_if = "Option::is_none")]
8674 pub prefix_length: Option<String>,
8675 pub desc: bool,
8676 #[serde(default)]
8678 pub asc: bool,
8679 pub nulls_first: Option<bool>,
8680 #[serde(default, skip_serializing_if = "Option::is_none")]
8682 pub opclass: Option<String>,
8683}
8684
8685#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8687#[cfg_attr(feature = "bindings", derive(TS))]
8688pub struct DropIndex {
8689 pub name: TableRef,
8690 pub table: Option<TableRef>,
8691 pub if_exists: bool,
8692 #[serde(default)]
8694 pub concurrently: bool,
8695}
8696
8697impl DropIndex {
8698 pub fn new(name: impl Into<String>) -> Self {
8699 Self {
8700 name: TableRef::new(name),
8701 table: None,
8702 if_exists: false,
8703 concurrently: false,
8704 }
8705 }
8706}
8707
8708#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8710#[cfg_attr(feature = "bindings", derive(TS))]
8711pub struct ViewColumn {
8712 pub name: Identifier,
8713 pub comment: Option<String>,
8714 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8716 pub options: Vec<Expression>,
8717}
8718
8719impl ViewColumn {
8720 pub fn new(name: impl Into<String>) -> Self {
8721 Self {
8722 name: Identifier::new(name),
8723 comment: None,
8724 options: Vec::new(),
8725 }
8726 }
8727
8728 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8729 Self {
8730 name: Identifier::new(name),
8731 comment: Some(comment.into()),
8732 options: Vec::new(),
8733 }
8734 }
8735}
8736
8737#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8739#[cfg_attr(feature = "bindings", derive(TS))]
8740pub struct CreateView {
8741 pub name: TableRef,
8742 pub columns: Vec<ViewColumn>,
8743 pub query: Expression,
8744 pub or_replace: bool,
8745 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8747 pub or_alter: bool,
8748 pub if_not_exists: bool,
8749 pub materialized: bool,
8750 pub temporary: bool,
8751 #[serde(default)]
8753 pub secure: bool,
8754 #[serde(skip_serializing_if = "Option::is_none")]
8756 pub algorithm: Option<String>,
8757 #[serde(skip_serializing_if = "Option::is_none")]
8759 pub definer: Option<String>,
8760 #[serde(skip_serializing_if = "Option::is_none")]
8762 pub security: Option<FunctionSecurity>,
8763 #[serde(default = "default_true")]
8765 pub security_sql_style: bool,
8766 #[serde(default)]
8768 pub security_after_name: bool,
8769 #[serde(default)]
8771 pub query_parenthesized: bool,
8772 #[serde(skip_serializing_if = "Option::is_none")]
8774 pub locking_mode: Option<String>,
8775 #[serde(skip_serializing_if = "Option::is_none")]
8777 pub locking_access: Option<String>,
8778 #[serde(default)]
8780 pub copy_grants: bool,
8781 #[serde(skip_serializing_if = "Option::is_none", default)]
8783 pub comment: Option<String>,
8784 #[serde(skip_serializing_if = "Option::is_none", default)]
8786 pub row_access_policy: Option<String>,
8787 #[serde(default)]
8789 pub tags: Vec<(String, String)>,
8790 #[serde(default)]
8792 pub options: Vec<Expression>,
8793 #[serde(skip_serializing_if = "Option::is_none", default)]
8795 pub build: Option<String>,
8796 #[serde(skip_serializing_if = "Option::is_none", default)]
8798 pub refresh: Option<Box<RefreshTriggerProperty>>,
8799 #[serde(skip_serializing_if = "Option::is_none", default)]
8802 pub schema: Option<Box<Schema>>,
8803 #[serde(skip_serializing_if = "Option::is_none", default)]
8805 pub unique_key: Option<Box<UniqueKeyProperty>>,
8806 #[serde(default)]
8808 pub no_schema_binding: bool,
8809 #[serde(skip_serializing_if = "Option::is_none", default)]
8811 pub auto_refresh: Option<bool>,
8812 #[serde(skip_serializing_if = "Option::is_none", default)]
8814 pub clickhouse_population: Option<String>,
8815 #[serde(default, skip_serializing_if = "Option::is_none")]
8817 pub on_cluster: Option<OnCluster>,
8818 #[serde(default, skip_serializing_if = "Option::is_none")]
8820 pub to_table: Option<TableRef>,
8821 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8823 pub table_properties: Vec<Expression>,
8824}
8825
8826impl CreateView {
8827 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8828 Self {
8829 name: TableRef::new(name),
8830 columns: Vec::new(),
8831 query,
8832 or_replace: false,
8833 or_alter: false,
8834 if_not_exists: false,
8835 materialized: false,
8836 temporary: false,
8837 secure: false,
8838 algorithm: None,
8839 definer: None,
8840 security: None,
8841 security_sql_style: true,
8842 security_after_name: false,
8843 query_parenthesized: false,
8844 locking_mode: None,
8845 locking_access: None,
8846 copy_grants: false,
8847 comment: None,
8848 row_access_policy: None,
8849 tags: Vec::new(),
8850 options: Vec::new(),
8851 build: None,
8852 refresh: None,
8853 schema: None,
8854 unique_key: None,
8855 no_schema_binding: false,
8856 auto_refresh: None,
8857 clickhouse_population: None,
8858 on_cluster: None,
8859 to_table: None,
8860 table_properties: Vec::new(),
8861 }
8862 }
8863}
8864
8865#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8867#[cfg_attr(feature = "bindings", derive(TS))]
8868pub struct DropView {
8869 pub name: TableRef,
8870 pub if_exists: bool,
8871 pub materialized: bool,
8872}
8873
8874impl DropView {
8875 pub fn new(name: impl Into<String>) -> Self {
8876 Self {
8877 name: TableRef::new(name),
8878 if_exists: false,
8879 materialized: false,
8880 }
8881 }
8882}
8883
8884#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8886#[cfg_attr(feature = "bindings", derive(TS))]
8887pub struct Truncate {
8888 #[serde(default)]
8890 pub target: TruncateTarget,
8891 #[serde(default)]
8893 pub if_exists: bool,
8894 pub table: TableRef,
8895 #[serde(default, skip_serializing_if = "Option::is_none")]
8897 pub on_cluster: Option<OnCluster>,
8898 pub cascade: bool,
8899 #[serde(default)]
8901 pub extra_tables: Vec<TruncateTableEntry>,
8902 #[serde(default)]
8904 pub identity: Option<TruncateIdentity>,
8905 #[serde(default)]
8907 pub restrict: bool,
8908 #[serde(default, skip_serializing_if = "Option::is_none")]
8910 pub partition: Option<Box<Expression>>,
8911}
8912
8913#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8915#[cfg_attr(feature = "bindings", derive(TS))]
8916pub struct TruncateTableEntry {
8917 pub table: TableRef,
8918 #[serde(default)]
8920 pub star: bool,
8921}
8922
8923#[derive(
8925 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8926)]
8927#[cfg_attr(feature = "bindings", derive(TS))]
8928pub enum TruncateTarget {
8929 Table,
8930 Database,
8931}
8932
8933impl Default for TruncateTarget {
8934 fn default() -> Self {
8935 TruncateTarget::Table
8936 }
8937}
8938
8939#[derive(
8941 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8942)]
8943#[cfg_attr(feature = "bindings", derive(TS))]
8944pub enum TruncateIdentity {
8945 Restart,
8946 Continue,
8947}
8948
8949impl Truncate {
8950 pub fn new(table: impl Into<String>) -> Self {
8951 Self {
8952 target: TruncateTarget::Table,
8953 if_exists: false,
8954 table: TableRef::new(table),
8955 on_cluster: None,
8956 cascade: false,
8957 extra_tables: Vec::new(),
8958 identity: None,
8959 restrict: false,
8960 partition: None,
8961 }
8962 }
8963}
8964
8965#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8967#[cfg_attr(feature = "bindings", derive(TS))]
8968pub struct Use {
8969 pub kind: Option<UseKind>,
8971 pub this: Identifier,
8973}
8974
8975#[derive(
8977 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8978)]
8979#[cfg_attr(feature = "bindings", derive(TS))]
8980pub enum UseKind {
8981 Database,
8982 Schema,
8983 Role,
8984 Warehouse,
8985 Catalog,
8986 SecondaryRoles,
8988}
8989
8990#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8992#[cfg_attr(feature = "bindings", derive(TS))]
8993pub struct SetStatement {
8994 pub items: Vec<SetItem>,
8996}
8997
8998#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9000#[cfg_attr(feature = "bindings", derive(TS))]
9001pub struct SetItem {
9002 pub name: Expression,
9004 pub value: Expression,
9006 pub kind: Option<String>,
9008 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9010 pub no_equals: bool,
9011}
9012
9013#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9015#[cfg_attr(feature = "bindings", derive(TS))]
9016pub struct Cache {
9017 pub table: Identifier,
9019 pub lazy: bool,
9021 pub options: Vec<(Expression, Expression)>,
9023 pub query: Option<Expression>,
9025}
9026
9027#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9029#[cfg_attr(feature = "bindings", derive(TS))]
9030pub struct Uncache {
9031 pub table: Identifier,
9033 pub if_exists: bool,
9035}
9036
9037#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9039#[cfg_attr(feature = "bindings", derive(TS))]
9040pub struct LoadData {
9041 pub local: bool,
9043 pub inpath: String,
9045 pub overwrite: bool,
9047 pub table: Expression,
9049 pub partition: Vec<(Identifier, Expression)>,
9051 pub input_format: Option<String>,
9053 pub serde: Option<String>,
9055}
9056
9057#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9059#[cfg_attr(feature = "bindings", derive(TS))]
9060pub struct Pragma {
9061 pub schema: Option<Identifier>,
9063 pub name: Identifier,
9065 pub value: Option<Expression>,
9067 pub args: Vec<Expression>,
9069 #[serde(default)]
9071 pub use_assignment_syntax: bool,
9072}
9073
9074#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9077#[cfg_attr(feature = "bindings", derive(TS))]
9078pub struct Privilege {
9079 pub name: String,
9081 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9083 pub columns: Vec<String>,
9084}
9085
9086#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9088#[cfg_attr(feature = "bindings", derive(TS))]
9089pub struct GrantPrincipal {
9090 pub name: Identifier,
9092 pub is_role: bool,
9094 #[serde(default)]
9096 pub is_group: bool,
9097 #[serde(default)]
9099 pub is_share: bool,
9100}
9101
9102#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9104#[cfg_attr(feature = "bindings", derive(TS))]
9105pub struct Grant {
9106 pub privileges: Vec<Privilege>,
9108 pub kind: Option<String>,
9110 pub securable: Identifier,
9112 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9114 pub function_params: Vec<String>,
9115 pub principals: Vec<GrantPrincipal>,
9117 pub grant_option: bool,
9119 #[serde(default, skip_serializing_if = "Option::is_none")]
9121 pub as_principal: Option<Identifier>,
9122}
9123
9124#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9126#[cfg_attr(feature = "bindings", derive(TS))]
9127pub struct Revoke {
9128 pub privileges: Vec<Privilege>,
9130 pub kind: Option<String>,
9132 pub securable: Identifier,
9134 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9136 pub function_params: Vec<String>,
9137 pub principals: Vec<GrantPrincipal>,
9139 pub grant_option: bool,
9141 pub cascade: bool,
9143 #[serde(default)]
9145 pub restrict: bool,
9146}
9147
9148#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9150#[cfg_attr(feature = "bindings", derive(TS))]
9151pub struct Comment {
9152 pub this: Expression,
9154 pub kind: String,
9156 pub expression: Expression,
9158 pub exists: bool,
9160 pub materialized: bool,
9162}
9163
9164#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9170#[cfg_attr(feature = "bindings", derive(TS))]
9171pub struct AlterView {
9172 pub name: TableRef,
9173 pub actions: Vec<AlterViewAction>,
9174 #[serde(default, skip_serializing_if = "Option::is_none")]
9176 pub algorithm: Option<String>,
9177 #[serde(default, skip_serializing_if = "Option::is_none")]
9179 pub definer: Option<String>,
9180 #[serde(default, skip_serializing_if = "Option::is_none")]
9182 pub sql_security: Option<String>,
9183 #[serde(default, skip_serializing_if = "Option::is_none")]
9185 pub with_option: Option<String>,
9186 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9188 pub columns: Vec<ViewColumn>,
9189}
9190
9191#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9193#[cfg_attr(feature = "bindings", derive(TS))]
9194pub enum AlterViewAction {
9195 Rename(TableRef),
9197 OwnerTo(Identifier),
9199 SetSchema(Identifier),
9201 SetAuthorization(String),
9203 AlterColumn {
9205 name: Identifier,
9206 action: AlterColumnAction,
9207 },
9208 AsSelect(Box<Expression>),
9210 SetTblproperties(Vec<(String, String)>),
9212 UnsetTblproperties(Vec<String>),
9214}
9215
9216impl AlterView {
9217 pub fn new(name: impl Into<String>) -> Self {
9218 Self {
9219 name: TableRef::new(name),
9220 actions: Vec::new(),
9221 algorithm: None,
9222 definer: None,
9223 sql_security: None,
9224 with_option: None,
9225 columns: Vec::new(),
9226 }
9227 }
9228}
9229
9230#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9232#[cfg_attr(feature = "bindings", derive(TS))]
9233pub struct AlterIndex {
9234 pub name: Identifier,
9235 pub table: Option<TableRef>,
9236 pub actions: Vec<AlterIndexAction>,
9237}
9238
9239#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9241#[cfg_attr(feature = "bindings", derive(TS))]
9242pub enum AlterIndexAction {
9243 Rename(Identifier),
9245 SetTablespace(Identifier),
9247 Visible(bool),
9249}
9250
9251impl AlterIndex {
9252 pub fn new(name: impl Into<String>) -> Self {
9253 Self {
9254 name: Identifier::new(name),
9255 table: None,
9256 actions: Vec::new(),
9257 }
9258 }
9259}
9260
9261#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9263#[cfg_attr(feature = "bindings", derive(TS))]
9264pub struct CreateSchema {
9265 pub name: Vec<Identifier>,
9267 pub if_not_exists: bool,
9268 pub authorization: Option<Identifier>,
9269 #[serde(default)]
9271 pub clone_from: Option<Vec<Identifier>>,
9272 #[serde(default)]
9274 pub at_clause: Option<Expression>,
9275 #[serde(default)]
9277 pub properties: Vec<Expression>,
9278 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9280 pub leading_comments: Vec<String>,
9281}
9282
9283impl CreateSchema {
9284 pub fn new(name: impl Into<String>) -> Self {
9285 Self {
9286 name: vec![Identifier::new(name)],
9287 if_not_exists: false,
9288 authorization: None,
9289 clone_from: None,
9290 at_clause: None,
9291 properties: Vec::new(),
9292 leading_comments: Vec::new(),
9293 }
9294 }
9295}
9296
9297#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9299#[cfg_attr(feature = "bindings", derive(TS))]
9300pub struct DropSchema {
9301 pub name: Identifier,
9302 pub if_exists: bool,
9303 pub cascade: bool,
9304}
9305
9306impl DropSchema {
9307 pub fn new(name: impl Into<String>) -> Self {
9308 Self {
9309 name: Identifier::new(name),
9310 if_exists: false,
9311 cascade: false,
9312 }
9313 }
9314}
9315
9316#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9318#[cfg_attr(feature = "bindings", derive(TS))]
9319pub struct DropNamespace {
9320 pub name: Identifier,
9321 pub if_exists: bool,
9322 pub cascade: bool,
9323}
9324
9325impl DropNamespace {
9326 pub fn new(name: impl Into<String>) -> Self {
9327 Self {
9328 name: Identifier::new(name),
9329 if_exists: false,
9330 cascade: false,
9331 }
9332 }
9333}
9334
9335#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9337#[cfg_attr(feature = "bindings", derive(TS))]
9338pub struct CreateDatabase {
9339 pub name: Identifier,
9340 pub if_not_exists: bool,
9341 pub options: Vec<DatabaseOption>,
9342 #[serde(default)]
9344 pub clone_from: Option<Identifier>,
9345 #[serde(default)]
9347 pub at_clause: Option<Expression>,
9348}
9349
9350#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9352#[cfg_attr(feature = "bindings", derive(TS))]
9353pub enum DatabaseOption {
9354 CharacterSet(String),
9355 Collate(String),
9356 Owner(Identifier),
9357 Template(Identifier),
9358 Encoding(String),
9359 Location(String),
9360}
9361
9362impl CreateDatabase {
9363 pub fn new(name: impl Into<String>) -> Self {
9364 Self {
9365 name: Identifier::new(name),
9366 if_not_exists: false,
9367 options: Vec::new(),
9368 clone_from: None,
9369 at_clause: None,
9370 }
9371 }
9372}
9373
9374#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9376#[cfg_attr(feature = "bindings", derive(TS))]
9377pub struct DropDatabase {
9378 pub name: Identifier,
9379 pub if_exists: bool,
9380 #[serde(default)]
9382 pub sync: bool,
9383}
9384
9385impl DropDatabase {
9386 pub fn new(name: impl Into<String>) -> Self {
9387 Self {
9388 name: Identifier::new(name),
9389 if_exists: false,
9390 sync: false,
9391 }
9392 }
9393}
9394
9395#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9397#[cfg_attr(feature = "bindings", derive(TS))]
9398pub struct CreateFunction {
9399 pub name: TableRef,
9400 pub parameters: Vec<FunctionParameter>,
9401 pub return_type: Option<DataType>,
9402 pub body: Option<FunctionBody>,
9403 pub or_replace: bool,
9404 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9406 pub or_alter: bool,
9407 pub if_not_exists: bool,
9408 pub temporary: bool,
9409 pub language: Option<String>,
9410 pub deterministic: Option<bool>,
9411 pub returns_null_on_null_input: Option<bool>,
9412 pub security: Option<FunctionSecurity>,
9413 #[serde(default = "default_true")]
9415 pub has_parens: bool,
9416 #[serde(default)]
9418 pub sql_data_access: Option<SqlDataAccess>,
9419 #[serde(default, skip_serializing_if = "Option::is_none")]
9421 pub returns_table_body: Option<String>,
9422 #[serde(default)]
9424 pub language_first: bool,
9425 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9427 pub set_options: Vec<FunctionSetOption>,
9428 #[serde(default)]
9430 pub strict: bool,
9431 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9433 pub options: Vec<Expression>,
9434 #[serde(default)]
9436 pub is_table_function: bool,
9437 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9439 pub property_order: Vec<FunctionPropertyKind>,
9440 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9442 pub using_resources: Vec<FunctionUsingResource>,
9443 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9445 pub environment: Vec<Expression>,
9446 #[serde(default, skip_serializing_if = "Option::is_none")]
9448 pub handler: Option<String>,
9449 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9451 pub handler_uses_eq: bool,
9452 #[serde(default, skip_serializing_if = "Option::is_none")]
9454 pub runtime_version: Option<String>,
9455 #[serde(default, skip_serializing_if = "Option::is_none")]
9457 pub packages: Option<Vec<String>>,
9458 #[serde(default, skip_serializing_if = "Option::is_none")]
9460 pub parameter_style: Option<String>,
9461}
9462
9463#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9465#[cfg_attr(feature = "bindings", derive(TS))]
9466pub struct FunctionSetOption {
9467 pub name: String,
9468 pub value: FunctionSetValue,
9469}
9470
9471#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9473#[cfg_attr(feature = "bindings", derive(TS))]
9474pub enum FunctionSetValue {
9475 Value { value: String, use_to: bool },
9477 FromCurrent,
9479}
9480
9481#[derive(
9483 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9484)]
9485#[cfg_attr(feature = "bindings", derive(TS))]
9486pub enum SqlDataAccess {
9487 NoSql,
9489 ContainsSql,
9491 ReadsSqlData,
9493 ModifiesSqlData,
9495}
9496
9497#[derive(
9499 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9500)]
9501#[cfg_attr(feature = "bindings", derive(TS))]
9502pub enum FunctionPropertyKind {
9503 Set,
9505 As,
9507 Using,
9509 Language,
9511 Determinism,
9513 NullInput,
9515 Security,
9517 SqlDataAccess,
9519 Options,
9521 Environment,
9523 Handler,
9525 RuntimeVersion,
9527 Packages,
9529 ParameterStyle,
9531}
9532
9533#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9535#[cfg_attr(feature = "bindings", derive(TS))]
9536pub struct FunctionUsingResource {
9537 pub kind: String,
9538 pub uri: String,
9539}
9540
9541#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9543#[cfg_attr(feature = "bindings", derive(TS))]
9544pub struct FunctionParameter {
9545 pub name: Option<Identifier>,
9546 pub data_type: DataType,
9547 pub mode: Option<ParameterMode>,
9548 pub default: Option<Expression>,
9549 #[serde(default, skip_serializing_if = "Option::is_none")]
9551 pub mode_text: Option<String>,
9552}
9553
9554#[derive(
9556 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9557)]
9558#[cfg_attr(feature = "bindings", derive(TS))]
9559pub enum ParameterMode {
9560 In,
9561 Out,
9562 InOut,
9563 Variadic,
9564}
9565
9566#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9568#[cfg_attr(feature = "bindings", derive(TS))]
9569pub enum FunctionBody {
9570 Block(String),
9572 StringLiteral(String),
9574 Expression(Expression),
9576 External(String),
9578 Return(Expression),
9580 Statements(Vec<Expression>),
9582 DollarQuoted {
9585 content: String,
9586 tag: Option<String>,
9587 },
9588 RawBlock(String),
9590}
9591
9592#[derive(
9594 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9595)]
9596#[cfg_attr(feature = "bindings", derive(TS))]
9597pub enum FunctionSecurity {
9598 Definer,
9599 Invoker,
9600 None,
9602}
9603
9604impl CreateFunction {
9605 pub fn new(name: impl Into<String>) -> Self {
9606 Self {
9607 name: TableRef::new(name),
9608 parameters: Vec::new(),
9609 return_type: None,
9610 body: None,
9611 or_replace: false,
9612 or_alter: false,
9613 if_not_exists: false,
9614 temporary: false,
9615 language: None,
9616 deterministic: None,
9617 returns_null_on_null_input: None,
9618 security: None,
9619 has_parens: true,
9620 sql_data_access: None,
9621 returns_table_body: None,
9622 language_first: false,
9623 set_options: Vec::new(),
9624 strict: false,
9625 options: Vec::new(),
9626 is_table_function: false,
9627 property_order: Vec::new(),
9628 using_resources: Vec::new(),
9629 environment: Vec::new(),
9630 handler: None,
9631 handler_uses_eq: false,
9632 runtime_version: None,
9633 packages: None,
9634 parameter_style: None,
9635 }
9636 }
9637}
9638
9639#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9641#[cfg_attr(feature = "bindings", derive(TS))]
9642pub struct DropFunction {
9643 pub name: TableRef,
9644 pub parameters: Option<Vec<DataType>>,
9645 pub if_exists: bool,
9646 pub cascade: bool,
9647}
9648
9649impl DropFunction {
9650 pub fn new(name: impl Into<String>) -> Self {
9651 Self {
9652 name: TableRef::new(name),
9653 parameters: None,
9654 if_exists: false,
9655 cascade: false,
9656 }
9657 }
9658}
9659
9660#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9662#[cfg_attr(feature = "bindings", derive(TS))]
9663pub struct CreateProcedure {
9664 pub name: TableRef,
9665 pub parameters: Vec<FunctionParameter>,
9666 pub body: Option<FunctionBody>,
9667 pub or_replace: bool,
9668 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9670 pub or_alter: bool,
9671 pub if_not_exists: bool,
9672 pub language: Option<String>,
9673 pub security: Option<FunctionSecurity>,
9674 #[serde(default)]
9676 pub return_type: Option<DataType>,
9677 #[serde(default)]
9679 pub execute_as: Option<String>,
9680 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9682 pub with_options: Vec<String>,
9683 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9685 pub has_parens: bool,
9686 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9688 pub use_proc_keyword: bool,
9689}
9690
9691impl CreateProcedure {
9692 pub fn new(name: impl Into<String>) -> Self {
9693 Self {
9694 name: TableRef::new(name),
9695 parameters: Vec::new(),
9696 body: None,
9697 or_replace: false,
9698 or_alter: false,
9699 if_not_exists: false,
9700 language: None,
9701 security: None,
9702 return_type: None,
9703 execute_as: None,
9704 with_options: Vec::new(),
9705 has_parens: true,
9706 use_proc_keyword: false,
9707 }
9708 }
9709}
9710
9711#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9713#[cfg_attr(feature = "bindings", derive(TS))]
9714pub struct DropProcedure {
9715 pub name: TableRef,
9716 pub parameters: Option<Vec<DataType>>,
9717 pub if_exists: bool,
9718 pub cascade: bool,
9719}
9720
9721impl DropProcedure {
9722 pub fn new(name: impl Into<String>) -> Self {
9723 Self {
9724 name: TableRef::new(name),
9725 parameters: None,
9726 if_exists: false,
9727 cascade: false,
9728 }
9729 }
9730}
9731
9732#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9734#[cfg_attr(feature = "bindings", derive(TS))]
9735pub enum SeqPropKind {
9736 Start,
9737 Increment,
9738 Minvalue,
9739 Maxvalue,
9740 Cache,
9741 NoCache,
9742 Cycle,
9743 NoCycle,
9744 OwnedBy,
9745 Order,
9746 NoOrder,
9747 Comment,
9748 Sharing,
9750 Keep,
9752 NoKeep,
9754 Scale,
9756 NoScale,
9758 Shard,
9760 NoShard,
9762 Session,
9764 Global,
9766 NoCacheWord,
9768 NoCycleWord,
9770 NoMinvalueWord,
9772 NoMaxvalueWord,
9774}
9775
9776#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9778#[cfg_attr(feature = "bindings", derive(TS))]
9779pub struct CreateSynonym {
9780 pub name: TableRef,
9782 pub target: TableRef,
9784}
9785
9786#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9788#[cfg_attr(feature = "bindings", derive(TS))]
9789pub struct CreateSequence {
9790 pub name: TableRef,
9791 pub if_not_exists: bool,
9792 pub temporary: bool,
9793 #[serde(default)]
9794 pub or_replace: bool,
9795 #[serde(default, skip_serializing_if = "Option::is_none")]
9797 pub as_type: Option<DataType>,
9798 pub increment: Option<i64>,
9799 pub minvalue: Option<SequenceBound>,
9800 pub maxvalue: Option<SequenceBound>,
9801 pub start: Option<i64>,
9802 pub cache: Option<i64>,
9803 pub cycle: bool,
9804 pub owned_by: Option<TableRef>,
9805 #[serde(default)]
9807 pub owned_by_none: bool,
9808 #[serde(default)]
9810 pub order: Option<bool>,
9811 #[serde(default)]
9813 pub comment: Option<String>,
9814 #[serde(default, skip_serializing_if = "Option::is_none")]
9816 pub sharing: Option<String>,
9817 #[serde(default, skip_serializing_if = "Option::is_none")]
9819 pub scale_modifier: Option<String>,
9820 #[serde(default, skip_serializing_if = "Option::is_none")]
9822 pub shard_modifier: Option<String>,
9823 #[serde(default)]
9825 pub property_order: Vec<SeqPropKind>,
9826}
9827
9828#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9830#[cfg_attr(feature = "bindings", derive(TS))]
9831pub enum SequenceBound {
9832 Value(i64),
9833 None,
9834}
9835
9836impl CreateSequence {
9837 pub fn new(name: impl Into<String>) -> Self {
9838 Self {
9839 name: TableRef::new(name),
9840 if_not_exists: false,
9841 temporary: false,
9842 or_replace: false,
9843 as_type: None,
9844 increment: None,
9845 minvalue: None,
9846 maxvalue: None,
9847 start: None,
9848 cache: None,
9849 cycle: false,
9850 owned_by: None,
9851 owned_by_none: false,
9852 order: None,
9853 comment: None,
9854 sharing: None,
9855 scale_modifier: None,
9856 shard_modifier: None,
9857 property_order: Vec::new(),
9858 }
9859 }
9860}
9861
9862#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9864#[cfg_attr(feature = "bindings", derive(TS))]
9865pub struct DropSequence {
9866 pub name: TableRef,
9867 pub if_exists: bool,
9868 pub cascade: bool,
9869}
9870
9871impl DropSequence {
9872 pub fn new(name: impl Into<String>) -> Self {
9873 Self {
9874 name: TableRef::new(name),
9875 if_exists: false,
9876 cascade: false,
9877 }
9878 }
9879}
9880
9881#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9883#[cfg_attr(feature = "bindings", derive(TS))]
9884pub struct AlterSequence {
9885 pub name: TableRef,
9886 pub if_exists: bool,
9887 pub increment: Option<i64>,
9888 pub minvalue: Option<SequenceBound>,
9889 pub maxvalue: Option<SequenceBound>,
9890 pub start: Option<i64>,
9891 pub restart: Option<Option<i64>>,
9892 pub cache: Option<i64>,
9893 pub cycle: Option<bool>,
9894 pub owned_by: Option<Option<TableRef>>,
9895}
9896
9897impl AlterSequence {
9898 pub fn new(name: impl Into<String>) -> Self {
9899 Self {
9900 name: TableRef::new(name),
9901 if_exists: false,
9902 increment: None,
9903 minvalue: None,
9904 maxvalue: None,
9905 start: None,
9906 restart: None,
9907 cache: None,
9908 cycle: None,
9909 owned_by: None,
9910 }
9911 }
9912}
9913
9914#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9916#[cfg_attr(feature = "bindings", derive(TS))]
9917pub struct CreateTrigger {
9918 pub name: Identifier,
9919 pub table: TableRef,
9920 pub timing: TriggerTiming,
9921 pub events: Vec<TriggerEvent>,
9922 #[serde(default, skip_serializing_if = "Option::is_none")]
9923 pub for_each: Option<TriggerForEach>,
9924 pub when: Option<Expression>,
9925 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9927 pub when_paren: bool,
9928 pub body: TriggerBody,
9929 pub or_replace: bool,
9930 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9932 pub or_alter: bool,
9933 pub constraint: bool,
9934 pub deferrable: Option<bool>,
9935 pub initially_deferred: Option<bool>,
9936 pub referencing: Option<TriggerReferencing>,
9937}
9938
9939#[derive(
9941 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9942)]
9943#[cfg_attr(feature = "bindings", derive(TS))]
9944pub enum TriggerTiming {
9945 Before,
9946 After,
9947 InsteadOf,
9948}
9949
9950#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9952#[cfg_attr(feature = "bindings", derive(TS))]
9953pub enum TriggerEvent {
9954 Insert,
9955 Update(Option<Vec<Identifier>>),
9956 Delete,
9957 Truncate,
9958}
9959
9960#[derive(
9962 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9963)]
9964#[cfg_attr(feature = "bindings", derive(TS))]
9965pub enum TriggerForEach {
9966 Row,
9967 Statement,
9968}
9969
9970#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9972#[cfg_attr(feature = "bindings", derive(TS))]
9973pub enum TriggerBody {
9974 Execute {
9976 function: TableRef,
9977 args: Vec<Expression>,
9978 },
9979 Block(String),
9981}
9982
9983#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9985#[cfg_attr(feature = "bindings", derive(TS))]
9986pub struct TriggerReferencing {
9987 pub old_table: Option<Identifier>,
9988 pub new_table: Option<Identifier>,
9989 pub old_row: Option<Identifier>,
9990 pub new_row: Option<Identifier>,
9991}
9992
9993impl CreateTrigger {
9994 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
9995 Self {
9996 name: Identifier::new(name),
9997 table: TableRef::new(table),
9998 timing: TriggerTiming::Before,
9999 events: Vec::new(),
10000 for_each: Some(TriggerForEach::Row),
10001 when: None,
10002 when_paren: false,
10003 body: TriggerBody::Execute {
10004 function: TableRef::new(""),
10005 args: Vec::new(),
10006 },
10007 or_replace: false,
10008 or_alter: false,
10009 constraint: false,
10010 deferrable: None,
10011 initially_deferred: None,
10012 referencing: None,
10013 }
10014 }
10015}
10016
10017#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10019#[cfg_attr(feature = "bindings", derive(TS))]
10020pub struct DropTrigger {
10021 pub name: Identifier,
10022 pub table: Option<TableRef>,
10023 pub if_exists: bool,
10024 pub cascade: bool,
10025}
10026
10027impl DropTrigger {
10028 pub fn new(name: impl Into<String>) -> Self {
10029 Self {
10030 name: Identifier::new(name),
10031 table: None,
10032 if_exists: false,
10033 cascade: false,
10034 }
10035 }
10036}
10037
10038#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10040#[cfg_attr(feature = "bindings", derive(TS))]
10041pub struct CreateType {
10042 pub name: TableRef,
10043 pub definition: TypeDefinition,
10044 pub if_not_exists: bool,
10045}
10046
10047#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10049#[cfg_attr(feature = "bindings", derive(TS))]
10050pub enum TypeDefinition {
10051 Enum(Vec<String>),
10053 Composite(Vec<TypeAttribute>),
10055 Range {
10057 subtype: DataType,
10058 subtype_diff: Option<String>,
10059 canonical: Option<String>,
10060 },
10061 Base {
10063 input: String,
10064 output: String,
10065 internallength: Option<i32>,
10066 },
10067 Domain {
10069 base_type: DataType,
10070 default: Option<Expression>,
10071 constraints: Vec<DomainConstraint>,
10072 },
10073}
10074
10075#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10077#[cfg_attr(feature = "bindings", derive(TS))]
10078pub struct TypeAttribute {
10079 pub name: Identifier,
10080 pub data_type: DataType,
10081 pub collate: Option<Identifier>,
10082}
10083
10084#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10086#[cfg_attr(feature = "bindings", derive(TS))]
10087pub struct DomainConstraint {
10088 pub name: Option<Identifier>,
10089 pub check: Expression,
10090}
10091
10092impl CreateType {
10093 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
10094 Self {
10095 name: TableRef::new(name),
10096 definition: TypeDefinition::Enum(values),
10097 if_not_exists: false,
10098 }
10099 }
10100
10101 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
10102 Self {
10103 name: TableRef::new(name),
10104 definition: TypeDefinition::Composite(attributes),
10105 if_not_exists: false,
10106 }
10107 }
10108}
10109
10110#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10112#[cfg_attr(feature = "bindings", derive(TS))]
10113pub struct DropType {
10114 pub name: TableRef,
10115 pub if_exists: bool,
10116 pub cascade: bool,
10117}
10118
10119impl DropType {
10120 pub fn new(name: impl Into<String>) -> Self {
10121 Self {
10122 name: TableRef::new(name),
10123 if_exists: false,
10124 cascade: false,
10125 }
10126 }
10127}
10128
10129#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10131#[cfg_attr(feature = "bindings", derive(TS))]
10132pub struct Describe {
10133 pub target: Expression,
10135 pub extended: bool,
10137 pub formatted: bool,
10139 #[serde(default)]
10141 pub kind: Option<String>,
10142 #[serde(default)]
10144 pub properties: Vec<(String, String)>,
10145 #[serde(default, skip_serializing_if = "Option::is_none")]
10147 pub style: Option<String>,
10148 #[serde(default)]
10150 pub partition: Option<Box<Expression>>,
10151 #[serde(default)]
10153 pub leading_comments: Vec<String>,
10154 #[serde(default)]
10156 pub as_json: bool,
10157 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10159 pub params: Vec<String>,
10160}
10161
10162impl Describe {
10163 pub fn new(target: Expression) -> Self {
10164 Self {
10165 target,
10166 extended: false,
10167 formatted: false,
10168 kind: None,
10169 properties: Vec::new(),
10170 style: None,
10171 partition: None,
10172 leading_comments: Vec::new(),
10173 as_json: false,
10174 params: Vec::new(),
10175 }
10176 }
10177}
10178
10179#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10181#[cfg_attr(feature = "bindings", derive(TS))]
10182pub struct Show {
10183 pub this: String,
10185 #[serde(default)]
10187 pub terse: bool,
10188 #[serde(default)]
10190 pub history: bool,
10191 pub like: Option<Expression>,
10193 pub scope_kind: Option<String>,
10195 pub scope: Option<Expression>,
10197 pub starts_with: Option<Expression>,
10199 pub limit: Option<Box<Limit>>,
10201 pub from: Option<Expression>,
10203 #[serde(default, skip_serializing_if = "Option::is_none")]
10205 pub where_clause: Option<Expression>,
10206 #[serde(default, skip_serializing_if = "Option::is_none")]
10208 pub for_target: Option<Expression>,
10209 #[serde(default, skip_serializing_if = "Option::is_none")]
10211 pub db: Option<Expression>,
10212 #[serde(default, skip_serializing_if = "Option::is_none")]
10214 pub target: Option<Expression>,
10215 #[serde(default, skip_serializing_if = "Option::is_none")]
10217 pub mutex: Option<bool>,
10218 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10220 pub privileges: Vec<String>,
10221}
10222
10223impl Show {
10224 pub fn new(this: impl Into<String>) -> Self {
10225 Self {
10226 this: this.into(),
10227 terse: false,
10228 history: false,
10229 like: None,
10230 scope_kind: None,
10231 scope: None,
10232 starts_with: None,
10233 limit: None,
10234 from: None,
10235 where_clause: None,
10236 for_target: None,
10237 db: None,
10238 target: None,
10239 mutex: None,
10240 privileges: Vec::new(),
10241 }
10242 }
10243}
10244
10245#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10250#[cfg_attr(feature = "bindings", derive(TS))]
10251pub struct Paren {
10252 pub this: Expression,
10254 #[serde(default)]
10255 pub trailing_comments: Vec<String>,
10256}
10257
10258#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10260#[cfg_attr(feature = "bindings", derive(TS))]
10261pub struct Annotated {
10262 pub this: Expression,
10263 pub trailing_comments: Vec<String>,
10264}
10265
10266#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10271#[cfg_attr(feature = "bindings", derive(TS))]
10272pub struct Refresh {
10273 pub this: Box<Expression>,
10274 pub kind: String,
10275}
10276
10277#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10279#[cfg_attr(feature = "bindings", derive(TS))]
10280pub struct LockingStatement {
10281 pub this: Box<Expression>,
10282 pub expression: Box<Expression>,
10283}
10284
10285#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10287#[cfg_attr(feature = "bindings", derive(TS))]
10288pub struct SequenceProperties {
10289 #[serde(default)]
10290 pub increment: Option<Box<Expression>>,
10291 #[serde(default)]
10292 pub minvalue: Option<Box<Expression>>,
10293 #[serde(default)]
10294 pub maxvalue: Option<Box<Expression>>,
10295 #[serde(default)]
10296 pub cache: Option<Box<Expression>>,
10297 #[serde(default)]
10298 pub start: Option<Box<Expression>>,
10299 #[serde(default)]
10300 pub owned: Option<Box<Expression>>,
10301 #[serde(default)]
10302 pub options: Vec<Expression>,
10303}
10304
10305#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10307#[cfg_attr(feature = "bindings", derive(TS))]
10308pub struct TruncateTable {
10309 #[serde(default)]
10310 pub expressions: Vec<Expression>,
10311 #[serde(default)]
10312 pub is_database: Option<Box<Expression>>,
10313 #[serde(default)]
10314 pub exists: bool,
10315 #[serde(default)]
10316 pub only: Option<Box<Expression>>,
10317 #[serde(default)]
10318 pub cluster: Option<Box<Expression>>,
10319 #[serde(default)]
10320 pub identity: Option<Box<Expression>>,
10321 #[serde(default)]
10322 pub option: Option<Box<Expression>>,
10323 #[serde(default)]
10324 pub partition: Option<Box<Expression>>,
10325}
10326
10327#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10329#[cfg_attr(feature = "bindings", derive(TS))]
10330pub struct Clone {
10331 pub this: Box<Expression>,
10332 #[serde(default)]
10333 pub shallow: Option<Box<Expression>>,
10334 #[serde(default)]
10335 pub copy: Option<Box<Expression>>,
10336}
10337
10338#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10340#[cfg_attr(feature = "bindings", derive(TS))]
10341pub struct Attach {
10342 pub this: Box<Expression>,
10343 #[serde(default)]
10344 pub exists: bool,
10345 #[serde(default)]
10346 pub expressions: Vec<Expression>,
10347}
10348
10349#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10351#[cfg_attr(feature = "bindings", derive(TS))]
10352pub struct Detach {
10353 pub this: Box<Expression>,
10354 #[serde(default)]
10355 pub exists: bool,
10356}
10357
10358#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10360#[cfg_attr(feature = "bindings", derive(TS))]
10361pub struct Install {
10362 pub this: Box<Expression>,
10363 #[serde(default)]
10364 pub from_: Option<Box<Expression>>,
10365 #[serde(default)]
10366 pub force: Option<Box<Expression>>,
10367}
10368
10369#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10371#[cfg_attr(feature = "bindings", derive(TS))]
10372pub struct Summarize {
10373 pub this: Box<Expression>,
10374 #[serde(default)]
10375 pub table: Option<Box<Expression>>,
10376}
10377
10378#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10380#[cfg_attr(feature = "bindings", derive(TS))]
10381pub struct Declare {
10382 #[serde(default)]
10383 pub expressions: Vec<Expression>,
10384 #[serde(default)]
10385 pub replace: bool,
10386}
10387
10388#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10390#[cfg_attr(feature = "bindings", derive(TS))]
10391pub struct DeclareItem {
10392 pub this: Box<Expression>,
10393 #[serde(default)]
10394 pub kind: Option<String>,
10395 #[serde(default)]
10396 pub default: Option<Box<Expression>>,
10397 #[serde(default)]
10398 pub has_as: bool,
10399 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10401 pub additional_names: Vec<Expression>,
10402}
10403
10404#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10406#[cfg_attr(feature = "bindings", derive(TS))]
10407pub struct Set {
10408 #[serde(default)]
10409 pub expressions: Vec<Expression>,
10410 #[serde(default)]
10411 pub unset: Option<Box<Expression>>,
10412 #[serde(default)]
10413 pub tag: Option<Box<Expression>>,
10414}
10415
10416#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10418#[cfg_attr(feature = "bindings", derive(TS))]
10419pub struct Heredoc {
10420 pub this: Box<Expression>,
10421 #[serde(default)]
10422 pub tag: Option<Box<Expression>>,
10423}
10424
10425#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10427#[cfg_attr(feature = "bindings", derive(TS))]
10428pub struct QueryBand {
10429 pub this: Box<Expression>,
10430 #[serde(default)]
10431 pub scope: Option<Box<Expression>>,
10432 #[serde(default)]
10433 pub update: Option<Box<Expression>>,
10434}
10435
10436#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10438#[cfg_attr(feature = "bindings", derive(TS))]
10439pub struct UserDefinedFunction {
10440 pub this: Box<Expression>,
10441 #[serde(default)]
10442 pub expressions: Vec<Expression>,
10443 #[serde(default)]
10444 pub wrapped: Option<Box<Expression>>,
10445}
10446
10447#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10449#[cfg_attr(feature = "bindings", derive(TS))]
10450pub struct RecursiveWithSearch {
10451 pub kind: String,
10452 pub this: Box<Expression>,
10453 pub expression: Box<Expression>,
10454 #[serde(default)]
10455 pub using: Option<Box<Expression>>,
10456}
10457
10458#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10460#[cfg_attr(feature = "bindings", derive(TS))]
10461pub struct ProjectionDef {
10462 pub this: Box<Expression>,
10463 pub expression: Box<Expression>,
10464}
10465
10466#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10468#[cfg_attr(feature = "bindings", derive(TS))]
10469pub struct TableAlias {
10470 #[serde(default)]
10471 pub this: Option<Box<Expression>>,
10472 #[serde(default)]
10473 pub columns: Vec<Expression>,
10474}
10475
10476#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10478#[cfg_attr(feature = "bindings", derive(TS))]
10479pub struct ByteString {
10480 pub this: Box<Expression>,
10481 #[serde(default)]
10482 pub is_bytes: Option<Box<Expression>>,
10483}
10484
10485#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10488#[cfg_attr(feature = "bindings", derive(TS))]
10489pub struct HexStringExpr {
10490 pub this: Box<Expression>,
10491 #[serde(default)]
10492 pub is_integer: Option<bool>,
10493}
10494
10495#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10497#[cfg_attr(feature = "bindings", derive(TS))]
10498pub struct UnicodeString {
10499 pub this: Box<Expression>,
10500 #[serde(default)]
10501 pub escape: Option<Box<Expression>>,
10502}
10503
10504#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10506#[cfg_attr(feature = "bindings", derive(TS))]
10507pub struct AlterColumn {
10508 pub this: Box<Expression>,
10509 #[serde(default)]
10510 pub dtype: Option<Box<Expression>>,
10511 #[serde(default)]
10512 pub collate: Option<Box<Expression>>,
10513 #[serde(default)]
10514 pub using: Option<Box<Expression>>,
10515 #[serde(default)]
10516 pub default: Option<Box<Expression>>,
10517 #[serde(default)]
10518 pub drop: Option<Box<Expression>>,
10519 #[serde(default)]
10520 pub comment: Option<Box<Expression>>,
10521 #[serde(default)]
10522 pub allow_null: Option<Box<Expression>>,
10523 #[serde(default)]
10524 pub visible: Option<Box<Expression>>,
10525 #[serde(default)]
10526 pub rename_to: Option<Box<Expression>>,
10527}
10528
10529#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10531#[cfg_attr(feature = "bindings", derive(TS))]
10532pub struct AlterSortKey {
10533 #[serde(default)]
10534 pub this: Option<Box<Expression>>,
10535 #[serde(default)]
10536 pub expressions: Vec<Expression>,
10537 #[serde(default)]
10538 pub compound: Option<Box<Expression>>,
10539}
10540
10541#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10543#[cfg_attr(feature = "bindings", derive(TS))]
10544pub struct AlterSet {
10545 #[serde(default)]
10546 pub expressions: Vec<Expression>,
10547 #[serde(default)]
10548 pub option: Option<Box<Expression>>,
10549 #[serde(default)]
10550 pub tablespace: Option<Box<Expression>>,
10551 #[serde(default)]
10552 pub access_method: Option<Box<Expression>>,
10553 #[serde(default)]
10554 pub file_format: Option<Box<Expression>>,
10555 #[serde(default)]
10556 pub copy_options: Option<Box<Expression>>,
10557 #[serde(default)]
10558 pub tag: Option<Box<Expression>>,
10559 #[serde(default)]
10560 pub location: Option<Box<Expression>>,
10561 #[serde(default)]
10562 pub serde: Option<Box<Expression>>,
10563}
10564
10565#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10567#[cfg_attr(feature = "bindings", derive(TS))]
10568pub struct RenameColumn {
10569 pub this: Box<Expression>,
10570 #[serde(default)]
10571 pub to: Option<Box<Expression>>,
10572 #[serde(default)]
10573 pub exists: bool,
10574}
10575
10576#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10578#[cfg_attr(feature = "bindings", derive(TS))]
10579pub struct Comprehension {
10580 pub this: Box<Expression>,
10581 pub expression: Box<Expression>,
10582 #[serde(default)]
10583 pub position: Option<Box<Expression>>,
10584 #[serde(default)]
10585 pub iterator: Option<Box<Expression>>,
10586 #[serde(default)]
10587 pub condition: Option<Box<Expression>>,
10588}
10589
10590#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10592#[cfg_attr(feature = "bindings", derive(TS))]
10593pub struct MergeTreeTTLAction {
10594 pub this: Box<Expression>,
10595 #[serde(default)]
10596 pub delete: Option<Box<Expression>>,
10597 #[serde(default)]
10598 pub recompress: Option<Box<Expression>>,
10599 #[serde(default)]
10600 pub to_disk: Option<Box<Expression>>,
10601 #[serde(default)]
10602 pub to_volume: Option<Box<Expression>>,
10603}
10604
10605#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10607#[cfg_attr(feature = "bindings", derive(TS))]
10608pub struct MergeTreeTTL {
10609 #[serde(default)]
10610 pub expressions: Vec<Expression>,
10611 #[serde(default)]
10612 pub where_: Option<Box<Expression>>,
10613 #[serde(default)]
10614 pub group: Option<Box<Expression>>,
10615 #[serde(default)]
10616 pub aggregates: Option<Box<Expression>>,
10617}
10618
10619#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10621#[cfg_attr(feature = "bindings", derive(TS))]
10622pub struct IndexConstraintOption {
10623 #[serde(default)]
10624 pub key_block_size: Option<Box<Expression>>,
10625 #[serde(default)]
10626 pub using: Option<Box<Expression>>,
10627 #[serde(default)]
10628 pub parser: Option<Box<Expression>>,
10629 #[serde(default)]
10630 pub comment: Option<Box<Expression>>,
10631 #[serde(default)]
10632 pub visible: Option<Box<Expression>>,
10633 #[serde(default)]
10634 pub engine_attr: Option<Box<Expression>>,
10635 #[serde(default)]
10636 pub secondary_engine_attr: Option<Box<Expression>>,
10637}
10638
10639#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10641#[cfg_attr(feature = "bindings", derive(TS))]
10642pub struct PeriodForSystemTimeConstraint {
10643 pub this: Box<Expression>,
10644 pub expression: Box<Expression>,
10645}
10646
10647#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10649#[cfg_attr(feature = "bindings", derive(TS))]
10650pub struct CaseSpecificColumnConstraint {
10651 #[serde(default)]
10652 pub not_: Option<Box<Expression>>,
10653}
10654
10655#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10657#[cfg_attr(feature = "bindings", derive(TS))]
10658pub struct CharacterSetColumnConstraint {
10659 pub this: Box<Expression>,
10660}
10661
10662#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10664#[cfg_attr(feature = "bindings", derive(TS))]
10665pub struct CheckColumnConstraint {
10666 pub this: Box<Expression>,
10667 #[serde(default)]
10668 pub enforced: Option<Box<Expression>>,
10669}
10670
10671#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10673#[cfg_attr(feature = "bindings", derive(TS))]
10674pub struct AssumeColumnConstraint {
10675 pub this: Box<Expression>,
10676}
10677
10678#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10680#[cfg_attr(feature = "bindings", derive(TS))]
10681pub struct CompressColumnConstraint {
10682 #[serde(default)]
10683 pub this: Option<Box<Expression>>,
10684}
10685
10686#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10688#[cfg_attr(feature = "bindings", derive(TS))]
10689pub struct DateFormatColumnConstraint {
10690 pub this: Box<Expression>,
10691}
10692
10693#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10695#[cfg_attr(feature = "bindings", derive(TS))]
10696pub struct EphemeralColumnConstraint {
10697 #[serde(default)]
10698 pub this: Option<Box<Expression>>,
10699}
10700
10701#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10703#[cfg_attr(feature = "bindings", derive(TS))]
10704pub struct WithOperator {
10705 pub this: Box<Expression>,
10706 pub op: String,
10707}
10708
10709#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10711#[cfg_attr(feature = "bindings", derive(TS))]
10712pub struct GeneratedAsIdentityColumnConstraint {
10713 #[serde(default)]
10714 pub this: Option<Box<Expression>>,
10715 #[serde(default)]
10716 pub expression: Option<Box<Expression>>,
10717 #[serde(default)]
10718 pub on_null: Option<Box<Expression>>,
10719 #[serde(default)]
10720 pub start: Option<Box<Expression>>,
10721 #[serde(default)]
10722 pub increment: Option<Box<Expression>>,
10723 #[serde(default)]
10724 pub minvalue: Option<Box<Expression>>,
10725 #[serde(default)]
10726 pub maxvalue: Option<Box<Expression>>,
10727 #[serde(default)]
10728 pub cycle: Option<Box<Expression>>,
10729 #[serde(default)]
10730 pub order: Option<Box<Expression>>,
10731}
10732
10733#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10736#[cfg_attr(feature = "bindings", derive(TS))]
10737pub struct AutoIncrementColumnConstraint;
10738
10739#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10741#[cfg_attr(feature = "bindings", derive(TS))]
10742pub struct CommentColumnConstraint;
10743
10744#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10746#[cfg_attr(feature = "bindings", derive(TS))]
10747pub struct GeneratedAsRowColumnConstraint {
10748 #[serde(default)]
10749 pub start: Option<Box<Expression>>,
10750 #[serde(default)]
10751 pub hidden: Option<Box<Expression>>,
10752}
10753
10754#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10756#[cfg_attr(feature = "bindings", derive(TS))]
10757pub struct IndexColumnConstraint {
10758 #[serde(default)]
10759 pub this: Option<Box<Expression>>,
10760 #[serde(default)]
10761 pub expressions: Vec<Expression>,
10762 #[serde(default)]
10763 pub kind: Option<String>,
10764 #[serde(default)]
10765 pub index_type: Option<Box<Expression>>,
10766 #[serde(default)]
10767 pub options: Vec<Expression>,
10768 #[serde(default)]
10769 pub expression: Option<Box<Expression>>,
10770 #[serde(default)]
10771 pub granularity: Option<Box<Expression>>,
10772}
10773
10774#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10776#[cfg_attr(feature = "bindings", derive(TS))]
10777pub struct MaskingPolicyColumnConstraint {
10778 pub this: Box<Expression>,
10779 #[serde(default)]
10780 pub expressions: Vec<Expression>,
10781}
10782
10783#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10785#[cfg_attr(feature = "bindings", derive(TS))]
10786pub struct NotNullColumnConstraint {
10787 #[serde(default)]
10788 pub allow_null: Option<Box<Expression>>,
10789}
10790
10791#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10793#[cfg_attr(feature = "bindings", derive(TS))]
10794pub struct DefaultColumnConstraint {
10795 pub this: Box<Expression>,
10796 #[serde(default, skip_serializing_if = "Option::is_none")]
10798 pub for_column: Option<Identifier>,
10799}
10800
10801#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10803#[cfg_attr(feature = "bindings", derive(TS))]
10804pub struct PrimaryKeyColumnConstraint {
10805 #[serde(default)]
10806 pub desc: Option<Box<Expression>>,
10807 #[serde(default)]
10808 pub options: Vec<Expression>,
10809}
10810
10811#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct UniqueColumnConstraint {
10815 #[serde(default)]
10816 pub this: Option<Box<Expression>>,
10817 #[serde(default)]
10818 pub index_type: Option<Box<Expression>>,
10819 #[serde(default)]
10820 pub on_conflict: Option<Box<Expression>>,
10821 #[serde(default)]
10822 pub nulls: Option<Box<Expression>>,
10823 #[serde(default)]
10824 pub options: Vec<Expression>,
10825}
10826
10827#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10829#[cfg_attr(feature = "bindings", derive(TS))]
10830pub struct WatermarkColumnConstraint {
10831 pub this: Box<Expression>,
10832 pub expression: Box<Expression>,
10833}
10834
10835#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10837#[cfg_attr(feature = "bindings", derive(TS))]
10838pub struct ComputedColumnConstraint {
10839 pub this: Box<Expression>,
10840 #[serde(default)]
10841 pub persisted: Option<Box<Expression>>,
10842 #[serde(default)]
10843 pub not_null: Option<Box<Expression>>,
10844 #[serde(default)]
10845 pub data_type: Option<Box<Expression>>,
10846}
10847
10848#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10850#[cfg_attr(feature = "bindings", derive(TS))]
10851pub struct InOutColumnConstraint {
10852 #[serde(default)]
10853 pub input_: Option<Box<Expression>>,
10854 #[serde(default)]
10855 pub output: Option<Box<Expression>>,
10856}
10857
10858#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10860#[cfg_attr(feature = "bindings", derive(TS))]
10861pub struct PathColumnConstraint {
10862 pub this: Box<Expression>,
10863}
10864
10865#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10867#[cfg_attr(feature = "bindings", derive(TS))]
10868pub struct Constraint {
10869 pub this: Box<Expression>,
10870 #[serde(default)]
10871 pub expressions: Vec<Expression>,
10872}
10873
10874#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10876#[cfg_attr(feature = "bindings", derive(TS))]
10877pub struct Export {
10878 pub this: Box<Expression>,
10879 #[serde(default)]
10880 pub connection: Option<Box<Expression>>,
10881 #[serde(default)]
10882 pub options: Vec<Expression>,
10883}
10884
10885#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10887#[cfg_attr(feature = "bindings", derive(TS))]
10888pub struct Filter {
10889 pub this: Box<Expression>,
10890 pub expression: Box<Expression>,
10891}
10892
10893#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10895#[cfg_attr(feature = "bindings", derive(TS))]
10896pub struct Changes {
10897 #[serde(default)]
10898 pub information: Option<Box<Expression>>,
10899 #[serde(default)]
10900 pub at_before: Option<Box<Expression>>,
10901 #[serde(default)]
10902 pub end: Option<Box<Expression>>,
10903}
10904
10905#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10907#[cfg_attr(feature = "bindings", derive(TS))]
10908pub struct Directory {
10909 pub this: Box<Expression>,
10910 #[serde(default)]
10911 pub local: Option<Box<Expression>>,
10912 #[serde(default)]
10913 pub row_format: Option<Box<Expression>>,
10914}
10915
10916#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10918#[cfg_attr(feature = "bindings", derive(TS))]
10919pub struct ForeignKey {
10920 #[serde(default)]
10921 pub expressions: Vec<Expression>,
10922 #[serde(default)]
10923 pub reference: Option<Box<Expression>>,
10924 #[serde(default)]
10925 pub delete: Option<Box<Expression>>,
10926 #[serde(default)]
10927 pub update: Option<Box<Expression>>,
10928 #[serde(default)]
10929 pub options: Vec<Expression>,
10930}
10931
10932#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10934#[cfg_attr(feature = "bindings", derive(TS))]
10935pub struct ColumnPrefix {
10936 pub this: Box<Expression>,
10937 pub expression: Box<Expression>,
10938}
10939
10940#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10942#[cfg_attr(feature = "bindings", derive(TS))]
10943pub struct PrimaryKey {
10944 #[serde(default)]
10945 pub this: Option<Box<Expression>>,
10946 #[serde(default)]
10947 pub expressions: Vec<Expression>,
10948 #[serde(default)]
10949 pub options: Vec<Expression>,
10950 #[serde(default)]
10951 pub include: Option<Box<Expression>>,
10952}
10953
10954#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10956#[cfg_attr(feature = "bindings", derive(TS))]
10957pub struct IntoClause {
10958 #[serde(default)]
10959 pub this: Option<Box<Expression>>,
10960 #[serde(default)]
10961 pub temporary: bool,
10962 #[serde(default)]
10963 pub unlogged: Option<Box<Expression>>,
10964 #[serde(default)]
10965 pub bulk_collect: Option<Box<Expression>>,
10966 #[serde(default)]
10967 pub expressions: Vec<Expression>,
10968}
10969
10970#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10972#[cfg_attr(feature = "bindings", derive(TS))]
10973pub struct JoinHint {
10974 pub this: Box<Expression>,
10975 #[serde(default)]
10976 pub expressions: Vec<Expression>,
10977}
10978
10979#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10981#[cfg_attr(feature = "bindings", derive(TS))]
10982pub struct Opclass {
10983 pub this: Box<Expression>,
10984 pub expression: Box<Expression>,
10985}
10986
10987#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10989#[cfg_attr(feature = "bindings", derive(TS))]
10990pub struct Index {
10991 #[serde(default)]
10992 pub this: Option<Box<Expression>>,
10993 #[serde(default)]
10994 pub table: Option<Box<Expression>>,
10995 #[serde(default)]
10996 pub unique: bool,
10997 #[serde(default)]
10998 pub primary: Option<Box<Expression>>,
10999 #[serde(default)]
11000 pub amp: Option<Box<Expression>>,
11001 #[serde(default)]
11002 pub params: Vec<Expression>,
11003}
11004
11005#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11007#[cfg_attr(feature = "bindings", derive(TS))]
11008pub struct IndexParameters {
11009 #[serde(default)]
11010 pub using: Option<Box<Expression>>,
11011 #[serde(default)]
11012 pub include: Option<Box<Expression>>,
11013 #[serde(default)]
11014 pub columns: Vec<Expression>,
11015 #[serde(default)]
11016 pub with_storage: Option<Box<Expression>>,
11017 #[serde(default)]
11018 pub partition_by: Option<Box<Expression>>,
11019 #[serde(default)]
11020 pub tablespace: Option<Box<Expression>>,
11021 #[serde(default)]
11022 pub where_: Option<Box<Expression>>,
11023 #[serde(default)]
11024 pub on: Option<Box<Expression>>,
11025}
11026
11027#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11029#[cfg_attr(feature = "bindings", derive(TS))]
11030pub struct ConditionalInsert {
11031 pub this: Box<Expression>,
11032 #[serde(default)]
11033 pub expression: Option<Box<Expression>>,
11034 #[serde(default)]
11035 pub else_: Option<Box<Expression>>,
11036}
11037
11038#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11040#[cfg_attr(feature = "bindings", derive(TS))]
11041pub struct MultitableInserts {
11042 #[serde(default)]
11043 pub expressions: Vec<Expression>,
11044 pub kind: String,
11045 #[serde(default)]
11046 pub source: Option<Box<Expression>>,
11047 #[serde(default)]
11049 pub leading_comments: Vec<String>,
11050 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
11052 pub overwrite: bool,
11053}
11054
11055#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11057#[cfg_attr(feature = "bindings", derive(TS))]
11058pub struct OnConflict {
11059 #[serde(default)]
11060 pub duplicate: Option<Box<Expression>>,
11061 #[serde(default)]
11062 pub expressions: Vec<Expression>,
11063 #[serde(default)]
11064 pub action: Option<Box<Expression>>,
11065 #[serde(default)]
11066 pub conflict_keys: Option<Box<Expression>>,
11067 #[serde(default)]
11068 pub index_predicate: Option<Box<Expression>>,
11069 #[serde(default)]
11070 pub constraint: Option<Box<Expression>>,
11071 #[serde(default)]
11072 pub where_: Option<Box<Expression>>,
11073}
11074
11075#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11077#[cfg_attr(feature = "bindings", derive(TS))]
11078pub struct OnCondition {
11079 #[serde(default)]
11080 pub error: Option<Box<Expression>>,
11081 #[serde(default)]
11082 pub empty: Option<Box<Expression>>,
11083 #[serde(default)]
11084 pub null: Option<Box<Expression>>,
11085}
11086
11087#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11089#[cfg_attr(feature = "bindings", derive(TS))]
11090pub struct Returning {
11091 #[serde(default)]
11092 pub expressions: Vec<Expression>,
11093 #[serde(default)]
11094 pub into: Option<Box<Expression>>,
11095}
11096
11097#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11099#[cfg_attr(feature = "bindings", derive(TS))]
11100pub struct Introducer {
11101 pub this: Box<Expression>,
11102 pub expression: Box<Expression>,
11103}
11104
11105#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11107#[cfg_attr(feature = "bindings", derive(TS))]
11108pub struct PartitionRange {
11109 pub this: Box<Expression>,
11110 #[serde(default)]
11111 pub expression: Option<Box<Expression>>,
11112 #[serde(default)]
11113 pub expressions: Vec<Expression>,
11114}
11115
11116#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11118#[cfg_attr(feature = "bindings", derive(TS))]
11119pub struct Group {
11120 #[serde(default)]
11121 pub expressions: Vec<Expression>,
11122 #[serde(default)]
11123 pub grouping_sets: Option<Box<Expression>>,
11124 #[serde(default)]
11125 pub cube: Option<Box<Expression>>,
11126 #[serde(default)]
11127 pub rollup: Option<Box<Expression>>,
11128 #[serde(default)]
11129 pub totals: Option<Box<Expression>>,
11130 #[serde(default)]
11132 pub all: Option<bool>,
11133}
11134
11135#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11137#[cfg_attr(feature = "bindings", derive(TS))]
11138pub struct Cube {
11139 #[serde(default)]
11140 pub expressions: Vec<Expression>,
11141}
11142
11143#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11145#[cfg_attr(feature = "bindings", derive(TS))]
11146pub struct Rollup {
11147 #[serde(default)]
11148 pub expressions: Vec<Expression>,
11149}
11150
11151#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11153#[cfg_attr(feature = "bindings", derive(TS))]
11154pub struct GroupingSets {
11155 #[serde(default)]
11156 pub expressions: Vec<Expression>,
11157}
11158
11159#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11161#[cfg_attr(feature = "bindings", derive(TS))]
11162pub struct LimitOptions {
11163 #[serde(default)]
11164 pub percent: Option<Box<Expression>>,
11165 #[serde(default)]
11166 pub rows: Option<Box<Expression>>,
11167 #[serde(default)]
11168 pub with_ties: Option<Box<Expression>>,
11169}
11170
11171#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11173#[cfg_attr(feature = "bindings", derive(TS))]
11174pub struct Lateral {
11175 pub this: Box<Expression>,
11176 #[serde(default)]
11177 pub view: Option<Box<Expression>>,
11178 #[serde(default)]
11179 pub outer: Option<Box<Expression>>,
11180 #[serde(default)]
11181 pub alias: Option<String>,
11182 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
11184 pub alias_quoted: bool,
11185 #[serde(default)]
11186 pub cross_apply: Option<Box<Expression>>,
11187 #[serde(default)]
11188 pub ordinality: Option<Box<Expression>>,
11189 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11191 pub column_aliases: Vec<String>,
11192}
11193
11194#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11196#[cfg_attr(feature = "bindings", derive(TS))]
11197pub struct TableFromRows {
11198 pub this: Box<Expression>,
11199 #[serde(default)]
11200 pub alias: Option<String>,
11201 #[serde(default)]
11202 pub joins: Vec<Expression>,
11203 #[serde(default)]
11204 pub pivots: Option<Box<Expression>>,
11205 #[serde(default)]
11206 pub sample: Option<Box<Expression>>,
11207}
11208
11209#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11212#[cfg_attr(feature = "bindings", derive(TS))]
11213pub struct RowsFrom {
11214 pub expressions: Vec<Expression>,
11216 #[serde(default)]
11218 pub ordinality: bool,
11219 #[serde(default)]
11221 pub alias: Option<Box<Expression>>,
11222}
11223
11224#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11226#[cfg_attr(feature = "bindings", derive(TS))]
11227pub struct WithFill {
11228 #[serde(default)]
11229 pub from_: Option<Box<Expression>>,
11230 #[serde(default)]
11231 pub to: Option<Box<Expression>>,
11232 #[serde(default)]
11233 pub step: Option<Box<Expression>>,
11234 #[serde(default)]
11235 pub staleness: Option<Box<Expression>>,
11236 #[serde(default)]
11237 pub interpolate: Option<Box<Expression>>,
11238}
11239
11240#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11242#[cfg_attr(feature = "bindings", derive(TS))]
11243pub struct Property {
11244 pub this: Box<Expression>,
11245 #[serde(default)]
11246 pub value: Option<Box<Expression>>,
11247}
11248
11249#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11251#[cfg_attr(feature = "bindings", derive(TS))]
11252pub struct GrantPrivilege {
11253 pub this: Box<Expression>,
11254 #[serde(default)]
11255 pub expressions: Vec<Expression>,
11256}
11257
11258#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11260#[cfg_attr(feature = "bindings", derive(TS))]
11261pub struct AllowedValuesProperty {
11262 #[serde(default)]
11263 pub expressions: Vec<Expression>,
11264}
11265
11266#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11268#[cfg_attr(feature = "bindings", derive(TS))]
11269pub struct AlgorithmProperty {
11270 pub this: Box<Expression>,
11271}
11272
11273#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11275#[cfg_attr(feature = "bindings", derive(TS))]
11276pub struct AutoIncrementProperty {
11277 pub this: Box<Expression>,
11278}
11279
11280#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11282#[cfg_attr(feature = "bindings", derive(TS))]
11283pub struct AutoRefreshProperty {
11284 pub this: Box<Expression>,
11285}
11286
11287#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11289#[cfg_attr(feature = "bindings", derive(TS))]
11290pub struct BackupProperty {
11291 pub this: Box<Expression>,
11292}
11293
11294#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11296#[cfg_attr(feature = "bindings", derive(TS))]
11297pub struct BuildProperty {
11298 pub this: Box<Expression>,
11299}
11300
11301#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11303#[cfg_attr(feature = "bindings", derive(TS))]
11304pub struct BlockCompressionProperty {
11305 #[serde(default)]
11306 pub autotemp: Option<Box<Expression>>,
11307 #[serde(default)]
11308 pub always: Option<Box<Expression>>,
11309 #[serde(default)]
11310 pub default: Option<Box<Expression>>,
11311 #[serde(default)]
11312 pub manual: Option<Box<Expression>>,
11313 #[serde(default)]
11314 pub never: Option<Box<Expression>>,
11315}
11316
11317#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11319#[cfg_attr(feature = "bindings", derive(TS))]
11320pub struct CharacterSetProperty {
11321 pub this: Box<Expression>,
11322 #[serde(default)]
11323 pub default: Option<Box<Expression>>,
11324}
11325
11326#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11328#[cfg_attr(feature = "bindings", derive(TS))]
11329pub struct ChecksumProperty {
11330 #[serde(default)]
11331 pub on: Option<Box<Expression>>,
11332 #[serde(default)]
11333 pub default: Option<Box<Expression>>,
11334}
11335
11336#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11338#[cfg_attr(feature = "bindings", derive(TS))]
11339pub struct CollateProperty {
11340 pub this: Box<Expression>,
11341 #[serde(default)]
11342 pub default: Option<Box<Expression>>,
11343}
11344
11345#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11347#[cfg_attr(feature = "bindings", derive(TS))]
11348pub struct DataBlocksizeProperty {
11349 #[serde(default)]
11350 pub size: Option<i64>,
11351 #[serde(default)]
11352 pub units: Option<Box<Expression>>,
11353 #[serde(default)]
11354 pub minimum: Option<Box<Expression>>,
11355 #[serde(default)]
11356 pub maximum: Option<Box<Expression>>,
11357 #[serde(default)]
11358 pub default: Option<Box<Expression>>,
11359}
11360
11361#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11363#[cfg_attr(feature = "bindings", derive(TS))]
11364pub struct DataDeletionProperty {
11365 #[ast(skip)]
11367 pub on: Box<Expression>,
11368 #[serde(default)]
11369 pub filter_column: Option<Box<Expression>>,
11370 #[serde(default)]
11371 pub retention_period: Option<Box<Expression>>,
11372}
11373
11374#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11376#[cfg_attr(feature = "bindings", derive(TS))]
11377pub struct DefinerProperty {
11378 pub this: Box<Expression>,
11379}
11380
11381#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11383#[cfg_attr(feature = "bindings", derive(TS))]
11384pub struct DistKeyProperty {
11385 pub this: Box<Expression>,
11386}
11387
11388#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11390#[cfg_attr(feature = "bindings", derive(TS))]
11391pub struct DistributedByProperty {
11392 #[serde(default)]
11393 pub expressions: Vec<Expression>,
11394 pub kind: String,
11395 #[serde(default)]
11396 pub buckets: Option<Box<Expression>>,
11397 #[serde(default)]
11398 pub order: Option<Box<Expression>>,
11399}
11400
11401#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11403#[cfg_attr(feature = "bindings", derive(TS))]
11404pub struct DistStyleProperty {
11405 pub this: Box<Expression>,
11406}
11407
11408#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11410#[cfg_attr(feature = "bindings", derive(TS))]
11411pub struct DuplicateKeyProperty {
11412 #[serde(default)]
11413 pub expressions: Vec<Expression>,
11414}
11415
11416#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11418#[cfg_attr(feature = "bindings", derive(TS))]
11419pub struct EngineProperty {
11420 pub this: Box<Expression>,
11421}
11422
11423#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11425#[cfg_attr(feature = "bindings", derive(TS))]
11426pub struct ToTableProperty {
11427 pub this: Box<Expression>,
11428}
11429
11430#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11432#[cfg_attr(feature = "bindings", derive(TS))]
11433pub struct ExecuteAsProperty {
11434 pub this: Box<Expression>,
11435}
11436
11437#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11439#[cfg_attr(feature = "bindings", derive(TS))]
11440pub struct ExternalProperty {
11441 #[serde(default)]
11442 pub this: Option<Box<Expression>>,
11443}
11444
11445#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11447#[cfg_attr(feature = "bindings", derive(TS))]
11448pub struct FallbackProperty {
11449 #[serde(default)]
11450 pub no: Option<Box<Expression>>,
11451 #[serde(default)]
11452 pub protection: Option<Box<Expression>>,
11453}
11454
11455#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11457#[cfg_attr(feature = "bindings", derive(TS))]
11458pub struct FileFormatProperty {
11459 #[serde(default)]
11460 pub this: Option<Box<Expression>>,
11461 #[serde(default)]
11462 pub expressions: Vec<Expression>,
11463 #[serde(default)]
11464 pub hive_format: Option<Box<Expression>>,
11465}
11466
11467#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11469#[cfg_attr(feature = "bindings", derive(TS))]
11470pub struct CredentialsProperty {
11471 #[serde(default)]
11472 pub expressions: Vec<Expression>,
11473}
11474
11475#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11477#[cfg_attr(feature = "bindings", derive(TS))]
11478pub struct FreespaceProperty {
11479 pub this: Box<Expression>,
11480 #[serde(default)]
11481 pub percent: Option<Box<Expression>>,
11482}
11483
11484#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11486#[cfg_attr(feature = "bindings", derive(TS))]
11487pub struct InheritsProperty {
11488 #[serde(default)]
11489 pub expressions: Vec<Expression>,
11490}
11491
11492#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11494#[cfg_attr(feature = "bindings", derive(TS))]
11495pub struct InputModelProperty {
11496 pub this: Box<Expression>,
11497}
11498
11499#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11501#[cfg_attr(feature = "bindings", derive(TS))]
11502pub struct OutputModelProperty {
11503 pub this: Box<Expression>,
11504}
11505
11506#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11508#[cfg_attr(feature = "bindings", derive(TS))]
11509pub struct IsolatedLoadingProperty {
11510 #[serde(default)]
11511 pub no: Option<Box<Expression>>,
11512 #[serde(default)]
11513 pub concurrent: Option<Box<Expression>>,
11514 #[serde(default)]
11515 pub target: Option<Box<Expression>>,
11516}
11517
11518#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11520#[cfg_attr(feature = "bindings", derive(TS))]
11521pub struct JournalProperty {
11522 #[serde(default)]
11523 pub no: Option<Box<Expression>>,
11524 #[serde(default)]
11525 pub dual: Option<Box<Expression>>,
11526 #[serde(default)]
11527 pub before: Option<Box<Expression>>,
11528 #[serde(default)]
11529 pub local: Option<Box<Expression>>,
11530 #[serde(default)]
11531 pub after: Option<Box<Expression>>,
11532}
11533
11534#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11536#[cfg_attr(feature = "bindings", derive(TS))]
11537pub struct LanguageProperty {
11538 pub this: Box<Expression>,
11539}
11540
11541#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11543#[cfg_attr(feature = "bindings", derive(TS))]
11544pub struct EnviromentProperty {
11545 #[serde(default)]
11546 pub expressions: Vec<Expression>,
11547}
11548
11549#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11551#[cfg_attr(feature = "bindings", derive(TS))]
11552pub struct ClusteredByProperty {
11553 #[serde(default)]
11554 pub expressions: Vec<Expression>,
11555 #[serde(default)]
11556 pub sorted_by: Option<Box<Expression>>,
11557 #[serde(default)]
11558 pub buckets: Option<Box<Expression>>,
11559}
11560
11561#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11563#[cfg_attr(feature = "bindings", derive(TS))]
11564pub struct DictProperty {
11565 pub this: Box<Expression>,
11566 pub kind: String,
11567 #[serde(default)]
11568 pub settings: Option<Box<Expression>>,
11569}
11570
11571#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11573#[cfg_attr(feature = "bindings", derive(TS))]
11574pub struct DictRange {
11575 pub this: Box<Expression>,
11576 #[serde(default)]
11577 pub min: Option<Box<Expression>>,
11578 #[serde(default)]
11579 pub max: Option<Box<Expression>>,
11580}
11581
11582#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11584#[cfg_attr(feature = "bindings", derive(TS))]
11585pub struct OnCluster {
11586 pub this: Box<Expression>,
11587}
11588
11589#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11591#[cfg_attr(feature = "bindings", derive(TS))]
11592pub struct LikeProperty {
11593 pub this: Box<Expression>,
11594 #[serde(default)]
11595 pub expressions: Vec<Expression>,
11596}
11597
11598#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11600#[cfg_attr(feature = "bindings", derive(TS))]
11601pub struct LocationProperty {
11602 pub this: Box<Expression>,
11603}
11604
11605#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11607#[cfg_attr(feature = "bindings", derive(TS))]
11608pub struct LockProperty {
11609 pub this: Box<Expression>,
11610}
11611
11612#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11614#[cfg_attr(feature = "bindings", derive(TS))]
11615pub struct LockingProperty {
11616 #[serde(default)]
11617 pub this: Option<Box<Expression>>,
11618 pub kind: String,
11619 #[serde(default)]
11620 pub for_or_in: Option<Box<Expression>>,
11621 #[serde(default)]
11622 pub lock_type: Option<Box<Expression>>,
11623 #[serde(default)]
11624 pub override_: Option<Box<Expression>>,
11625}
11626
11627#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11629#[cfg_attr(feature = "bindings", derive(TS))]
11630pub struct LogProperty {
11631 #[serde(default)]
11632 pub no: Option<Box<Expression>>,
11633}
11634
11635#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11637#[cfg_attr(feature = "bindings", derive(TS))]
11638pub struct MaterializedProperty {
11639 #[serde(default)]
11640 pub this: Option<Box<Expression>>,
11641}
11642
11643#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11645#[cfg_attr(feature = "bindings", derive(TS))]
11646pub struct MergeBlockRatioProperty {
11647 #[serde(default)]
11648 pub this: Option<Box<Expression>>,
11649 #[serde(default)]
11650 pub no: Option<Box<Expression>>,
11651 #[serde(default)]
11652 pub default: Option<Box<Expression>>,
11653 #[serde(default)]
11654 pub percent: Option<Box<Expression>>,
11655}
11656
11657#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11659#[cfg_attr(feature = "bindings", derive(TS))]
11660pub struct OnProperty {
11661 pub this: Box<Expression>,
11662}
11663
11664#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11666#[cfg_attr(feature = "bindings", derive(TS))]
11667pub struct OnCommitProperty {
11668 #[serde(default)]
11669 pub delete: Option<Box<Expression>>,
11670}
11671
11672#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11674#[cfg_attr(feature = "bindings", derive(TS))]
11675pub struct PartitionedByProperty {
11676 pub this: Box<Expression>,
11677}
11678
11679#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11681#[cfg_attr(feature = "bindings", derive(TS))]
11682pub struct PartitionByProperty {
11683 #[serde(default)]
11684 pub expressions: Vec<Expression>,
11685}
11686
11687#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11689#[cfg_attr(feature = "bindings", derive(TS))]
11690pub struct PartitionedByBucket {
11691 pub this: Box<Expression>,
11692 pub expression: Box<Expression>,
11693}
11694
11695#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11697#[cfg_attr(feature = "bindings", derive(TS))]
11698pub struct ClusterByColumnsProperty {
11699 #[serde(default)]
11700 pub columns: Vec<Identifier>,
11701}
11702
11703#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11705#[cfg_attr(feature = "bindings", derive(TS))]
11706pub struct PartitionByTruncate {
11707 pub this: Box<Expression>,
11708 pub expression: Box<Expression>,
11709}
11710
11711#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11713#[cfg_attr(feature = "bindings", derive(TS))]
11714pub struct PartitionByRangeProperty {
11715 #[serde(default)]
11716 pub partition_expressions: Option<Box<Expression>>,
11717 #[serde(default)]
11718 pub create_expressions: Option<Box<Expression>>,
11719}
11720
11721#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11723#[cfg_attr(feature = "bindings", derive(TS))]
11724pub struct PartitionByRangePropertyDynamic {
11725 #[serde(default)]
11726 pub this: Option<Box<Expression>>,
11727 #[serde(default)]
11728 pub start: Option<Box<Expression>>,
11729 #[serde(default)]
11731 pub use_start_end: bool,
11732 #[serde(default)]
11733 pub end: Option<Box<Expression>>,
11734 #[serde(default)]
11735 pub every: Option<Box<Expression>>,
11736}
11737
11738#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11740#[cfg_attr(feature = "bindings", derive(TS))]
11741pub struct PartitionByListProperty {
11742 #[serde(default)]
11743 pub partition_expressions: Option<Box<Expression>>,
11744 #[serde(default)]
11745 pub create_expressions: Option<Box<Expression>>,
11746}
11747
11748#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11750#[cfg_attr(feature = "bindings", derive(TS))]
11751pub struct PartitionList {
11752 pub this: Box<Expression>,
11753 #[serde(default)]
11754 pub expressions: Vec<Expression>,
11755}
11756
11757#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11759#[cfg_attr(feature = "bindings", derive(TS))]
11760pub struct Partition {
11761 pub expressions: Vec<Expression>,
11762 #[serde(default)]
11763 pub subpartition: bool,
11764}
11765
11766#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11769#[cfg_attr(feature = "bindings", derive(TS))]
11770pub struct RefreshTriggerProperty {
11771 pub method: String,
11773 #[serde(default)]
11775 pub kind: Option<String>,
11776 #[serde(default)]
11778 pub every: Option<Box<Expression>>,
11779 #[serde(default)]
11781 pub unit: Option<String>,
11782 #[serde(default)]
11784 pub starts: Option<Box<Expression>>,
11785}
11786
11787#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11789#[cfg_attr(feature = "bindings", derive(TS))]
11790pub struct UniqueKeyProperty {
11791 #[serde(default)]
11792 pub expressions: Vec<Expression>,
11793}
11794
11795#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11797#[cfg_attr(feature = "bindings", derive(TS))]
11798pub struct RollupProperty {
11799 pub expressions: Vec<RollupIndex>,
11800}
11801
11802#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11804#[cfg_attr(feature = "bindings", derive(TS))]
11805pub struct RollupIndex {
11806 pub name: Identifier,
11807 pub expressions: Vec<Identifier>,
11808}
11809
11810#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11812#[cfg_attr(feature = "bindings", derive(TS))]
11813pub struct PartitionBoundSpec {
11814 #[serde(default)]
11815 pub this: Option<Box<Expression>>,
11816 #[serde(default)]
11817 pub expression: Option<Box<Expression>>,
11818 #[serde(default)]
11819 pub from_expressions: Option<Box<Expression>>,
11820 #[serde(default)]
11821 pub to_expressions: Option<Box<Expression>>,
11822}
11823
11824#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11826#[cfg_attr(feature = "bindings", derive(TS))]
11827pub struct PartitionedOfProperty {
11828 pub this: Box<Expression>,
11829 pub expression: Box<Expression>,
11830}
11831
11832#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11834#[cfg_attr(feature = "bindings", derive(TS))]
11835pub struct RemoteWithConnectionModelProperty {
11836 pub this: Box<Expression>,
11837}
11838
11839#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11841#[cfg_attr(feature = "bindings", derive(TS))]
11842pub struct ReturnsProperty {
11843 #[serde(default)]
11844 pub this: Option<Box<Expression>>,
11845 #[serde(default)]
11846 pub is_table: Option<Box<Expression>>,
11847 #[serde(default)]
11848 pub table: Option<Box<Expression>>,
11849 #[serde(default)]
11850 pub null: Option<Box<Expression>>,
11851}
11852
11853#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11855#[cfg_attr(feature = "bindings", derive(TS))]
11856pub struct RowFormatProperty {
11857 pub this: Box<Expression>,
11858}
11859
11860#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11862#[cfg_attr(feature = "bindings", derive(TS))]
11863pub struct RowFormatDelimitedProperty {
11864 #[serde(default)]
11865 pub fields: Option<Box<Expression>>,
11866 #[serde(default)]
11867 pub escaped: Option<Box<Expression>>,
11868 #[serde(default)]
11869 pub collection_items: Option<Box<Expression>>,
11870 #[serde(default)]
11871 pub map_keys: Option<Box<Expression>>,
11872 #[serde(default)]
11873 pub lines: Option<Box<Expression>>,
11874 #[serde(default)]
11875 pub null: Option<Box<Expression>>,
11876 #[serde(default)]
11877 pub serde: Option<Box<Expression>>,
11878}
11879
11880#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11882#[cfg_attr(feature = "bindings", derive(TS))]
11883pub struct RowFormatSerdeProperty {
11884 pub this: Box<Expression>,
11885 #[serde(default)]
11886 pub serde_properties: Option<Box<Expression>>,
11887}
11888
11889#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11891#[cfg_attr(feature = "bindings", derive(TS))]
11892pub struct QueryTransform {
11893 #[serde(default)]
11894 pub expressions: Vec<Expression>,
11895 #[serde(default)]
11896 pub command_script: Option<Box<Expression>>,
11897 #[serde(default)]
11898 pub schema: Option<Box<Expression>>,
11899 #[serde(default)]
11900 pub row_format_before: Option<Box<Expression>>,
11901 #[serde(default)]
11902 pub record_writer: Option<Box<Expression>>,
11903 #[serde(default)]
11904 pub row_format_after: Option<Box<Expression>>,
11905 #[serde(default)]
11906 pub record_reader: Option<Box<Expression>>,
11907}
11908
11909#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11911#[cfg_attr(feature = "bindings", derive(TS))]
11912pub struct SampleProperty {
11913 pub this: Box<Expression>,
11914}
11915
11916#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11918#[cfg_attr(feature = "bindings", derive(TS))]
11919pub struct SecurityProperty {
11920 pub this: Box<Expression>,
11921}
11922
11923#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11925#[cfg_attr(feature = "bindings", derive(TS))]
11926pub struct SchemaCommentProperty {
11927 pub this: Box<Expression>,
11928}
11929
11930#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11932#[cfg_attr(feature = "bindings", derive(TS))]
11933pub struct SemanticView {
11934 pub this: Box<Expression>,
11935 #[serde(default)]
11936 pub metrics: Option<Box<Expression>>,
11937 #[serde(default)]
11938 pub dimensions: Option<Box<Expression>>,
11939 #[serde(default)]
11940 pub facts: Option<Box<Expression>>,
11941 #[serde(default)]
11942 pub where_: Option<Box<Expression>>,
11943}
11944
11945#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11947#[cfg_attr(feature = "bindings", derive(TS))]
11948pub struct SerdeProperties {
11949 #[serde(default)]
11950 pub expressions: Vec<Expression>,
11951 #[serde(default)]
11952 pub with_: Option<Box<Expression>>,
11953}
11954
11955#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11957#[cfg_attr(feature = "bindings", derive(TS))]
11958pub struct SetProperty {
11959 #[serde(default)]
11960 pub multi: Option<Box<Expression>>,
11961}
11962
11963#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11965#[cfg_attr(feature = "bindings", derive(TS))]
11966pub struct SharingProperty {
11967 #[serde(default)]
11968 pub this: Option<Box<Expression>>,
11969}
11970
11971#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11973#[cfg_attr(feature = "bindings", derive(TS))]
11974pub struct SetConfigProperty {
11975 pub this: Box<Expression>,
11976}
11977
11978#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11980#[cfg_attr(feature = "bindings", derive(TS))]
11981pub struct SettingsProperty {
11982 #[serde(default)]
11983 pub expressions: Vec<Expression>,
11984}
11985
11986#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11988#[cfg_attr(feature = "bindings", derive(TS))]
11989pub struct SortKeyProperty {
11990 pub this: Box<Expression>,
11991 #[serde(default)]
11992 pub compound: Option<Box<Expression>>,
11993}
11994
11995#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11997#[cfg_attr(feature = "bindings", derive(TS))]
11998pub struct SqlReadWriteProperty {
11999 pub this: Box<Expression>,
12000}
12001
12002#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12004#[cfg_attr(feature = "bindings", derive(TS))]
12005pub struct SqlSecurityProperty {
12006 pub this: Box<Expression>,
12007}
12008
12009#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12011#[cfg_attr(feature = "bindings", derive(TS))]
12012pub struct StabilityProperty {
12013 pub this: Box<Expression>,
12014}
12015
12016#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12018#[cfg_attr(feature = "bindings", derive(TS))]
12019pub struct StorageHandlerProperty {
12020 pub this: Box<Expression>,
12021}
12022
12023#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12025#[cfg_attr(feature = "bindings", derive(TS))]
12026pub struct TemporaryProperty {
12027 #[serde(default)]
12028 pub this: Option<Box<Expression>>,
12029}
12030
12031#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12033#[cfg_attr(feature = "bindings", derive(TS))]
12034pub struct Tags {
12035 #[serde(default)]
12036 pub expressions: Vec<Expression>,
12037}
12038
12039#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12041#[cfg_attr(feature = "bindings", derive(TS))]
12042pub struct TransformModelProperty {
12043 #[serde(default)]
12044 pub expressions: Vec<Expression>,
12045}
12046
12047#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12049#[cfg_attr(feature = "bindings", derive(TS))]
12050pub struct TransientProperty {
12051 #[serde(default)]
12052 pub this: Option<Box<Expression>>,
12053}
12054
12055#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12057#[cfg_attr(feature = "bindings", derive(TS))]
12058pub struct UsingTemplateProperty {
12059 pub this: Box<Expression>,
12060}
12061
12062#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12064#[cfg_attr(feature = "bindings", derive(TS))]
12065pub struct ViewAttributeProperty {
12066 pub this: Box<Expression>,
12067}
12068
12069#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12071#[cfg_attr(feature = "bindings", derive(TS))]
12072pub struct VolatileProperty {
12073 #[serde(default)]
12074 pub this: Option<Box<Expression>>,
12075}
12076
12077#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12079#[cfg_attr(feature = "bindings", derive(TS))]
12080pub struct WithDataProperty {
12081 #[serde(default)]
12082 pub no: Option<Box<Expression>>,
12083 #[serde(default)]
12084 pub statistics: Option<Box<Expression>>,
12085}
12086
12087#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12089#[cfg_attr(feature = "bindings", derive(TS))]
12090pub struct WithJournalTableProperty {
12091 pub this: Box<Expression>,
12092}
12093
12094#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12096#[cfg_attr(feature = "bindings", derive(TS))]
12097pub struct WithSchemaBindingProperty {
12098 pub this: Box<Expression>,
12099}
12100
12101#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12103#[cfg_attr(feature = "bindings", derive(TS))]
12104pub struct WithSystemVersioningProperty {
12105 #[serde(default)]
12106 pub on: Option<Box<Expression>>,
12107 #[serde(default)]
12108 pub this: Option<Box<Expression>>,
12109 #[serde(default)]
12110 pub data_consistency: Option<Box<Expression>>,
12111 #[serde(default)]
12112 pub retention_period: Option<Box<Expression>>,
12113 #[serde(default)]
12114 pub with_: Option<Box<Expression>>,
12115}
12116
12117#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12119#[cfg_attr(feature = "bindings", derive(TS))]
12120pub struct WithProcedureOptions {
12121 #[serde(default)]
12122 pub expressions: Vec<Expression>,
12123}
12124
12125#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12127#[cfg_attr(feature = "bindings", derive(TS))]
12128pub struct EncodeProperty {
12129 pub this: Box<Expression>,
12130 #[serde(default)]
12131 pub properties: Vec<Expression>,
12132 #[serde(default)]
12133 pub key: Option<Box<Expression>>,
12134}
12135
12136#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12138#[cfg_attr(feature = "bindings", derive(TS))]
12139pub struct IncludeProperty {
12140 pub this: Box<Expression>,
12141 #[serde(default)]
12142 pub alias: Option<String>,
12143 #[serde(default)]
12144 pub column_def: Option<Box<Expression>>,
12145}
12146
12147#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12149#[cfg_attr(feature = "bindings", derive(TS))]
12150pub struct Properties {
12151 #[serde(default)]
12152 pub expressions: Vec<Expression>,
12153}
12154
12155#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12157#[cfg_attr(feature = "bindings", derive(TS))]
12158pub struct OptionEntry {
12159 pub key: Identifier,
12160 pub value: Expression,
12161}
12162
12163#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12165#[cfg_attr(feature = "bindings", derive(TS))]
12166pub struct OptionsProperty {
12167 #[serde(default)]
12168 pub entries: Vec<OptionEntry>,
12169}
12170
12171#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12173#[cfg_attr(feature = "bindings", derive(TS))]
12174pub struct InputOutputFormat {
12175 #[serde(default)]
12176 pub input_format: Option<Box<Expression>>,
12177 #[serde(default)]
12178 pub output_format: Option<Box<Expression>>,
12179}
12180
12181#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct Reference {
12185 pub this: Box<Expression>,
12186 #[serde(default)]
12187 pub expressions: Vec<Expression>,
12188 #[serde(default)]
12189 pub options: Vec<Expression>,
12190}
12191
12192#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12194#[cfg_attr(feature = "bindings", derive(TS))]
12195pub struct QueryOption {
12196 pub this: Box<Expression>,
12197 #[serde(default)]
12198 pub expression: Option<Box<Expression>>,
12199}
12200
12201#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12203#[cfg_attr(feature = "bindings", derive(TS))]
12204pub struct WithTableHint {
12205 #[serde(default)]
12206 pub expressions: Vec<Expression>,
12207}
12208
12209#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12211#[cfg_attr(feature = "bindings", derive(TS))]
12212pub struct IndexTableHint {
12213 pub this: Box<Expression>,
12214 #[serde(default)]
12215 pub expressions: Vec<Expression>,
12216 #[serde(default)]
12217 pub target: Option<Box<Expression>>,
12218}
12219
12220#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12222#[cfg_attr(feature = "bindings", derive(TS))]
12223pub struct Get {
12224 pub this: Box<Expression>,
12225 #[serde(default)]
12226 pub target: Option<Box<Expression>>,
12227 #[serde(default)]
12228 pub properties: Vec<Expression>,
12229}
12230
12231#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12233#[cfg_attr(feature = "bindings", derive(TS))]
12234pub struct SetOperation {
12235 #[serde(default)]
12236 pub with_: Option<Box<Expression>>,
12237 pub this: Box<Expression>,
12238 pub expression: Box<Expression>,
12239 #[serde(default)]
12240 pub distinct: bool,
12241 #[serde(default)]
12242 pub by_name: Option<Box<Expression>>,
12243 #[serde(default)]
12244 pub side: Option<Box<Expression>>,
12245 #[serde(default)]
12246 pub kind: Option<String>,
12247 #[serde(default)]
12248 pub on: Option<Box<Expression>>,
12249}
12250
12251#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12253#[cfg_attr(feature = "bindings", derive(TS))]
12254pub struct Var {
12255 pub this: String,
12256}
12257
12258#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12260#[cfg_attr(feature = "bindings", derive(TS))]
12261pub struct Variadic {
12262 pub this: Box<Expression>,
12263}
12264
12265#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12267#[cfg_attr(feature = "bindings", derive(TS))]
12268pub struct Version {
12269 pub this: Box<Expression>,
12270 pub kind: String,
12271 #[serde(default)]
12272 pub expression: Option<Box<Expression>>,
12273}
12274
12275#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12277#[cfg_attr(feature = "bindings", derive(TS))]
12278pub struct Schema {
12279 #[serde(default)]
12280 pub this: Option<Box<Expression>>,
12281 #[serde(default)]
12282 pub expressions: Vec<Expression>,
12283}
12284
12285#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12287#[cfg_attr(feature = "bindings", derive(TS))]
12288pub struct Lock {
12289 #[serde(default)]
12290 pub update: Option<Box<Expression>>,
12291 #[serde(default)]
12292 pub expressions: Vec<Expression>,
12293 #[serde(default)]
12294 pub wait: Option<Box<Expression>>,
12295 #[serde(default)]
12296 pub key: Option<Box<Expression>>,
12297}
12298
12299#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12302#[cfg_attr(feature = "bindings", derive(TS))]
12303pub struct TableSample {
12304 #[serde(default, skip_serializing_if = "Option::is_none")]
12306 pub this: Option<Box<Expression>>,
12307 #[serde(default, skip_serializing_if = "Option::is_none")]
12309 pub sample: Option<Box<Sample>>,
12310 #[serde(default)]
12311 pub expressions: Vec<Expression>,
12312 #[serde(default)]
12313 pub method: Option<String>,
12314 #[serde(default)]
12315 pub bucket_numerator: Option<Box<Expression>>,
12316 #[serde(default)]
12317 pub bucket_denominator: Option<Box<Expression>>,
12318 #[serde(default)]
12319 pub bucket_field: Option<Box<Expression>>,
12320 #[serde(default)]
12321 pub percent: Option<Box<Expression>>,
12322 #[serde(default)]
12323 pub rows: Option<Box<Expression>>,
12324 #[serde(default)]
12325 pub size: Option<i64>,
12326 #[serde(default)]
12327 pub seed: Option<Box<Expression>>,
12328}
12329
12330#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12332#[cfg_attr(feature = "bindings", derive(TS))]
12333pub struct Tag {
12334 #[serde(default)]
12335 pub this: Option<Box<Expression>>,
12336 #[serde(default)]
12337 pub prefix: Option<Box<Expression>>,
12338 #[serde(default)]
12339 pub postfix: Option<Box<Expression>>,
12340}
12341
12342#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12344#[cfg_attr(feature = "bindings", derive(TS))]
12345pub struct UnpivotColumns {
12346 pub this: Box<Expression>,
12347 #[serde(default)]
12348 pub expressions: Vec<Expression>,
12349}
12350
12351#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12353#[cfg_attr(feature = "bindings", derive(TS))]
12354pub struct SessionParameter {
12355 pub this: Box<Expression>,
12356 #[serde(default)]
12357 pub kind: Option<String>,
12358}
12359
12360#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12362#[cfg_attr(feature = "bindings", derive(TS))]
12363pub struct PseudoType {
12364 pub this: Box<Expression>,
12365}
12366
12367#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12369#[cfg_attr(feature = "bindings", derive(TS))]
12370pub struct ObjectIdentifier {
12371 pub this: Box<Expression>,
12372}
12373
12374#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12376#[cfg_attr(feature = "bindings", derive(TS))]
12377pub struct Transaction {
12378 #[serde(default)]
12379 pub this: Option<Box<Expression>>,
12380 #[serde(default)]
12381 pub modes: Option<Box<Expression>>,
12382 #[serde(default)]
12383 pub mark: Option<Box<Expression>>,
12384}
12385
12386#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12388#[cfg_attr(feature = "bindings", derive(TS))]
12389pub struct Commit {
12390 #[serde(default)]
12391 pub chain: Option<Box<Expression>>,
12392 #[serde(default)]
12393 pub this: Option<Box<Expression>>,
12394 #[serde(default)]
12395 pub durability: Option<Box<Expression>>,
12396}
12397
12398#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12400#[cfg_attr(feature = "bindings", derive(TS))]
12401pub struct Rollback {
12402 #[serde(default)]
12403 pub savepoint: Option<Box<Expression>>,
12404 #[serde(default)]
12405 pub this: Option<Box<Expression>>,
12406}
12407
12408#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12410#[cfg_attr(feature = "bindings", derive(TS))]
12411pub struct AlterSession {
12412 #[serde(default)]
12413 pub expressions: Vec<Expression>,
12414 #[serde(default)]
12415 pub unset: Option<Box<Expression>>,
12416}
12417
12418#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12420#[cfg_attr(feature = "bindings", derive(TS))]
12421pub struct Analyze {
12422 #[serde(default)]
12423 pub kind: Option<String>,
12424 #[serde(default)]
12425 pub this: Option<Box<Expression>>,
12426 #[serde(default)]
12427 pub options: Vec<Expression>,
12428 #[serde(default)]
12429 pub mode: Option<Box<Expression>>,
12430 #[serde(default)]
12431 pub partition: Option<Box<Expression>>,
12432 #[serde(default)]
12433 pub expression: Option<Box<Expression>>,
12434 #[serde(default)]
12435 pub properties: Vec<Expression>,
12436 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12438 pub columns: Vec<String>,
12439}
12440
12441#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12443#[cfg_attr(feature = "bindings", derive(TS))]
12444pub struct AnalyzeStatistics {
12445 pub kind: String,
12446 #[serde(default)]
12447 pub option: Option<Box<Expression>>,
12448 #[serde(default)]
12449 pub this: Option<Box<Expression>>,
12450 #[serde(default)]
12451 pub expressions: Vec<Expression>,
12452}
12453
12454#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12456#[cfg_attr(feature = "bindings", derive(TS))]
12457pub struct AnalyzeHistogram {
12458 pub this: Box<Expression>,
12459 #[serde(default)]
12460 pub expressions: Vec<Expression>,
12461 #[serde(default)]
12462 pub expression: Option<Box<Expression>>,
12463 #[serde(default)]
12464 pub update_options: Option<Box<Expression>>,
12465}
12466
12467#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12469#[cfg_attr(feature = "bindings", derive(TS))]
12470pub struct AnalyzeSample {
12471 pub kind: String,
12472 #[serde(default)]
12473 pub sample: Option<Box<Expression>>,
12474}
12475
12476#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12478#[cfg_attr(feature = "bindings", derive(TS))]
12479pub struct AnalyzeListChainedRows {
12480 #[serde(default)]
12481 pub expression: Option<Box<Expression>>,
12482}
12483
12484#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12486#[cfg_attr(feature = "bindings", derive(TS))]
12487pub struct AnalyzeDelete {
12488 #[serde(default)]
12489 pub kind: Option<String>,
12490}
12491
12492#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12494#[cfg_attr(feature = "bindings", derive(TS))]
12495pub struct AnalyzeWith {
12496 #[serde(default)]
12497 pub expressions: Vec<Expression>,
12498}
12499
12500#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12502#[cfg_attr(feature = "bindings", derive(TS))]
12503pub struct AnalyzeValidate {
12504 pub kind: String,
12505 #[serde(default)]
12506 pub this: Option<Box<Expression>>,
12507 #[serde(default)]
12508 pub expression: Option<Box<Expression>>,
12509}
12510
12511#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12513#[cfg_attr(feature = "bindings", derive(TS))]
12514pub struct AddPartition {
12515 pub this: Box<Expression>,
12516 #[serde(default)]
12517 pub exists: bool,
12518 #[serde(default)]
12519 pub location: Option<Box<Expression>>,
12520}
12521
12522#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12524#[cfg_attr(feature = "bindings", derive(TS))]
12525pub struct AttachOption {
12526 pub this: Box<Expression>,
12527 #[serde(default)]
12528 pub expression: Option<Box<Expression>>,
12529}
12530
12531#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12533#[cfg_attr(feature = "bindings", derive(TS))]
12534pub struct DropPartition {
12535 #[serde(default)]
12536 pub expressions: Vec<Expression>,
12537 #[serde(default)]
12538 pub exists: bool,
12539}
12540
12541#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12543#[cfg_attr(feature = "bindings", derive(TS))]
12544pub struct ReplacePartition {
12545 pub expression: Box<Expression>,
12546 #[serde(default)]
12547 pub source: Option<Box<Expression>>,
12548}
12549
12550#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12552#[cfg_attr(feature = "bindings", derive(TS))]
12553pub struct DPipe {
12554 pub this: Box<Expression>,
12555 pub expression: Box<Expression>,
12556 #[serde(default)]
12557 pub safe: Option<Box<Expression>>,
12558}
12559
12560#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12562#[cfg_attr(feature = "bindings", derive(TS))]
12563pub struct Operator {
12564 pub this: Box<Expression>,
12565 #[serde(default)]
12566 pub operator: Option<Box<Expression>>,
12567 pub expression: Box<Expression>,
12568 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12570 pub comments: Vec<String>,
12571}
12572
12573#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12575#[cfg_attr(feature = "bindings", derive(TS))]
12576pub struct PivotAny {
12577 #[serde(default)]
12578 pub this: Option<Box<Expression>>,
12579}
12580
12581#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12583#[cfg_attr(feature = "bindings", derive(TS))]
12584pub struct Aliases {
12585 pub this: Box<Expression>,
12586 #[serde(default)]
12587 pub expressions: Vec<Expression>,
12588}
12589
12590#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12592#[cfg_attr(feature = "bindings", derive(TS))]
12593pub struct AtIndex {
12594 pub this: Box<Expression>,
12595 pub expression: Box<Expression>,
12596}
12597
12598#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12600#[cfg_attr(feature = "bindings", derive(TS))]
12601pub struct FromTimeZone {
12602 pub this: Box<Expression>,
12603 #[serde(default)]
12604 pub zone: Option<Box<Expression>>,
12605}
12606
12607#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12609#[cfg_attr(feature = "bindings", derive(TS))]
12610pub struct FormatPhrase {
12611 pub this: Box<Expression>,
12612 pub format: String,
12613}
12614
12615#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12617#[cfg_attr(feature = "bindings", derive(TS))]
12618pub struct ForIn {
12619 pub this: Box<Expression>,
12620 pub expression: Box<Expression>,
12621}
12622
12623#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12625#[cfg_attr(feature = "bindings", derive(TS))]
12626pub struct TimeUnit {
12627 #[serde(default)]
12628 pub unit: Option<String>,
12629}
12630
12631#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12633#[cfg_attr(feature = "bindings", derive(TS))]
12634pub struct IntervalOp {
12635 #[serde(default)]
12636 pub unit: Option<String>,
12637 pub expression: Box<Expression>,
12638}
12639
12640#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12642#[cfg_attr(feature = "bindings", derive(TS))]
12643pub struct HavingMax {
12644 pub this: Box<Expression>,
12645 pub expression: Box<Expression>,
12646 #[serde(default)]
12647 pub max: Option<Box<Expression>>,
12648}
12649
12650#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12652#[cfg_attr(feature = "bindings", derive(TS))]
12653pub struct CosineDistance {
12654 pub this: Box<Expression>,
12655 pub expression: Box<Expression>,
12656}
12657
12658#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12660#[cfg_attr(feature = "bindings", derive(TS))]
12661pub struct DotProduct {
12662 pub this: Box<Expression>,
12663 pub expression: Box<Expression>,
12664}
12665
12666#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12668#[cfg_attr(feature = "bindings", derive(TS))]
12669pub struct EuclideanDistance {
12670 pub this: Box<Expression>,
12671 pub expression: Box<Expression>,
12672}
12673
12674#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12676#[cfg_attr(feature = "bindings", derive(TS))]
12677pub struct ManhattanDistance {
12678 pub this: Box<Expression>,
12679 pub expression: Box<Expression>,
12680}
12681
12682#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12684#[cfg_attr(feature = "bindings", derive(TS))]
12685pub struct JarowinklerSimilarity {
12686 pub this: Box<Expression>,
12687 pub expression: Box<Expression>,
12688}
12689
12690#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12692#[cfg_attr(feature = "bindings", derive(TS))]
12693pub struct Booland {
12694 pub this: Box<Expression>,
12695 pub expression: Box<Expression>,
12696}
12697
12698#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12700#[cfg_attr(feature = "bindings", derive(TS))]
12701pub struct Boolor {
12702 pub this: Box<Expression>,
12703 pub expression: Box<Expression>,
12704}
12705
12706#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12708#[cfg_attr(feature = "bindings", derive(TS))]
12709pub struct ParameterizedAgg {
12710 pub this: Box<Expression>,
12711 #[serde(default)]
12712 pub expressions: Vec<Expression>,
12713 #[serde(default)]
12714 pub params: Vec<Expression>,
12715}
12716
12717#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12719#[cfg_attr(feature = "bindings", derive(TS))]
12720pub struct ArgMax {
12721 pub this: Box<Expression>,
12722 pub expression: Box<Expression>,
12723 #[serde(default)]
12724 pub count: Option<Box<Expression>>,
12725}
12726
12727#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12729#[cfg_attr(feature = "bindings", derive(TS))]
12730pub struct ArgMin {
12731 pub this: Box<Expression>,
12732 pub expression: Box<Expression>,
12733 #[serde(default)]
12734 pub count: Option<Box<Expression>>,
12735}
12736
12737#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12739#[cfg_attr(feature = "bindings", derive(TS))]
12740pub struct ApproxTopK {
12741 pub this: Box<Expression>,
12742 #[serde(default)]
12743 pub expression: Option<Box<Expression>>,
12744 #[serde(default)]
12745 pub counters: Option<Box<Expression>>,
12746}
12747
12748#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12750#[cfg_attr(feature = "bindings", derive(TS))]
12751pub struct ApproxTopKAccumulate {
12752 pub this: Box<Expression>,
12753 #[serde(default)]
12754 pub expression: Option<Box<Expression>>,
12755}
12756
12757#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12759#[cfg_attr(feature = "bindings", derive(TS))]
12760pub struct ApproxTopKCombine {
12761 pub this: Box<Expression>,
12762 #[serde(default)]
12763 pub expression: Option<Box<Expression>>,
12764}
12765
12766#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12768#[cfg_attr(feature = "bindings", derive(TS))]
12769pub struct ApproxTopKEstimate {
12770 pub this: Box<Expression>,
12771 #[serde(default)]
12772 pub expression: Option<Box<Expression>>,
12773}
12774
12775#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12777#[cfg_attr(feature = "bindings", derive(TS))]
12778pub struct ApproxTopSum {
12779 pub this: Box<Expression>,
12780 pub expression: Box<Expression>,
12781 #[serde(default)]
12782 pub count: Option<Box<Expression>>,
12783}
12784
12785#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12787#[cfg_attr(feature = "bindings", derive(TS))]
12788pub struct ApproxQuantiles {
12789 pub this: Box<Expression>,
12790 #[serde(default)]
12791 pub expression: Option<Box<Expression>>,
12792}
12793
12794#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12796#[cfg_attr(feature = "bindings", derive(TS))]
12797pub struct Minhash {
12798 pub this: Box<Expression>,
12799 #[serde(default)]
12800 pub expressions: Vec<Expression>,
12801}
12802
12803#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12805#[cfg_attr(feature = "bindings", derive(TS))]
12806pub struct FarmFingerprint {
12807 #[serde(default)]
12808 pub expressions: Vec<Expression>,
12809}
12810
12811#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12813#[cfg_attr(feature = "bindings", derive(TS))]
12814pub struct Float64 {
12815 pub this: Box<Expression>,
12816 #[serde(default)]
12817 pub expression: Option<Box<Expression>>,
12818}
12819
12820#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12822#[cfg_attr(feature = "bindings", derive(TS))]
12823pub struct Transform {
12824 pub this: Box<Expression>,
12825 pub expression: Box<Expression>,
12826}
12827
12828#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12830#[cfg_attr(feature = "bindings", derive(TS))]
12831pub struct Translate {
12832 pub this: Box<Expression>,
12833 #[serde(default)]
12834 pub from_: Option<Box<Expression>>,
12835 #[serde(default)]
12836 pub to: Option<Box<Expression>>,
12837}
12838
12839#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12841#[cfg_attr(feature = "bindings", derive(TS))]
12842pub struct Grouping {
12843 #[serde(default)]
12844 pub expressions: Vec<Expression>,
12845}
12846
12847#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12849#[cfg_attr(feature = "bindings", derive(TS))]
12850pub struct GroupingId {
12851 #[serde(default)]
12852 pub expressions: Vec<Expression>,
12853}
12854
12855#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12857#[cfg_attr(feature = "bindings", derive(TS))]
12858pub struct Anonymous {
12859 pub this: Box<Expression>,
12860 #[serde(default)]
12861 pub expressions: Vec<Expression>,
12862}
12863
12864#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12866#[cfg_attr(feature = "bindings", derive(TS))]
12867pub struct AnonymousAggFunc {
12868 pub this: Box<Expression>,
12869 #[serde(default)]
12870 pub expressions: Vec<Expression>,
12871}
12872
12873#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12875#[cfg_attr(feature = "bindings", derive(TS))]
12876pub struct CombinedAggFunc {
12877 pub this: Box<Expression>,
12878 #[serde(default)]
12879 pub expressions: Vec<Expression>,
12880}
12881
12882#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12884#[cfg_attr(feature = "bindings", derive(TS))]
12885pub struct CombinedParameterizedAgg {
12886 pub this: Box<Expression>,
12887 #[serde(default)]
12888 pub expressions: Vec<Expression>,
12889 #[serde(default)]
12890 pub params: Vec<Expression>,
12891}
12892
12893#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12895#[cfg_attr(feature = "bindings", derive(TS))]
12896pub struct HashAgg {
12897 pub this: Box<Expression>,
12898 #[serde(default)]
12899 pub expressions: Vec<Expression>,
12900}
12901
12902#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12904#[cfg_attr(feature = "bindings", derive(TS))]
12905pub struct Hll {
12906 pub this: Box<Expression>,
12907 #[serde(default)]
12908 pub expressions: Vec<Expression>,
12909}
12910
12911#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12913#[cfg_attr(feature = "bindings", derive(TS))]
12914pub struct Apply {
12915 pub this: Box<Expression>,
12916 pub expression: Box<Expression>,
12917}
12918
12919#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12921#[cfg_attr(feature = "bindings", derive(TS))]
12922pub struct ToBoolean {
12923 pub this: Box<Expression>,
12924 #[serde(default)]
12925 pub safe: Option<Box<Expression>>,
12926}
12927
12928#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12930#[cfg_attr(feature = "bindings", derive(TS))]
12931pub struct List {
12932 #[serde(default)]
12933 pub expressions: Vec<Expression>,
12934}
12935
12936#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12941#[cfg_attr(feature = "bindings", derive(TS))]
12942pub struct ToMap {
12943 pub this: Box<Expression>,
12945}
12946
12947#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12949#[cfg_attr(feature = "bindings", derive(TS))]
12950pub struct Pad {
12951 pub this: Box<Expression>,
12952 pub expression: Box<Expression>,
12953 #[serde(default)]
12954 pub fill_pattern: Option<Box<Expression>>,
12955 #[serde(default)]
12956 pub is_left: Option<Box<Expression>>,
12957}
12958
12959#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12961#[cfg_attr(feature = "bindings", derive(TS))]
12962pub struct ToChar {
12963 pub this: Box<Expression>,
12964 #[serde(default)]
12965 pub format: Option<String>,
12966 #[serde(default)]
12967 pub nlsparam: Option<Box<Expression>>,
12968 #[serde(default)]
12969 pub is_numeric: Option<Box<Expression>>,
12970}
12971
12972#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12974#[cfg_attr(feature = "bindings", derive(TS))]
12975pub struct StringFunc {
12976 pub this: Box<Expression>,
12977 #[serde(default)]
12978 pub zone: Option<Box<Expression>>,
12979}
12980
12981#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12983#[cfg_attr(feature = "bindings", derive(TS))]
12984pub struct ToNumber {
12985 pub this: Box<Expression>,
12986 #[serde(default)]
12987 pub format: Option<Box<Expression>>,
12988 #[serde(default)]
12989 pub nlsparam: Option<Box<Expression>>,
12990 #[serde(default)]
12991 pub precision: Option<Box<Expression>>,
12992 #[serde(default)]
12993 pub scale: Option<Box<Expression>>,
12994 #[serde(default)]
12995 pub safe: Option<Box<Expression>>,
12996 #[serde(default)]
12997 pub safe_name: Option<Box<Expression>>,
12998}
12999
13000#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13002#[cfg_attr(feature = "bindings", derive(TS))]
13003pub struct ToDouble {
13004 pub this: Box<Expression>,
13005 #[serde(default)]
13006 pub format: Option<String>,
13007 #[serde(default)]
13008 pub safe: Option<Box<Expression>>,
13009}
13010
13011#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13013#[cfg_attr(feature = "bindings", derive(TS))]
13014pub struct ToDecfloat {
13015 pub this: Box<Expression>,
13016 #[serde(default)]
13017 pub format: Option<String>,
13018}
13019
13020#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13022#[cfg_attr(feature = "bindings", derive(TS))]
13023pub struct TryToDecfloat {
13024 pub this: Box<Expression>,
13025 #[serde(default)]
13026 pub format: Option<String>,
13027}
13028
13029#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13031#[cfg_attr(feature = "bindings", derive(TS))]
13032pub struct ToFile {
13033 pub this: Box<Expression>,
13034 #[serde(default)]
13035 pub path: Option<Box<Expression>>,
13036 #[serde(default)]
13037 pub safe: Option<Box<Expression>>,
13038}
13039
13040#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13042#[cfg_attr(feature = "bindings", derive(TS))]
13043pub struct Columns {
13044 pub this: Box<Expression>,
13045 #[serde(default)]
13046 pub unpack: Option<Box<Expression>>,
13047}
13048
13049#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13051#[cfg_attr(feature = "bindings", derive(TS))]
13052pub struct ConvertToCharset {
13053 pub this: Box<Expression>,
13054 #[serde(default)]
13055 pub dest: Option<Box<Expression>>,
13056 #[serde(default)]
13057 pub source: Option<Box<Expression>>,
13058}
13059
13060#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13062#[cfg_attr(feature = "bindings", derive(TS))]
13063pub struct ConvertTimezone {
13064 #[serde(default)]
13065 pub source_tz: Option<Box<Expression>>,
13066 #[serde(default)]
13067 pub target_tz: Option<Box<Expression>>,
13068 #[serde(default)]
13069 pub timestamp: Option<Box<Expression>>,
13070 #[serde(default)]
13071 pub options: Vec<Expression>,
13072}
13073
13074#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13076#[cfg_attr(feature = "bindings", derive(TS))]
13077pub struct GenerateSeries {
13078 #[serde(default)]
13079 pub start: Option<Box<Expression>>,
13080 #[serde(default)]
13081 pub end: Option<Box<Expression>>,
13082 #[serde(default)]
13083 pub step: Option<Box<Expression>>,
13084 #[serde(default)]
13085 pub is_end_exclusive: Option<Box<Expression>>,
13086}
13087
13088#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13090#[cfg_attr(feature = "bindings", derive(TS))]
13091pub struct AIAgg {
13092 pub this: Box<Expression>,
13093 pub expression: Box<Expression>,
13094}
13095
13096#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13098#[cfg_attr(feature = "bindings", derive(TS))]
13099pub struct AIClassify {
13100 pub this: Box<Expression>,
13101 #[serde(default)]
13102 pub categories: Option<Box<Expression>>,
13103 #[serde(default)]
13104 pub config: Option<Box<Expression>>,
13105}
13106
13107#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13109#[cfg_attr(feature = "bindings", derive(TS))]
13110pub struct ArrayAll {
13111 pub this: Box<Expression>,
13112 pub expression: Box<Expression>,
13113}
13114
13115#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13117#[cfg_attr(feature = "bindings", derive(TS))]
13118pub struct ArrayAny {
13119 pub this: Box<Expression>,
13120 pub expression: Box<Expression>,
13121}
13122
13123#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13125#[cfg_attr(feature = "bindings", derive(TS))]
13126pub struct ArrayConstructCompact {
13127 #[serde(default)]
13128 pub expressions: Vec<Expression>,
13129}
13130
13131#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13133#[cfg_attr(feature = "bindings", derive(TS))]
13134pub struct StPoint {
13135 pub this: Box<Expression>,
13136 pub expression: Box<Expression>,
13137 #[serde(default)]
13138 pub null: Option<Box<Expression>>,
13139}
13140
13141#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13143#[cfg_attr(feature = "bindings", derive(TS))]
13144pub struct StDistance {
13145 pub this: Box<Expression>,
13146 pub expression: Box<Expression>,
13147 #[serde(default)]
13148 pub use_spheroid: Option<Box<Expression>>,
13149}
13150
13151#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13153#[cfg_attr(feature = "bindings", derive(TS))]
13154pub struct StringToArray {
13155 pub this: Box<Expression>,
13156 #[serde(default)]
13157 pub expression: Option<Box<Expression>>,
13158 #[serde(default)]
13159 pub null: Option<Box<Expression>>,
13160}
13161
13162#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13164#[cfg_attr(feature = "bindings", derive(TS))]
13165pub struct ArraySum {
13166 pub this: Box<Expression>,
13167 #[serde(default)]
13168 pub expression: Option<Box<Expression>>,
13169}
13170
13171#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13173#[cfg_attr(feature = "bindings", derive(TS))]
13174pub struct ObjectAgg {
13175 pub this: Box<Expression>,
13176 pub expression: Box<Expression>,
13177}
13178
13179#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13181#[cfg_attr(feature = "bindings", derive(TS))]
13182pub struct CastToStrType {
13183 pub this: Box<Expression>,
13184 #[serde(default)]
13185 pub to: Option<Box<Expression>>,
13186}
13187
13188#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13190#[cfg_attr(feature = "bindings", derive(TS))]
13191pub struct CheckJson {
13192 pub this: Box<Expression>,
13193}
13194
13195#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13197#[cfg_attr(feature = "bindings", derive(TS))]
13198pub struct CheckXml {
13199 pub this: Box<Expression>,
13200 #[serde(default)]
13201 pub disable_auto_convert: Option<Box<Expression>>,
13202}
13203
13204#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13206#[cfg_attr(feature = "bindings", derive(TS))]
13207pub struct TranslateCharacters {
13208 pub this: Box<Expression>,
13209 pub expression: Box<Expression>,
13210 #[serde(default)]
13211 pub with_error: Option<Box<Expression>>,
13212}
13213
13214#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13216#[cfg_attr(feature = "bindings", derive(TS))]
13217pub struct CurrentSchemas {
13218 #[serde(default)]
13219 pub this: Option<Box<Expression>>,
13220}
13221
13222#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13224#[cfg_attr(feature = "bindings", derive(TS))]
13225pub struct CurrentDatetime {
13226 #[serde(default)]
13227 pub this: Option<Box<Expression>>,
13228}
13229
13230#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13232#[cfg_attr(feature = "bindings", derive(TS))]
13233pub struct Localtime {
13234 #[serde(default)]
13235 pub this: Option<Box<Expression>>,
13236}
13237
13238#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13240#[cfg_attr(feature = "bindings", derive(TS))]
13241pub struct Localtimestamp {
13242 #[serde(default)]
13243 pub this: Option<Box<Expression>>,
13244}
13245
13246#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13248#[cfg_attr(feature = "bindings", derive(TS))]
13249pub struct Systimestamp {
13250 #[serde(default)]
13251 pub this: Option<Box<Expression>>,
13252}
13253
13254#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13256#[cfg_attr(feature = "bindings", derive(TS))]
13257pub struct CurrentSchema {
13258 #[serde(default)]
13259 pub this: Option<Box<Expression>>,
13260}
13261
13262#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13264#[cfg_attr(feature = "bindings", derive(TS))]
13265pub struct CurrentUser {
13266 #[serde(default)]
13267 pub this: Option<Box<Expression>>,
13268}
13269
13270#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13272#[cfg_attr(feature = "bindings", derive(TS))]
13273pub struct SessionUser;
13274
13275#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13277#[cfg_attr(feature = "bindings", derive(TS))]
13278pub struct JSONPathRoot;
13279
13280#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13282#[cfg_attr(feature = "bindings", derive(TS))]
13283pub struct UtcTime {
13284 #[serde(default)]
13285 pub this: Option<Box<Expression>>,
13286}
13287
13288#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13290#[cfg_attr(feature = "bindings", derive(TS))]
13291pub struct UtcTimestamp {
13292 #[serde(default)]
13293 pub this: Option<Box<Expression>>,
13294}
13295
13296#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13298#[cfg_attr(feature = "bindings", derive(TS))]
13299pub struct TimestampFunc {
13300 #[serde(default)]
13301 pub this: Option<Box<Expression>>,
13302 #[serde(default)]
13303 pub zone: Option<Box<Expression>>,
13304 #[serde(default)]
13305 pub with_tz: Option<bool>,
13306 #[serde(default)]
13307 pub safe: Option<bool>,
13308}
13309
13310#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13312#[cfg_attr(feature = "bindings", derive(TS))]
13313pub struct DateBin {
13314 pub this: Box<Expression>,
13315 pub expression: Box<Expression>,
13316 #[serde(default)]
13317 pub unit: Option<String>,
13318 #[serde(default)]
13319 pub zone: Option<Box<Expression>>,
13320 #[serde(default)]
13321 pub origin: Option<Box<Expression>>,
13322}
13323
13324#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13326#[cfg_attr(feature = "bindings", derive(TS))]
13327pub struct Datetime {
13328 pub this: Box<Expression>,
13329 #[serde(default)]
13330 pub expression: Option<Box<Expression>>,
13331}
13332
13333#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13335#[cfg_attr(feature = "bindings", derive(TS))]
13336pub struct DatetimeAdd {
13337 pub this: Box<Expression>,
13338 pub expression: Box<Expression>,
13339 #[serde(default)]
13340 pub unit: Option<String>,
13341}
13342
13343#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13345#[cfg_attr(feature = "bindings", derive(TS))]
13346pub struct DatetimeSub {
13347 pub this: Box<Expression>,
13348 pub expression: Box<Expression>,
13349 #[serde(default)]
13350 pub unit: Option<String>,
13351}
13352
13353#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13355#[cfg_attr(feature = "bindings", derive(TS))]
13356pub struct DatetimeDiff {
13357 pub this: Box<Expression>,
13358 pub expression: Box<Expression>,
13359 #[serde(default)]
13360 pub unit: Option<String>,
13361}
13362
13363#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13365#[cfg_attr(feature = "bindings", derive(TS))]
13366pub struct DatetimeTrunc {
13367 pub this: Box<Expression>,
13368 pub unit: String,
13369 #[serde(default)]
13370 pub zone: Option<Box<Expression>>,
13371}
13372
13373#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13375#[cfg_attr(feature = "bindings", derive(TS))]
13376pub struct Dayname {
13377 pub this: Box<Expression>,
13378 #[serde(default)]
13379 pub abbreviated: Option<Box<Expression>>,
13380}
13381
13382#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13384#[cfg_attr(feature = "bindings", derive(TS))]
13385pub struct MakeInterval {
13386 #[serde(default)]
13387 pub year: Option<Box<Expression>>,
13388 #[serde(default)]
13389 pub month: Option<Box<Expression>>,
13390 #[serde(default)]
13391 pub week: Option<Box<Expression>>,
13392 #[serde(default)]
13393 pub day: Option<Box<Expression>>,
13394 #[serde(default)]
13395 pub hour: Option<Box<Expression>>,
13396 #[serde(default)]
13397 pub minute: Option<Box<Expression>>,
13398 #[serde(default)]
13399 pub second: Option<Box<Expression>>,
13400}
13401
13402#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13404#[cfg_attr(feature = "bindings", derive(TS))]
13405pub struct PreviousDay {
13406 pub this: Box<Expression>,
13407 pub expression: Box<Expression>,
13408}
13409
13410#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13412#[cfg_attr(feature = "bindings", derive(TS))]
13413pub struct Elt {
13414 pub this: Box<Expression>,
13415 #[serde(default)]
13416 pub expressions: Vec<Expression>,
13417}
13418
13419#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13421#[cfg_attr(feature = "bindings", derive(TS))]
13422pub struct TimestampAdd {
13423 pub this: Box<Expression>,
13424 pub expression: Box<Expression>,
13425 #[serde(default)]
13426 pub unit: Option<String>,
13427}
13428
13429#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13431#[cfg_attr(feature = "bindings", derive(TS))]
13432pub struct TimestampSub {
13433 pub this: Box<Expression>,
13434 pub expression: Box<Expression>,
13435 #[serde(default)]
13436 pub unit: Option<String>,
13437}
13438
13439#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13441#[cfg_attr(feature = "bindings", derive(TS))]
13442pub struct TimestampDiff {
13443 pub this: Box<Expression>,
13444 pub expression: Box<Expression>,
13445 #[serde(default)]
13446 pub unit: Option<String>,
13447}
13448
13449#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13451#[cfg_attr(feature = "bindings", derive(TS))]
13452pub struct TimeSlice {
13453 pub this: Box<Expression>,
13454 pub expression: Box<Expression>,
13455 pub unit: String,
13456 #[serde(default)]
13457 pub kind: Option<String>,
13458}
13459
13460#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13462#[cfg_attr(feature = "bindings", derive(TS))]
13463pub struct TimeAdd {
13464 pub this: Box<Expression>,
13465 pub expression: Box<Expression>,
13466 #[serde(default)]
13467 pub unit: Option<String>,
13468}
13469
13470#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13472#[cfg_attr(feature = "bindings", derive(TS))]
13473pub struct TimeSub {
13474 pub this: Box<Expression>,
13475 pub expression: Box<Expression>,
13476 #[serde(default)]
13477 pub unit: Option<String>,
13478}
13479
13480#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13482#[cfg_attr(feature = "bindings", derive(TS))]
13483pub struct TimeDiff {
13484 pub this: Box<Expression>,
13485 pub expression: Box<Expression>,
13486 #[serde(default)]
13487 pub unit: Option<String>,
13488}
13489
13490#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13492#[cfg_attr(feature = "bindings", derive(TS))]
13493pub struct TimeTrunc {
13494 pub this: Box<Expression>,
13495 pub unit: String,
13496 #[serde(default)]
13497 pub zone: Option<Box<Expression>>,
13498}
13499
13500#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13502#[cfg_attr(feature = "bindings", derive(TS))]
13503pub struct DateFromParts {
13504 #[serde(default)]
13505 pub year: Option<Box<Expression>>,
13506 #[serde(default)]
13507 pub month: Option<Box<Expression>>,
13508 #[serde(default)]
13509 pub day: Option<Box<Expression>>,
13510 #[serde(default)]
13511 pub allow_overflow: Option<Box<Expression>>,
13512}
13513
13514#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13516#[cfg_attr(feature = "bindings", derive(TS))]
13517pub struct TimeFromParts {
13518 #[serde(default)]
13519 pub hour: Option<Box<Expression>>,
13520 #[serde(default)]
13521 pub min: Option<Box<Expression>>,
13522 #[serde(default)]
13523 pub sec: Option<Box<Expression>>,
13524 #[serde(default)]
13525 pub nano: Option<Box<Expression>>,
13526 #[serde(default)]
13527 pub fractions: Option<Box<Expression>>,
13528 #[serde(default)]
13529 pub precision: Option<i64>,
13530}
13531
13532#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13534#[cfg_attr(feature = "bindings", derive(TS))]
13535pub struct DecodeCase {
13536 #[serde(default)]
13537 pub expressions: Vec<Expression>,
13538}
13539
13540#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13542#[cfg_attr(feature = "bindings", derive(TS))]
13543pub struct Decrypt {
13544 pub this: Box<Expression>,
13545 #[serde(default)]
13546 pub passphrase: Option<Box<Expression>>,
13547 #[serde(default)]
13548 pub aad: Option<Box<Expression>>,
13549 #[serde(default)]
13550 pub encryption_method: Option<Box<Expression>>,
13551 #[serde(default)]
13552 pub safe: Option<Box<Expression>>,
13553}
13554
13555#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13557#[cfg_attr(feature = "bindings", derive(TS))]
13558pub struct DecryptRaw {
13559 pub this: Box<Expression>,
13560 #[serde(default)]
13561 pub key: Option<Box<Expression>>,
13562 #[serde(default)]
13563 pub iv: Option<Box<Expression>>,
13564 #[serde(default)]
13565 pub aad: Option<Box<Expression>>,
13566 #[serde(default)]
13567 pub encryption_method: Option<Box<Expression>>,
13568 #[serde(default)]
13569 pub aead: Option<Box<Expression>>,
13570 #[serde(default)]
13571 pub safe: Option<Box<Expression>>,
13572}
13573
13574#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13576#[cfg_attr(feature = "bindings", derive(TS))]
13577pub struct Encode {
13578 pub this: Box<Expression>,
13579 #[serde(default)]
13580 pub charset: Option<Box<Expression>>,
13581}
13582
13583#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13585#[cfg_attr(feature = "bindings", derive(TS))]
13586pub struct Encrypt {
13587 pub this: Box<Expression>,
13588 #[serde(default)]
13589 pub passphrase: Option<Box<Expression>>,
13590 #[serde(default)]
13591 pub aad: Option<Box<Expression>>,
13592 #[serde(default)]
13593 pub encryption_method: Option<Box<Expression>>,
13594}
13595
13596#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13598#[cfg_attr(feature = "bindings", derive(TS))]
13599pub struct EncryptRaw {
13600 pub this: Box<Expression>,
13601 #[serde(default)]
13602 pub key: Option<Box<Expression>>,
13603 #[serde(default)]
13604 pub iv: Option<Box<Expression>>,
13605 #[serde(default)]
13606 pub aad: Option<Box<Expression>>,
13607 #[serde(default)]
13608 pub encryption_method: Option<Box<Expression>>,
13609}
13610
13611#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13613#[cfg_attr(feature = "bindings", derive(TS))]
13614pub struct EqualNull {
13615 pub this: Box<Expression>,
13616 pub expression: Box<Expression>,
13617}
13618
13619#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13621#[cfg_attr(feature = "bindings", derive(TS))]
13622pub struct ToBinary {
13623 pub this: Box<Expression>,
13624 #[serde(default)]
13625 pub format: Option<String>,
13626 #[serde(default)]
13627 pub safe: Option<Box<Expression>>,
13628}
13629
13630#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13632#[cfg_attr(feature = "bindings", derive(TS))]
13633pub struct Base64DecodeBinary {
13634 pub this: Box<Expression>,
13635 #[serde(default)]
13636 pub alphabet: Option<Box<Expression>>,
13637}
13638
13639#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13641#[cfg_attr(feature = "bindings", derive(TS))]
13642pub struct Base64DecodeString {
13643 pub this: Box<Expression>,
13644 #[serde(default)]
13645 pub alphabet: Option<Box<Expression>>,
13646}
13647
13648#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13650#[cfg_attr(feature = "bindings", derive(TS))]
13651pub struct Base64Encode {
13652 pub this: Box<Expression>,
13653 #[serde(default)]
13654 pub max_line_length: Option<Box<Expression>>,
13655 #[serde(default)]
13656 pub alphabet: Option<Box<Expression>>,
13657}
13658
13659#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13661#[cfg_attr(feature = "bindings", derive(TS))]
13662pub struct TryBase64DecodeBinary {
13663 pub this: Box<Expression>,
13664 #[serde(default)]
13665 pub alphabet: Option<Box<Expression>>,
13666}
13667
13668#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13670#[cfg_attr(feature = "bindings", derive(TS))]
13671pub struct TryBase64DecodeString {
13672 pub this: Box<Expression>,
13673 #[serde(default)]
13674 pub alphabet: Option<Box<Expression>>,
13675}
13676
13677#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13679#[cfg_attr(feature = "bindings", derive(TS))]
13680pub struct GapFill {
13681 pub this: Box<Expression>,
13682 #[serde(default)]
13683 pub ts_column: Option<Box<Expression>>,
13684 #[serde(default)]
13685 pub bucket_width: Option<Box<Expression>>,
13686 #[serde(default)]
13687 pub partitioning_columns: Option<Box<Expression>>,
13688 #[serde(default)]
13689 pub value_columns: Option<Box<Expression>>,
13690 #[serde(default)]
13691 pub origin: Option<Box<Expression>>,
13692 #[serde(default)]
13693 pub ignore_nulls: Option<Box<Expression>>,
13694}
13695
13696#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13698#[cfg_attr(feature = "bindings", derive(TS))]
13699pub struct GenerateDateArray {
13700 #[serde(default)]
13701 pub start: Option<Box<Expression>>,
13702 #[serde(default)]
13703 pub end: Option<Box<Expression>>,
13704 #[serde(default)]
13705 pub step: Option<Box<Expression>>,
13706}
13707
13708#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13710#[cfg_attr(feature = "bindings", derive(TS))]
13711pub struct GenerateTimestampArray {
13712 #[serde(default)]
13713 pub start: Option<Box<Expression>>,
13714 #[serde(default)]
13715 pub end: Option<Box<Expression>>,
13716 #[serde(default)]
13717 pub step: Option<Box<Expression>>,
13718}
13719
13720#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13722#[cfg_attr(feature = "bindings", derive(TS))]
13723pub struct GetExtract {
13724 pub this: Box<Expression>,
13725 pub expression: Box<Expression>,
13726}
13727
13728#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13730#[cfg_attr(feature = "bindings", derive(TS))]
13731pub struct Getbit {
13732 pub this: Box<Expression>,
13733 pub expression: Box<Expression>,
13734 #[serde(default)]
13735 pub zero_is_msb: Option<Box<Expression>>,
13736}
13737
13738#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13740#[cfg_attr(feature = "bindings", derive(TS))]
13741pub struct OverflowTruncateBehavior {
13742 #[serde(default)]
13743 pub this: Option<Box<Expression>>,
13744 #[serde(default)]
13745 pub with_count: Option<Box<Expression>>,
13746}
13747
13748#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13750#[cfg_attr(feature = "bindings", derive(TS))]
13751pub struct HexEncode {
13752 pub this: Box<Expression>,
13753 #[serde(default)]
13754 pub case: Option<Box<Expression>>,
13755}
13756
13757#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13759#[cfg_attr(feature = "bindings", derive(TS))]
13760pub struct Compress {
13761 pub this: Box<Expression>,
13762 #[serde(default)]
13763 pub method: Option<String>,
13764}
13765
13766#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13768#[cfg_attr(feature = "bindings", derive(TS))]
13769pub struct DecompressBinary {
13770 pub this: Box<Expression>,
13771 pub method: String,
13772}
13773
13774#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13776#[cfg_attr(feature = "bindings", derive(TS))]
13777pub struct DecompressString {
13778 pub this: Box<Expression>,
13779 pub method: String,
13780}
13781
13782#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13784#[cfg_attr(feature = "bindings", derive(TS))]
13785pub struct Xor {
13786 #[serde(default)]
13787 pub this: Option<Box<Expression>>,
13788 #[serde(default)]
13789 pub expression: Option<Box<Expression>>,
13790 #[serde(default)]
13791 pub expressions: Vec<Expression>,
13792}
13793
13794#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13796#[cfg_attr(feature = "bindings", derive(TS))]
13797pub struct Nullif {
13798 pub this: Box<Expression>,
13799 pub expression: Box<Expression>,
13800}
13801
13802#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13804#[cfg_attr(feature = "bindings", derive(TS))]
13805pub struct JSON {
13806 #[serde(default)]
13807 pub this: Option<Box<Expression>>,
13808 #[serde(default)]
13809 pub with_: Option<Box<Expression>>,
13810 #[serde(default)]
13811 pub unique: bool,
13812}
13813
13814#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13816#[cfg_attr(feature = "bindings", derive(TS))]
13817pub struct JSONPath {
13818 #[serde(default)]
13819 pub expressions: Vec<Expression>,
13820 #[serde(default)]
13821 pub escape: Option<Box<Expression>>,
13822}
13823
13824#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13826#[cfg_attr(feature = "bindings", derive(TS))]
13827pub struct JSONPathFilter {
13828 pub this: Box<Expression>,
13829}
13830
13831#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13833#[cfg_attr(feature = "bindings", derive(TS))]
13834pub struct JSONPathKey {
13835 pub this: Box<Expression>,
13836}
13837
13838#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13840#[cfg_attr(feature = "bindings", derive(TS))]
13841pub struct JSONPathRecursive {
13842 #[serde(default)]
13843 pub this: Option<Box<Expression>>,
13844}
13845
13846#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13848#[cfg_attr(feature = "bindings", derive(TS))]
13849pub struct JSONPathScript {
13850 pub this: Box<Expression>,
13851}
13852
13853#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13855#[cfg_attr(feature = "bindings", derive(TS))]
13856pub struct JSONPathSlice {
13857 #[serde(default)]
13858 pub start: Option<Box<Expression>>,
13859 #[serde(default)]
13860 pub end: Option<Box<Expression>>,
13861 #[serde(default)]
13862 pub step: Option<Box<Expression>>,
13863}
13864
13865#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13867#[cfg_attr(feature = "bindings", derive(TS))]
13868pub struct JSONPathSelector {
13869 pub this: Box<Expression>,
13870}
13871
13872#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13874#[cfg_attr(feature = "bindings", derive(TS))]
13875pub struct JSONPathSubscript {
13876 pub this: Box<Expression>,
13877}
13878
13879#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13881#[cfg_attr(feature = "bindings", derive(TS))]
13882pub struct JSONPathUnion {
13883 #[serde(default)]
13884 pub expressions: Vec<Expression>,
13885}
13886
13887#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13889#[cfg_attr(feature = "bindings", derive(TS))]
13890pub struct Format {
13891 pub this: Box<Expression>,
13892 #[serde(default)]
13893 pub expressions: Vec<Expression>,
13894}
13895
13896#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13898#[cfg_attr(feature = "bindings", derive(TS))]
13899pub struct JSONKeys {
13900 pub this: Box<Expression>,
13901 #[serde(default)]
13902 pub expression: Option<Box<Expression>>,
13903 #[serde(default)]
13904 pub expressions: Vec<Expression>,
13905}
13906
13907#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13909#[cfg_attr(feature = "bindings", derive(TS))]
13910pub struct JSONKeyValue {
13911 pub this: Box<Expression>,
13912 pub expression: Box<Expression>,
13913}
13914
13915#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13917#[cfg_attr(feature = "bindings", derive(TS))]
13918pub struct JSONKeysAtDepth {
13919 pub this: Box<Expression>,
13920 #[serde(default)]
13921 pub expression: Option<Box<Expression>>,
13922 #[serde(default)]
13923 pub mode: Option<Box<Expression>>,
13924}
13925
13926#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13928#[cfg_attr(feature = "bindings", derive(TS))]
13929pub struct JSONObject {
13930 #[serde(default)]
13931 pub expressions: Vec<Expression>,
13932 #[serde(default)]
13933 pub null_handling: Option<Box<Expression>>,
13934 #[serde(default)]
13935 pub unique_keys: Option<Box<Expression>>,
13936 #[serde(default)]
13937 pub return_type: Option<Box<Expression>>,
13938 #[serde(default)]
13939 pub encoding: Option<Box<Expression>>,
13940}
13941
13942#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13944#[cfg_attr(feature = "bindings", derive(TS))]
13945pub struct JSONObjectAgg {
13946 #[serde(default)]
13947 pub expressions: Vec<Expression>,
13948 #[serde(default)]
13949 pub null_handling: Option<Box<Expression>>,
13950 #[serde(default)]
13951 pub unique_keys: Option<Box<Expression>>,
13952 #[serde(default)]
13953 pub return_type: Option<Box<Expression>>,
13954 #[serde(default)]
13955 pub encoding: Option<Box<Expression>>,
13956}
13957
13958#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13960#[cfg_attr(feature = "bindings", derive(TS))]
13961pub struct JSONBObjectAgg {
13962 pub this: Box<Expression>,
13963 pub expression: Box<Expression>,
13964}
13965
13966#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13968#[cfg_attr(feature = "bindings", derive(TS))]
13969pub struct JSONArray {
13970 #[serde(default)]
13971 pub expressions: Vec<Expression>,
13972 #[serde(default)]
13973 pub null_handling: Option<Box<Expression>>,
13974 #[serde(default)]
13975 pub return_type: Option<Box<Expression>>,
13976 #[serde(default)]
13977 pub strict: Option<Box<Expression>>,
13978}
13979
13980#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13982#[cfg_attr(feature = "bindings", derive(TS))]
13983pub struct JSONArrayAgg {
13984 pub this: Box<Expression>,
13985 #[serde(default)]
13986 pub order: Option<Box<Expression>>,
13987 #[serde(default)]
13988 pub null_handling: Option<Box<Expression>>,
13989 #[serde(default)]
13990 pub return_type: Option<Box<Expression>>,
13991 #[serde(default)]
13992 pub strict: Option<Box<Expression>>,
13993}
13994
13995#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13997#[cfg_attr(feature = "bindings", derive(TS))]
13998pub struct JSONExists {
13999 pub this: Box<Expression>,
14000 #[serde(default)]
14001 pub path: Option<Box<Expression>>,
14002 #[serde(default)]
14003 pub passing: Option<Box<Expression>>,
14004 #[serde(default)]
14005 pub on_condition: Option<Box<Expression>>,
14006 #[serde(default)]
14007 pub from_dcolonqmark: Option<Box<Expression>>,
14008}
14009
14010#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14012#[cfg_attr(feature = "bindings", derive(TS))]
14013pub struct JSONColumnDef {
14014 #[serde(default)]
14015 pub this: Option<Box<Expression>>,
14016 #[serde(default)]
14017 pub kind: Option<String>,
14018 #[serde(default)]
14019 pub format_json: bool,
14020 #[serde(default)]
14021 pub path: Option<Box<Expression>>,
14022 #[serde(default)]
14023 pub nested_schema: Option<Box<Expression>>,
14024 #[serde(default)]
14025 pub ordinality: Option<Box<Expression>>,
14026}
14027
14028#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14030#[cfg_attr(feature = "bindings", derive(TS))]
14031pub struct JSONSchema {
14032 #[serde(default)]
14033 pub expressions: Vec<Expression>,
14034}
14035
14036#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14038#[cfg_attr(feature = "bindings", derive(TS))]
14039pub struct JSONSet {
14040 pub this: Box<Expression>,
14041 #[serde(default)]
14042 pub expressions: Vec<Expression>,
14043}
14044
14045#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14047#[cfg_attr(feature = "bindings", derive(TS))]
14048pub struct JSONStripNulls {
14049 pub this: Box<Expression>,
14050 #[serde(default)]
14051 pub expression: Option<Box<Expression>>,
14052 #[serde(default)]
14053 pub include_arrays: Option<Box<Expression>>,
14054 #[serde(default)]
14055 pub remove_empty: Option<Box<Expression>>,
14056}
14057
14058#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14060#[cfg_attr(feature = "bindings", derive(TS))]
14061pub struct JSONValue {
14062 pub this: Box<Expression>,
14063 #[serde(default)]
14064 pub path: Option<Box<Expression>>,
14065 #[serde(default)]
14066 pub returning: Option<Box<Expression>>,
14067 #[serde(default)]
14068 pub on_condition: Option<Box<Expression>>,
14069}
14070
14071#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14073#[cfg_attr(feature = "bindings", derive(TS))]
14074pub struct JSONValueArray {
14075 pub this: Box<Expression>,
14076 #[serde(default)]
14077 pub expression: Option<Box<Expression>>,
14078}
14079
14080#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14082#[cfg_attr(feature = "bindings", derive(TS))]
14083pub struct JSONRemove {
14084 pub this: Box<Expression>,
14085 #[serde(default)]
14086 pub expressions: Vec<Expression>,
14087}
14088
14089#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14091#[cfg_attr(feature = "bindings", derive(TS))]
14092pub struct JSONTable {
14093 pub this: Box<Expression>,
14094 #[serde(default)]
14095 pub schema: Option<Box<Expression>>,
14096 #[serde(default)]
14097 pub path: Option<Box<Expression>>,
14098 #[serde(default)]
14099 pub error_handling: Option<Box<Expression>>,
14100 #[serde(default)]
14101 pub empty_handling: Option<Box<Expression>>,
14102}
14103
14104#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14106#[cfg_attr(feature = "bindings", derive(TS))]
14107pub struct JSONType {
14108 pub this: Box<Expression>,
14109 #[serde(default)]
14110 pub expression: Option<Box<Expression>>,
14111}
14112
14113#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14115#[cfg_attr(feature = "bindings", derive(TS))]
14116pub struct ObjectInsert {
14117 pub this: Box<Expression>,
14118 #[serde(default)]
14119 pub key: Option<Box<Expression>>,
14120 #[serde(default)]
14121 pub value: Option<Box<Expression>>,
14122 #[serde(default)]
14123 pub update_flag: Option<Box<Expression>>,
14124}
14125
14126#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14128#[cfg_attr(feature = "bindings", derive(TS))]
14129pub struct OpenJSONColumnDef {
14130 pub this: Box<Expression>,
14131 pub kind: String,
14132 #[serde(default)]
14133 pub path: Option<Box<Expression>>,
14134 #[serde(default)]
14135 pub as_json: Option<Box<Expression>>,
14136 #[serde(default, skip_serializing_if = "Option::is_none")]
14138 pub data_type: Option<DataType>,
14139}
14140
14141#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14143#[cfg_attr(feature = "bindings", derive(TS))]
14144pub struct OpenJSON {
14145 pub this: Box<Expression>,
14146 #[serde(default)]
14147 pub path: Option<Box<Expression>>,
14148 #[serde(default)]
14149 pub expressions: Vec<Expression>,
14150}
14151
14152#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14154#[cfg_attr(feature = "bindings", derive(TS))]
14155pub struct JSONBExists {
14156 pub this: Box<Expression>,
14157 #[serde(default)]
14158 pub path: Option<Box<Expression>>,
14159}
14160
14161#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14163#[cfg_attr(feature = "bindings", derive(TS))]
14164pub struct JSONCast {
14165 pub this: Box<Expression>,
14166 pub to: DataType,
14167}
14168
14169#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14171#[cfg_attr(feature = "bindings", derive(TS))]
14172pub struct JSONExtract {
14173 pub this: Box<Expression>,
14174 pub expression: Box<Expression>,
14175 #[serde(default)]
14176 pub only_json_types: Option<Box<Expression>>,
14177 #[serde(default)]
14178 pub expressions: Vec<Expression>,
14179 #[serde(default)]
14180 pub variant_extract: Option<Box<Expression>>,
14181 #[serde(default)]
14182 pub json_query: Option<Box<Expression>>,
14183 #[serde(default)]
14184 pub option: Option<Box<Expression>>,
14185 #[serde(default)]
14186 pub quote: Option<Box<Expression>>,
14187 #[serde(default)]
14188 pub on_condition: Option<Box<Expression>>,
14189 #[serde(default)]
14190 pub requires_json: Option<Box<Expression>>,
14191}
14192
14193#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14195#[cfg_attr(feature = "bindings", derive(TS))]
14196pub struct JSONExtractQuote {
14197 #[serde(default)]
14198 pub option: Option<Box<Expression>>,
14199 #[serde(default)]
14200 pub scalar: Option<Box<Expression>>,
14201}
14202
14203#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14205#[cfg_attr(feature = "bindings", derive(TS))]
14206pub struct JSONExtractArray {
14207 pub this: Box<Expression>,
14208 #[serde(default)]
14209 pub expression: Option<Box<Expression>>,
14210}
14211
14212#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14214#[cfg_attr(feature = "bindings", derive(TS))]
14215pub struct JSONExtractScalar {
14216 pub this: Box<Expression>,
14217 pub expression: Box<Expression>,
14218 #[serde(default)]
14219 pub only_json_types: Option<Box<Expression>>,
14220 #[serde(default)]
14221 pub expressions: Vec<Expression>,
14222 #[serde(default)]
14223 pub json_type: Option<Box<Expression>>,
14224 #[serde(default)]
14225 pub scalar_only: Option<Box<Expression>>,
14226}
14227
14228#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14230#[cfg_attr(feature = "bindings", derive(TS))]
14231pub struct JSONBExtractScalar {
14232 pub this: Box<Expression>,
14233 pub expression: Box<Expression>,
14234 #[serde(default)]
14235 pub json_type: Option<Box<Expression>>,
14236}
14237
14238#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14240#[cfg_attr(feature = "bindings", derive(TS))]
14241pub struct JSONFormat {
14242 #[serde(default)]
14243 pub this: Option<Box<Expression>>,
14244 #[serde(default)]
14245 pub options: Vec<Expression>,
14246 #[serde(default)]
14247 pub is_json: Option<Box<Expression>>,
14248 #[serde(default)]
14249 pub to_json: Option<Box<Expression>>,
14250}
14251
14252#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14254#[cfg_attr(feature = "bindings", derive(TS))]
14255pub struct JSONArrayAppend {
14256 pub this: Box<Expression>,
14257 #[serde(default)]
14258 pub expressions: Vec<Expression>,
14259}
14260
14261#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14263#[cfg_attr(feature = "bindings", derive(TS))]
14264pub struct JSONArrayContains {
14265 pub this: Box<Expression>,
14266 pub expression: Box<Expression>,
14267 #[serde(default)]
14268 pub json_type: Option<Box<Expression>>,
14269}
14270
14271#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14273#[cfg_attr(feature = "bindings", derive(TS))]
14274pub struct JSONArrayInsert {
14275 pub this: Box<Expression>,
14276 #[serde(default)]
14277 pub expressions: Vec<Expression>,
14278}
14279
14280#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14282#[cfg_attr(feature = "bindings", derive(TS))]
14283pub struct ParseJSON {
14284 pub this: Box<Expression>,
14285 #[serde(default)]
14286 pub expression: Option<Box<Expression>>,
14287 #[serde(default)]
14288 pub safe: Option<Box<Expression>>,
14289}
14290
14291#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14293#[cfg_attr(feature = "bindings", derive(TS))]
14294pub struct ParseUrl {
14295 pub this: Box<Expression>,
14296 #[serde(default)]
14297 pub part_to_extract: Option<Box<Expression>>,
14298 #[serde(default)]
14299 pub key: Option<Box<Expression>>,
14300 #[serde(default)]
14301 pub permissive: Option<Box<Expression>>,
14302}
14303
14304#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14306#[cfg_attr(feature = "bindings", derive(TS))]
14307pub struct ParseIp {
14308 pub this: Box<Expression>,
14309 #[serde(default)]
14310 pub type_: Option<Box<Expression>>,
14311 #[serde(default)]
14312 pub permissive: Option<Box<Expression>>,
14313}
14314
14315#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14317#[cfg_attr(feature = "bindings", derive(TS))]
14318pub struct ParseTime {
14319 pub this: Box<Expression>,
14320 pub format: String,
14321}
14322
14323#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14325#[cfg_attr(feature = "bindings", derive(TS))]
14326pub struct ParseDatetime {
14327 pub this: Box<Expression>,
14328 #[serde(default)]
14329 pub format: Option<String>,
14330 #[serde(default)]
14331 pub zone: Option<Box<Expression>>,
14332}
14333
14334#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14336#[cfg_attr(feature = "bindings", derive(TS))]
14337pub struct Map {
14338 #[serde(default)]
14339 pub keys: Vec<Expression>,
14340 #[serde(default)]
14341 pub values: Vec<Expression>,
14342}
14343
14344#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14346#[cfg_attr(feature = "bindings", derive(TS))]
14347pub struct MapCat {
14348 pub this: Box<Expression>,
14349 pub expression: Box<Expression>,
14350}
14351
14352#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14354#[cfg_attr(feature = "bindings", derive(TS))]
14355pub struct MapDelete {
14356 pub this: Box<Expression>,
14357 #[serde(default)]
14358 pub expressions: Vec<Expression>,
14359}
14360
14361#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14363#[cfg_attr(feature = "bindings", derive(TS))]
14364pub struct MapInsert {
14365 pub this: Box<Expression>,
14366 #[serde(default)]
14367 pub key: Option<Box<Expression>>,
14368 #[serde(default)]
14369 pub value: Option<Box<Expression>>,
14370 #[serde(default)]
14371 pub update_flag: Option<Box<Expression>>,
14372}
14373
14374#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14376#[cfg_attr(feature = "bindings", derive(TS))]
14377pub struct MapPick {
14378 pub this: Box<Expression>,
14379 #[serde(default)]
14380 pub expressions: Vec<Expression>,
14381}
14382
14383#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14385#[cfg_attr(feature = "bindings", derive(TS))]
14386pub struct ScopeResolution {
14387 #[serde(default)]
14388 pub this: Option<Box<Expression>>,
14389 pub expression: Box<Expression>,
14390}
14391
14392#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14394#[cfg_attr(feature = "bindings", derive(TS))]
14395pub struct Slice {
14396 #[serde(default)]
14397 pub this: Option<Box<Expression>>,
14398 #[serde(default)]
14399 pub expression: Option<Box<Expression>>,
14400 #[serde(default)]
14401 pub step: Option<Box<Expression>>,
14402}
14403
14404#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14406#[cfg_attr(feature = "bindings", derive(TS))]
14407pub struct VarMap {
14408 #[serde(default)]
14409 pub keys: Vec<Expression>,
14410 #[serde(default)]
14411 pub values: Vec<Expression>,
14412}
14413
14414#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14416#[cfg_attr(feature = "bindings", derive(TS))]
14417pub struct MatchAgainst {
14418 pub this: Box<Expression>,
14419 #[serde(default)]
14420 pub expressions: Vec<Expression>,
14421 #[serde(default)]
14422 pub modifier: Option<Box<Expression>>,
14423}
14424
14425#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14427#[cfg_attr(feature = "bindings", derive(TS))]
14428pub struct MD5Digest {
14429 pub this: Box<Expression>,
14430 #[serde(default)]
14431 pub expressions: Vec<Expression>,
14432}
14433
14434#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14436#[cfg_attr(feature = "bindings", derive(TS))]
14437pub struct Monthname {
14438 pub this: Box<Expression>,
14439 #[serde(default)]
14440 pub abbreviated: Option<Box<Expression>>,
14441}
14442
14443#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14445#[cfg_attr(feature = "bindings", derive(TS))]
14446pub struct Ntile {
14447 #[serde(default)]
14448 pub this: Option<Box<Expression>>,
14449}
14450
14451#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14453#[cfg_attr(feature = "bindings", derive(TS))]
14454pub struct Normalize {
14455 pub this: Box<Expression>,
14456 #[serde(default)]
14457 pub form: Option<Box<Expression>>,
14458 #[serde(default)]
14459 pub is_casefold: Option<Box<Expression>>,
14460}
14461
14462#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14464#[cfg_attr(feature = "bindings", derive(TS))]
14465pub struct Normal {
14466 pub this: Box<Expression>,
14467 #[serde(default)]
14468 pub stddev: Option<Box<Expression>>,
14469 #[serde(default)]
14470 pub gen: Option<Box<Expression>>,
14471}
14472
14473#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14475#[cfg_attr(feature = "bindings", derive(TS))]
14476pub struct Predict {
14477 pub this: Box<Expression>,
14478 pub expression: Box<Expression>,
14479 #[serde(default)]
14480 pub params_struct: Option<Box<Expression>>,
14481}
14482
14483#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14485#[cfg_attr(feature = "bindings", derive(TS))]
14486pub struct MLTranslate {
14487 pub this: Box<Expression>,
14488 pub expression: Box<Expression>,
14489 #[serde(default)]
14490 pub params_struct: Option<Box<Expression>>,
14491}
14492
14493#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14495#[cfg_attr(feature = "bindings", derive(TS))]
14496pub struct FeaturesAtTime {
14497 pub this: Box<Expression>,
14498 #[serde(default)]
14499 pub time: Option<Box<Expression>>,
14500 #[serde(default)]
14501 pub num_rows: Option<Box<Expression>>,
14502 #[serde(default)]
14503 pub ignore_feature_nulls: Option<Box<Expression>>,
14504}
14505
14506#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14508#[cfg_attr(feature = "bindings", derive(TS))]
14509pub struct GenerateEmbedding {
14510 pub this: Box<Expression>,
14511 pub expression: Box<Expression>,
14512 #[serde(default)]
14513 pub params_struct: Option<Box<Expression>>,
14514 #[serde(default)]
14515 pub is_text: Option<Box<Expression>>,
14516}
14517
14518#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14520#[cfg_attr(feature = "bindings", derive(TS))]
14521pub struct MLForecast {
14522 pub this: Box<Expression>,
14523 #[serde(default)]
14524 pub expression: Option<Box<Expression>>,
14525 #[serde(default)]
14526 pub params_struct: Option<Box<Expression>>,
14527}
14528
14529#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14531#[cfg_attr(feature = "bindings", derive(TS))]
14532pub struct ModelAttribute {
14533 pub this: Box<Expression>,
14534 pub expression: Box<Expression>,
14535}
14536
14537#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14539#[cfg_attr(feature = "bindings", derive(TS))]
14540pub struct VectorSearch {
14541 pub this: Box<Expression>,
14542 #[serde(default)]
14543 pub column_to_search: Option<Box<Expression>>,
14544 #[serde(default)]
14545 pub query_table: Option<Box<Expression>>,
14546 #[serde(default)]
14547 pub query_column_to_search: Option<Box<Expression>>,
14548 #[serde(default)]
14549 pub top_k: Option<Box<Expression>>,
14550 #[serde(default)]
14551 pub distance_type: Option<Box<Expression>>,
14552 #[serde(default)]
14553 pub options: Vec<Expression>,
14554}
14555
14556#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14558#[cfg_attr(feature = "bindings", derive(TS))]
14559pub struct Quantile {
14560 pub this: Box<Expression>,
14561 #[serde(default)]
14562 pub quantile: Option<Box<Expression>>,
14563}
14564
14565#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14567#[cfg_attr(feature = "bindings", derive(TS))]
14568pub struct ApproxQuantile {
14569 pub this: Box<Expression>,
14570 #[serde(default)]
14571 pub quantile: Option<Box<Expression>>,
14572 #[serde(default)]
14573 pub accuracy: Option<Box<Expression>>,
14574 #[serde(default)]
14575 pub weight: Option<Box<Expression>>,
14576 #[serde(default)]
14577 pub error_tolerance: Option<Box<Expression>>,
14578}
14579
14580#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14582#[cfg_attr(feature = "bindings", derive(TS))]
14583pub struct ApproxPercentileEstimate {
14584 pub this: Box<Expression>,
14585 #[serde(default)]
14586 pub percentile: Option<Box<Expression>>,
14587}
14588
14589#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14591#[cfg_attr(feature = "bindings", derive(TS))]
14592pub struct Randn {
14593 #[serde(default)]
14594 pub this: Option<Box<Expression>>,
14595}
14596
14597#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14599#[cfg_attr(feature = "bindings", derive(TS))]
14600pub struct Randstr {
14601 pub this: Box<Expression>,
14602 #[serde(default)]
14603 pub generator: Option<Box<Expression>>,
14604}
14605
14606#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14608#[cfg_attr(feature = "bindings", derive(TS))]
14609pub struct RangeN {
14610 pub this: Box<Expression>,
14611 #[serde(default)]
14612 pub expressions: Vec<Expression>,
14613 #[serde(default)]
14614 pub each: Option<Box<Expression>>,
14615}
14616
14617#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14619#[cfg_attr(feature = "bindings", derive(TS))]
14620pub struct RangeBucket {
14621 pub this: Box<Expression>,
14622 pub expression: Box<Expression>,
14623}
14624
14625#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14627#[cfg_attr(feature = "bindings", derive(TS))]
14628pub struct ReadCSV {
14629 pub this: Box<Expression>,
14630 #[serde(default)]
14631 pub expressions: Vec<Expression>,
14632}
14633
14634#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14636#[cfg_attr(feature = "bindings", derive(TS))]
14637pub struct ReadParquet {
14638 #[serde(default)]
14639 pub expressions: Vec<Expression>,
14640}
14641
14642#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14644#[cfg_attr(feature = "bindings", derive(TS))]
14645pub struct Reduce {
14646 pub this: Box<Expression>,
14647 #[serde(default)]
14648 pub initial: Option<Box<Expression>>,
14649 #[serde(default)]
14650 pub merge: Option<Box<Expression>>,
14651 #[serde(default)]
14652 pub finish: Option<Box<Expression>>,
14653}
14654
14655#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14657#[cfg_attr(feature = "bindings", derive(TS))]
14658pub struct RegexpExtractAll {
14659 pub this: Box<Expression>,
14660 pub expression: Box<Expression>,
14661 #[serde(default)]
14662 pub group: Option<Box<Expression>>,
14663 #[serde(default)]
14664 pub parameters: Option<Box<Expression>>,
14665 #[serde(default)]
14666 pub position: Option<Box<Expression>>,
14667 #[serde(default)]
14668 pub occurrence: Option<Box<Expression>>,
14669}
14670
14671#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14673#[cfg_attr(feature = "bindings", derive(TS))]
14674pub struct RegexpILike {
14675 pub this: Box<Expression>,
14676 pub expression: Box<Expression>,
14677 #[serde(default)]
14678 pub flag: Option<Box<Expression>>,
14679}
14680
14681#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14683#[cfg_attr(feature = "bindings", derive(TS))]
14684pub struct RegexpFullMatch {
14685 pub this: Box<Expression>,
14686 pub expression: Box<Expression>,
14687 #[serde(default)]
14688 pub options: Vec<Expression>,
14689}
14690
14691#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14693#[cfg_attr(feature = "bindings", derive(TS))]
14694pub struct RegexpInstr {
14695 pub this: Box<Expression>,
14696 pub expression: Box<Expression>,
14697 #[serde(default)]
14698 pub position: Option<Box<Expression>>,
14699 #[serde(default)]
14700 pub occurrence: Option<Box<Expression>>,
14701 #[serde(default)]
14702 pub option: Option<Box<Expression>>,
14703 #[serde(default)]
14704 pub parameters: Option<Box<Expression>>,
14705 #[serde(default)]
14706 pub group: Option<Box<Expression>>,
14707}
14708
14709#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14711#[cfg_attr(feature = "bindings", derive(TS))]
14712pub struct RegexpSplit {
14713 pub this: Box<Expression>,
14714 pub expression: Box<Expression>,
14715 #[serde(default)]
14716 pub limit: Option<Box<Expression>>,
14717}
14718
14719#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14721#[cfg_attr(feature = "bindings", derive(TS))]
14722pub struct RegexpCount {
14723 pub this: Box<Expression>,
14724 pub expression: Box<Expression>,
14725 #[serde(default)]
14726 pub position: Option<Box<Expression>>,
14727 #[serde(default)]
14728 pub parameters: Option<Box<Expression>>,
14729}
14730
14731#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14733#[cfg_attr(feature = "bindings", derive(TS))]
14734pub struct RegrValx {
14735 pub this: Box<Expression>,
14736 pub expression: Box<Expression>,
14737}
14738
14739#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14741#[cfg_attr(feature = "bindings", derive(TS))]
14742pub struct RegrValy {
14743 pub this: Box<Expression>,
14744 pub expression: Box<Expression>,
14745}
14746
14747#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14749#[cfg_attr(feature = "bindings", derive(TS))]
14750pub struct RegrAvgy {
14751 pub this: Box<Expression>,
14752 pub expression: Box<Expression>,
14753}
14754
14755#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14757#[cfg_attr(feature = "bindings", derive(TS))]
14758pub struct RegrAvgx {
14759 pub this: Box<Expression>,
14760 pub expression: Box<Expression>,
14761}
14762
14763#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14765#[cfg_attr(feature = "bindings", derive(TS))]
14766pub struct RegrCount {
14767 pub this: Box<Expression>,
14768 pub expression: Box<Expression>,
14769}
14770
14771#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14773#[cfg_attr(feature = "bindings", derive(TS))]
14774pub struct RegrIntercept {
14775 pub this: Box<Expression>,
14776 pub expression: Box<Expression>,
14777}
14778
14779#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14781#[cfg_attr(feature = "bindings", derive(TS))]
14782pub struct RegrR2 {
14783 pub this: Box<Expression>,
14784 pub expression: Box<Expression>,
14785}
14786
14787#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14789#[cfg_attr(feature = "bindings", derive(TS))]
14790pub struct RegrSxx {
14791 pub this: Box<Expression>,
14792 pub expression: Box<Expression>,
14793}
14794
14795#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14797#[cfg_attr(feature = "bindings", derive(TS))]
14798pub struct RegrSxy {
14799 pub this: Box<Expression>,
14800 pub expression: Box<Expression>,
14801}
14802
14803#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14805#[cfg_attr(feature = "bindings", derive(TS))]
14806pub struct RegrSyy {
14807 pub this: Box<Expression>,
14808 pub expression: Box<Expression>,
14809}
14810
14811#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14813#[cfg_attr(feature = "bindings", derive(TS))]
14814pub struct RegrSlope {
14815 pub this: Box<Expression>,
14816 pub expression: Box<Expression>,
14817}
14818
14819#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14821#[cfg_attr(feature = "bindings", derive(TS))]
14822pub struct SafeAdd {
14823 pub this: Box<Expression>,
14824 pub expression: Box<Expression>,
14825}
14826
14827#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14829#[cfg_attr(feature = "bindings", derive(TS))]
14830pub struct SafeDivide {
14831 pub this: Box<Expression>,
14832 pub expression: Box<Expression>,
14833}
14834
14835#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14837#[cfg_attr(feature = "bindings", derive(TS))]
14838pub struct SafeMultiply {
14839 pub this: Box<Expression>,
14840 pub expression: Box<Expression>,
14841}
14842
14843#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14845#[cfg_attr(feature = "bindings", derive(TS))]
14846pub struct SafeSubtract {
14847 pub this: Box<Expression>,
14848 pub expression: Box<Expression>,
14849}
14850
14851#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14853#[cfg_attr(feature = "bindings", derive(TS))]
14854pub struct SHA2 {
14855 pub this: Box<Expression>,
14856 #[serde(default)]
14857 pub length: Option<i64>,
14858}
14859
14860#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14862#[cfg_attr(feature = "bindings", derive(TS))]
14863pub struct SHA2Digest {
14864 pub this: Box<Expression>,
14865 #[serde(default)]
14866 pub length: Option<i64>,
14867}
14868
14869#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14871#[cfg_attr(feature = "bindings", derive(TS))]
14872pub struct SortArray {
14873 pub this: Box<Expression>,
14874 #[serde(default)]
14875 pub asc: Option<Box<Expression>>,
14876 #[serde(default)]
14877 pub nulls_first: Option<Box<Expression>>,
14878}
14879
14880#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14882#[cfg_attr(feature = "bindings", derive(TS))]
14883pub struct SplitPart {
14884 pub this: Box<Expression>,
14885 #[serde(default)]
14886 pub delimiter: Option<Box<Expression>>,
14887 #[serde(default)]
14888 pub part_index: Option<Box<Expression>>,
14889}
14890
14891#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14893#[cfg_attr(feature = "bindings", derive(TS))]
14894pub struct SubstringIndex {
14895 pub this: Box<Expression>,
14896 #[serde(default)]
14897 pub delimiter: Option<Box<Expression>>,
14898 #[serde(default)]
14899 pub count: Option<Box<Expression>>,
14900}
14901
14902#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14904#[cfg_attr(feature = "bindings", derive(TS))]
14905pub struct StandardHash {
14906 pub this: Box<Expression>,
14907 #[serde(default)]
14908 pub expression: Option<Box<Expression>>,
14909}
14910
14911#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14913#[cfg_attr(feature = "bindings", derive(TS))]
14914pub struct StrPosition {
14915 pub this: Box<Expression>,
14916 #[serde(default)]
14917 pub substr: Option<Box<Expression>>,
14918 #[serde(default)]
14919 pub position: Option<Box<Expression>>,
14920 #[serde(default)]
14921 pub occurrence: Option<Box<Expression>>,
14922}
14923
14924#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14926#[cfg_attr(feature = "bindings", derive(TS))]
14927pub struct Search {
14928 pub this: Box<Expression>,
14929 pub expression: Box<Expression>,
14930 #[serde(default)]
14931 pub json_scope: Option<Box<Expression>>,
14932 #[serde(default)]
14933 pub analyzer: Option<Box<Expression>>,
14934 #[serde(default)]
14935 pub analyzer_options: Option<Box<Expression>>,
14936 #[serde(default)]
14937 pub search_mode: Option<Box<Expression>>,
14938}
14939
14940#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14942#[cfg_attr(feature = "bindings", derive(TS))]
14943pub struct SearchIp {
14944 pub this: Box<Expression>,
14945 pub expression: Box<Expression>,
14946}
14947
14948#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14950#[cfg_attr(feature = "bindings", derive(TS))]
14951pub struct StrToDate {
14952 pub this: Box<Expression>,
14953 #[serde(default)]
14954 pub format: Option<String>,
14955 #[serde(default)]
14956 pub safe: Option<Box<Expression>>,
14957}
14958
14959#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14961#[cfg_attr(feature = "bindings", derive(TS))]
14962pub struct StrToTime {
14963 pub this: Box<Expression>,
14964 pub format: String,
14965 #[serde(default)]
14966 pub zone: Option<Box<Expression>>,
14967 #[serde(default)]
14968 pub safe: Option<Box<Expression>>,
14969 #[serde(default)]
14970 pub target_type: Option<Box<Expression>>,
14971}
14972
14973#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14975#[cfg_attr(feature = "bindings", derive(TS))]
14976pub struct StrToUnix {
14977 #[serde(default)]
14978 pub this: Option<Box<Expression>>,
14979 #[serde(default)]
14980 pub format: Option<String>,
14981}
14982
14983#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14985#[cfg_attr(feature = "bindings", derive(TS))]
14986pub struct StrToMap {
14987 pub this: Box<Expression>,
14988 #[serde(default)]
14989 pub pair_delim: Option<Box<Expression>>,
14990 #[serde(default)]
14991 pub key_value_delim: Option<Box<Expression>>,
14992 #[serde(default)]
14993 pub duplicate_resolution_callback: Option<Box<Expression>>,
14994}
14995
14996#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14998#[cfg_attr(feature = "bindings", derive(TS))]
14999pub struct NumberToStr {
15000 pub this: Box<Expression>,
15001 pub format: String,
15002 #[serde(default)]
15003 pub culture: Option<Box<Expression>>,
15004}
15005
15006#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15008#[cfg_attr(feature = "bindings", derive(TS))]
15009pub struct FromBase {
15010 pub this: Box<Expression>,
15011 pub expression: Box<Expression>,
15012}
15013
15014#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15016#[cfg_attr(feature = "bindings", derive(TS))]
15017pub struct Stuff {
15018 pub this: Box<Expression>,
15019 #[serde(default)]
15020 pub start: Option<Box<Expression>>,
15021 #[serde(default)]
15022 pub length: Option<i64>,
15023 pub expression: Box<Expression>,
15024}
15025
15026#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15028#[cfg_attr(feature = "bindings", derive(TS))]
15029pub struct TimeToStr {
15030 pub this: Box<Expression>,
15031 pub format: String,
15032 #[serde(default)]
15033 pub culture: Option<Box<Expression>>,
15034 #[serde(default)]
15035 pub zone: Option<Box<Expression>>,
15036}
15037
15038#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15040#[cfg_attr(feature = "bindings", derive(TS))]
15041pub struct TimeStrToTime {
15042 pub this: Box<Expression>,
15043 #[serde(default)]
15044 pub zone: Option<Box<Expression>>,
15045}
15046
15047#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15049#[cfg_attr(feature = "bindings", derive(TS))]
15050pub struct TsOrDsAdd {
15051 pub this: Box<Expression>,
15052 pub expression: Box<Expression>,
15053 #[serde(default)]
15054 pub unit: Option<String>,
15055 #[serde(default)]
15056 pub return_type: Option<Box<Expression>>,
15057}
15058
15059#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15061#[cfg_attr(feature = "bindings", derive(TS))]
15062pub struct TsOrDsDiff {
15063 pub this: Box<Expression>,
15064 pub expression: Box<Expression>,
15065 #[serde(default)]
15066 pub unit: Option<String>,
15067}
15068
15069#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15071#[cfg_attr(feature = "bindings", derive(TS))]
15072pub struct TsOrDsToDate {
15073 pub this: Box<Expression>,
15074 #[serde(default)]
15075 pub format: Option<String>,
15076 #[serde(default)]
15077 pub safe: Option<Box<Expression>>,
15078}
15079
15080#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15082#[cfg_attr(feature = "bindings", derive(TS))]
15083pub struct TsOrDsToTime {
15084 pub this: Box<Expression>,
15085 #[serde(default)]
15086 pub format: Option<String>,
15087 #[serde(default)]
15088 pub safe: Option<Box<Expression>>,
15089}
15090
15091#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15093#[cfg_attr(feature = "bindings", derive(TS))]
15094pub struct Unhex {
15095 pub this: Box<Expression>,
15096 #[serde(default)]
15097 pub expression: Option<Box<Expression>>,
15098}
15099
15100#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15102#[cfg_attr(feature = "bindings", derive(TS))]
15103pub struct Uniform {
15104 pub this: Box<Expression>,
15105 pub expression: Box<Expression>,
15106 #[serde(default)]
15107 pub gen: Option<Box<Expression>>,
15108 #[serde(default)]
15109 pub seed: Option<Box<Expression>>,
15110}
15111
15112#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15114#[cfg_attr(feature = "bindings", derive(TS))]
15115pub struct UnixToStr {
15116 pub this: Box<Expression>,
15117 #[serde(default)]
15118 pub format: Option<String>,
15119}
15120
15121#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15123#[cfg_attr(feature = "bindings", derive(TS))]
15124pub struct UnixToTime {
15125 pub this: Box<Expression>,
15126 #[serde(default)]
15127 pub scale: Option<i64>,
15128 #[serde(default)]
15129 pub zone: Option<Box<Expression>>,
15130 #[serde(default)]
15131 pub hours: Option<Box<Expression>>,
15132 #[serde(default)]
15133 pub minutes: Option<Box<Expression>>,
15134 #[serde(default)]
15135 pub format: Option<String>,
15136 #[serde(default)]
15137 pub target_type: Option<Box<Expression>>,
15138}
15139
15140#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15142#[cfg_attr(feature = "bindings", derive(TS))]
15143pub struct Uuid {
15144 #[serde(default)]
15145 pub this: Option<Box<Expression>>,
15146 #[serde(default)]
15147 pub name: Option<String>,
15148 #[serde(default)]
15149 pub is_string: Option<Box<Expression>>,
15150}
15151
15152#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15154#[cfg_attr(feature = "bindings", derive(TS))]
15155pub struct TimestampFromParts {
15156 #[serde(default)]
15157 pub zone: Option<Box<Expression>>,
15158 #[serde(default)]
15159 pub milli: Option<Box<Expression>>,
15160 #[serde(default)]
15161 pub this: Option<Box<Expression>>,
15162 #[serde(default)]
15163 pub expression: Option<Box<Expression>>,
15164}
15165
15166#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15168#[cfg_attr(feature = "bindings", derive(TS))]
15169pub struct TimestampTzFromParts {
15170 #[serde(default)]
15171 pub zone: Option<Box<Expression>>,
15172}
15173
15174#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15176#[cfg_attr(feature = "bindings", derive(TS))]
15177pub struct Corr {
15178 pub this: Box<Expression>,
15179 pub expression: Box<Expression>,
15180 #[serde(default)]
15181 pub null_on_zero_variance: Option<Box<Expression>>,
15182}
15183
15184#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15186#[cfg_attr(feature = "bindings", derive(TS))]
15187pub struct WidthBucket {
15188 pub this: Box<Expression>,
15189 #[serde(default)]
15190 pub min_value: Option<Box<Expression>>,
15191 #[serde(default)]
15192 pub max_value: Option<Box<Expression>>,
15193 #[serde(default)]
15194 pub num_buckets: Option<Box<Expression>>,
15195 #[serde(default)]
15196 pub threshold: Option<Box<Expression>>,
15197}
15198
15199#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15201#[cfg_attr(feature = "bindings", derive(TS))]
15202pub struct CovarSamp {
15203 pub this: Box<Expression>,
15204 pub expression: Box<Expression>,
15205}
15206
15207#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15209#[cfg_attr(feature = "bindings", derive(TS))]
15210pub struct CovarPop {
15211 pub this: Box<Expression>,
15212 pub expression: Box<Expression>,
15213}
15214
15215#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15217#[cfg_attr(feature = "bindings", derive(TS))]
15218pub struct Week {
15219 pub this: Box<Expression>,
15220 #[serde(default)]
15221 pub mode: Option<Box<Expression>>,
15222}
15223
15224#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15226#[cfg_attr(feature = "bindings", derive(TS))]
15227pub struct XMLElement {
15228 pub this: Box<Expression>,
15229 #[serde(default)]
15230 pub expressions: Vec<Expression>,
15231 #[serde(default)]
15232 pub evalname: Option<Box<Expression>>,
15233}
15234
15235#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15237#[cfg_attr(feature = "bindings", derive(TS))]
15238pub struct XMLGet {
15239 pub this: Box<Expression>,
15240 pub expression: Box<Expression>,
15241 #[serde(default)]
15242 pub instance: Option<Box<Expression>>,
15243}
15244
15245#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15247#[cfg_attr(feature = "bindings", derive(TS))]
15248pub struct XMLTable {
15249 pub this: Box<Expression>,
15250 #[serde(default)]
15251 pub namespaces: Option<Box<Expression>>,
15252 #[serde(default)]
15253 pub passing: Option<Box<Expression>>,
15254 #[serde(default)]
15255 pub columns: Vec<Expression>,
15256 #[serde(default)]
15257 pub by_ref: Option<Box<Expression>>,
15258}
15259
15260#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15262#[cfg_attr(feature = "bindings", derive(TS))]
15263pub struct XMLKeyValueOption {
15264 pub this: Box<Expression>,
15265 #[serde(default)]
15266 pub expression: Option<Box<Expression>>,
15267}
15268
15269#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15271#[cfg_attr(feature = "bindings", derive(TS))]
15272pub struct Zipf {
15273 pub this: Box<Expression>,
15274 #[serde(default)]
15275 pub elementcount: Option<Box<Expression>>,
15276 #[serde(default)]
15277 pub gen: Option<Box<Expression>>,
15278}
15279
15280#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15282#[cfg_attr(feature = "bindings", derive(TS))]
15283pub struct Merge {
15284 pub this: Box<Expression>,
15285 pub using: Box<Expression>,
15286 #[serde(default)]
15287 pub on: Option<Box<Expression>>,
15288 #[serde(default)]
15289 pub using_cond: Option<Box<Expression>>,
15290 #[serde(default)]
15291 pub whens: Option<Box<Expression>>,
15292 #[serde(default)]
15293 pub with_: Option<Box<Expression>>,
15294 #[serde(default)]
15295 pub returning: Option<Box<Expression>>,
15296}
15297
15298#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15300#[cfg_attr(feature = "bindings", derive(TS))]
15301pub struct When {
15302 #[serde(default)]
15303 pub matched: Option<Box<Expression>>,
15304 #[serde(default)]
15305 pub source: Option<Box<Expression>>,
15306 #[serde(default)]
15307 pub condition: Option<Box<Expression>>,
15308 pub then: Box<Expression>,
15309}
15310
15311#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15313#[cfg_attr(feature = "bindings", derive(TS))]
15314pub struct Whens {
15315 #[serde(default)]
15316 pub expressions: Vec<Expression>,
15317}
15318
15319#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15321#[cfg_attr(feature = "bindings", derive(TS))]
15322pub struct NextValueFor {
15323 pub this: Box<Expression>,
15324 #[serde(default)]
15325 pub order: Option<Box<Expression>>,
15326}
15327
15328#[cfg(test)]
15329mod tests {
15330 use super::*;
15331
15332 #[test]
15333 #[cfg(feature = "bindings")]
15334 fn export_typescript_types() {
15335 Expression::export_all(&ts_rs::Config::default())
15338 .expect("Failed to export Expression types");
15339 }
15340
15341 #[test]
15342 fn test_simple_select_builder() {
15343 let select = Select::new()
15344 .column(Expression::star())
15345 .from(Expression::Table(Box::new(TableRef::new("users"))));
15346
15347 assert_eq!(select.expressions.len(), 1);
15348 assert!(select.from.is_some());
15349 }
15350
15351 #[test]
15352 fn test_expression_alias() {
15353 let expr = Expression::column("id").alias("user_id");
15354
15355 match expr {
15356 Expression::Alias(a) => {
15357 assert_eq!(a.alias.name, "user_id");
15358 }
15359 _ => panic!("Expected Alias"),
15360 }
15361 }
15362
15363 #[test]
15364 fn test_literal_creation() {
15365 let num = Expression::number(42);
15366 let str = Expression::string("hello");
15367
15368 match num {
15369 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
15370 let Literal::Number(n) = lit.as_ref() else {
15371 unreachable!()
15372 };
15373 assert_eq!(n, "42")
15374 }
15375 _ => panic!("Expected Number"),
15376 }
15377
15378 match str {
15379 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15380 let Literal::String(s) = lit.as_ref() else {
15381 unreachable!()
15382 };
15383 assert_eq!(s, "hello")
15384 }
15385 _ => panic!("Expected String"),
15386 }
15387 }
15388
15389 #[test]
15390 fn test_expression_sql() {
15391 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15392 assert_eq!(expr.sql(), "SELECT 1 + 2");
15393 }
15394
15395 #[test]
15396 fn test_expression_sql_for() {
15397 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15398 let sql = expr.sql_for(crate::DialectType::Generic);
15399 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15401 }
15402}