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::Dot(dot) => dot.inferred_type.as_ref(),
1322 Expression::Function(f) => f.inferred_type.as_ref(),
1323 Expression::AggregateFunction(f) => f.inferred_type.as_ref(),
1324 Expression::WindowFunction(f) => f.inferred_type.as_ref(),
1325 Expression::Case(c) => c.inferred_type.as_ref(),
1326 Expression::Subquery(s) => s.inferred_type.as_ref(),
1327 Expression::Alias(a) => a.inferred_type.as_ref(),
1328 Expression::Unnest(u) => u.inferred_type.as_ref(),
1329 Expression::IfFunc(f) => f.inferred_type.as_ref(),
1330 Expression::Nvl2(f) => f.inferred_type.as_ref(),
1331 Expression::Count(f) => f.inferred_type.as_ref(),
1332 Expression::GroupConcat(f) => f.inferred_type.as_ref(),
1333 Expression::StringAgg(f) => f.inferred_type.as_ref(),
1334 Expression::ListAgg(f) => f.inferred_type.as_ref(),
1335 Expression::SumIf(f) => f.inferred_type.as_ref(),
1336
1337 Expression::Upper(f)
1339 | Expression::Lower(f)
1340 | Expression::Length(f)
1341 | Expression::LTrim(f)
1342 | Expression::RTrim(f)
1343 | Expression::Reverse(f)
1344 | Expression::Abs(f)
1345 | Expression::Sqrt(f)
1346 | Expression::Cbrt(f)
1347 | Expression::Ln(f)
1348 | Expression::Exp(f)
1349 | Expression::Sign(f)
1350 | Expression::Date(f)
1351 | Expression::Time(f)
1352 | Expression::Initcap(f)
1353 | Expression::Ascii(f)
1354 | Expression::Chr(f)
1355 | Expression::Soundex(f)
1356 | Expression::ByteLength(f)
1357 | Expression::Hex(f)
1358 | Expression::LowerHex(f)
1359 | Expression::Unicode(f)
1360 | Expression::Typeof(f)
1361 | Expression::Explode(f)
1362 | Expression::ExplodeOuter(f)
1363 | Expression::MapFromEntries(f)
1364 | Expression::MapKeys(f)
1365 | Expression::MapValues(f)
1366 | Expression::ArrayLength(f)
1367 | Expression::ArraySize(f)
1368 | Expression::Cardinality(f)
1369 | Expression::ArrayReverse(f)
1370 | Expression::ArrayDistinct(f)
1371 | Expression::ArrayFlatten(f)
1372 | Expression::ArrayCompact(f)
1373 | Expression::ToArray(f)
1374 | Expression::JsonArrayLength(f)
1375 | Expression::JsonKeys(f)
1376 | Expression::JsonType(f)
1377 | Expression::ParseJson(f)
1378 | Expression::ToJson(f)
1379 | Expression::Radians(f)
1380 | Expression::Degrees(f)
1381 | Expression::Sin(f)
1382 | Expression::Cos(f)
1383 | Expression::Tan(f)
1384 | Expression::Asin(f)
1385 | Expression::Acos(f)
1386 | Expression::Atan(f)
1387 | Expression::IsNan(f)
1388 | Expression::IsInf(f)
1389 | Expression::Year(f)
1390 | Expression::Month(f)
1391 | Expression::Day(f)
1392 | Expression::Hour(f)
1393 | Expression::Minute(f)
1394 | Expression::Second(f)
1395 | Expression::DayOfWeek(f)
1396 | Expression::DayOfWeekIso(f)
1397 | Expression::DayOfMonth(f)
1398 | Expression::DayOfYear(f)
1399 | Expression::WeekOfYear(f)
1400 | Expression::Quarter(f)
1401 | Expression::Epoch(f)
1402 | Expression::EpochMs(f)
1403 | Expression::BitwiseCount(f)
1404 | Expression::DateFromUnixDate(f)
1405 | Expression::UnixDate(f)
1406 | Expression::UnixSeconds(f)
1407 | Expression::UnixMillis(f)
1408 | Expression::UnixMicros(f)
1409 | Expression::TimeStrToDate(f)
1410 | Expression::DateToDi(f)
1411 | Expression::DiToDate(f)
1412 | Expression::TsOrDiToDi(f)
1413 | Expression::TsOrDsToDatetime(f)
1414 | Expression::TsOrDsToTimestamp(f)
1415 | Expression::YearOfWeek(f)
1416 | Expression::YearOfWeekIso(f)
1417 | Expression::SHA(f)
1418 | Expression::SHA1Digest(f)
1419 | Expression::TimeToUnix(f)
1420 | Expression::TimeStrToUnix(f) => f.inferred_type.as_ref(),
1421
1422 Expression::Power(f)
1424 | Expression::NullIf(f)
1425 | Expression::IfNull(f)
1426 | Expression::Nvl(f)
1427 | Expression::Contains(f)
1428 | Expression::StartsWith(f)
1429 | Expression::EndsWith(f)
1430 | Expression::Levenshtein(f)
1431 | Expression::ModFunc(f)
1432 | Expression::IntDiv(f)
1433 | Expression::Atan2(f)
1434 | Expression::AddMonths(f)
1435 | Expression::MonthsBetween(f)
1436 | Expression::NextDay(f)
1437 | Expression::UnixToTimeStr(f)
1438 | Expression::ArrayContains(f)
1439 | Expression::ArrayPosition(f)
1440 | Expression::ArrayAppend(f)
1441 | Expression::ArrayPrepend(f)
1442 | Expression::ArrayUnion(f)
1443 | Expression::ArrayExcept(f)
1444 | Expression::ArrayRemove(f)
1445 | Expression::StarMap(f)
1446 | Expression::MapFromArrays(f)
1447 | Expression::MapContainsKey(f)
1448 | Expression::ElementAt(f)
1449 | Expression::JsonMergePatch(f) => f.inferred_type.as_ref(),
1450
1451 Expression::Coalesce(f)
1453 | Expression::Greatest(f)
1454 | Expression::Least(f)
1455 | Expression::ArrayConcat(f)
1456 | Expression::ArrayIntersect(f)
1457 | Expression::ArrayZip(f)
1458 | Expression::MapConcat(f)
1459 | Expression::JsonArray(f) => f.inferred_type.as_ref(),
1460
1461 Expression::Sum(f)
1463 | Expression::Avg(f)
1464 | Expression::Min(f)
1465 | Expression::Max(f)
1466 | Expression::ArrayAgg(f)
1467 | Expression::CountIf(f)
1468 | Expression::Stddev(f)
1469 | Expression::StddevPop(f)
1470 | Expression::StddevSamp(f)
1471 | Expression::Variance(f)
1472 | Expression::VarPop(f)
1473 | Expression::VarSamp(f)
1474 | Expression::Median(f)
1475 | Expression::Mode(f)
1476 | Expression::First(f)
1477 | Expression::Last(f)
1478 | Expression::AnyValue(f)
1479 | Expression::ApproxDistinct(f)
1480 | Expression::ApproxCountDistinct(f)
1481 | Expression::LogicalAnd(f)
1482 | Expression::LogicalOr(f)
1483 | Expression::Skewness(f)
1484 | Expression::ArrayConcatAgg(f)
1485 | Expression::ArrayUniqueAgg(f)
1486 | Expression::BoolXorAgg(f)
1487 | Expression::BitwiseAndAgg(f)
1488 | Expression::BitwiseOrAgg(f)
1489 | Expression::BitwiseXorAgg(f) => f.inferred_type.as_ref(),
1490
1491 _ => None,
1493 }
1494 }
1495
1496 pub fn set_inferred_type(&mut self, dt: DataType) {
1501 match self {
1502 Expression::And(op)
1503 | Expression::Or(op)
1504 | Expression::Add(op)
1505 | Expression::Sub(op)
1506 | Expression::Mul(op)
1507 | Expression::Div(op)
1508 | Expression::Mod(op)
1509 | Expression::Eq(op)
1510 | Expression::Neq(op)
1511 | Expression::Lt(op)
1512 | Expression::Lte(op)
1513 | Expression::Gt(op)
1514 | Expression::Gte(op)
1515 | Expression::Concat(op)
1516 | Expression::BitwiseAnd(op)
1517 | Expression::BitwiseOr(op)
1518 | Expression::BitwiseXor(op)
1519 | Expression::Adjacent(op)
1520 | Expression::TsMatch(op)
1521 | Expression::PropertyEQ(op)
1522 | Expression::ArrayContainsAll(op)
1523 | Expression::ArrayContainedBy(op)
1524 | Expression::ArrayOverlaps(op)
1525 | Expression::JSONBContainsAllTopKeys(op)
1526 | Expression::JSONBContainsAnyTopKeys(op)
1527 | Expression::JSONBDeleteAtPath(op)
1528 | Expression::ExtendsLeft(op)
1529 | Expression::ExtendsRight(op)
1530 | Expression::Is(op)
1531 | Expression::MemberOf(op)
1532 | Expression::Match(op)
1533 | Expression::NullSafeEq(op)
1534 | Expression::NullSafeNeq(op)
1535 | Expression::Glob(op)
1536 | Expression::BitwiseLeftShift(op)
1537 | Expression::BitwiseRightShift(op) => op.inferred_type = Some(dt),
1538
1539 Expression::Not(op) | Expression::Neg(op) | Expression::BitwiseNot(op) => {
1540 op.inferred_type = Some(dt)
1541 }
1542
1543 Expression::Like(op) | Expression::ILike(op) => op.inferred_type = Some(dt),
1544
1545 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
1546 c.inferred_type = Some(dt)
1547 }
1548
1549 Expression::Column(c) => c.inferred_type = Some(dt),
1550 Expression::Dot(dot) => dot.inferred_type = Some(dt),
1551 Expression::Function(f) => f.inferred_type = Some(dt),
1552 Expression::AggregateFunction(f) => f.inferred_type = Some(dt),
1553 Expression::WindowFunction(f) => f.inferred_type = Some(dt),
1554 Expression::Case(c) => c.inferred_type = Some(dt),
1555 Expression::Subquery(s) => s.inferred_type = Some(dt),
1556 Expression::Alias(a) => a.inferred_type = Some(dt),
1557 Expression::Unnest(u) => u.inferred_type = Some(dt),
1558 Expression::IfFunc(f) => f.inferred_type = Some(dt),
1559 Expression::Nvl2(f) => f.inferred_type = Some(dt),
1560 Expression::Count(f) => f.inferred_type = Some(dt),
1561 Expression::GroupConcat(f) => f.inferred_type = Some(dt),
1562 Expression::StringAgg(f) => f.inferred_type = Some(dt),
1563 Expression::ListAgg(f) => f.inferred_type = Some(dt),
1564 Expression::SumIf(f) => f.inferred_type = Some(dt),
1565
1566 Expression::Upper(f)
1568 | Expression::Lower(f)
1569 | Expression::Length(f)
1570 | Expression::LTrim(f)
1571 | Expression::RTrim(f)
1572 | Expression::Reverse(f)
1573 | Expression::Abs(f)
1574 | Expression::Sqrt(f)
1575 | Expression::Cbrt(f)
1576 | Expression::Ln(f)
1577 | Expression::Exp(f)
1578 | Expression::Sign(f)
1579 | Expression::Date(f)
1580 | Expression::Time(f)
1581 | Expression::Initcap(f)
1582 | Expression::Ascii(f)
1583 | Expression::Chr(f)
1584 | Expression::Soundex(f)
1585 | Expression::ByteLength(f)
1586 | Expression::Hex(f)
1587 | Expression::LowerHex(f)
1588 | Expression::Unicode(f)
1589 | Expression::Typeof(f)
1590 | Expression::Explode(f)
1591 | Expression::ExplodeOuter(f)
1592 | Expression::MapFromEntries(f)
1593 | Expression::MapKeys(f)
1594 | Expression::MapValues(f)
1595 | Expression::ArrayLength(f)
1596 | Expression::ArraySize(f)
1597 | Expression::Cardinality(f)
1598 | Expression::ArrayReverse(f)
1599 | Expression::ArrayDistinct(f)
1600 | Expression::ArrayFlatten(f)
1601 | Expression::ArrayCompact(f)
1602 | Expression::ToArray(f)
1603 | Expression::JsonArrayLength(f)
1604 | Expression::JsonKeys(f)
1605 | Expression::JsonType(f)
1606 | Expression::ParseJson(f)
1607 | Expression::ToJson(f)
1608 | Expression::Radians(f)
1609 | Expression::Degrees(f)
1610 | Expression::Sin(f)
1611 | Expression::Cos(f)
1612 | Expression::Tan(f)
1613 | Expression::Asin(f)
1614 | Expression::Acos(f)
1615 | Expression::Atan(f)
1616 | Expression::IsNan(f)
1617 | Expression::IsInf(f)
1618 | Expression::Year(f)
1619 | Expression::Month(f)
1620 | Expression::Day(f)
1621 | Expression::Hour(f)
1622 | Expression::Minute(f)
1623 | Expression::Second(f)
1624 | Expression::DayOfWeek(f)
1625 | Expression::DayOfWeekIso(f)
1626 | Expression::DayOfMonth(f)
1627 | Expression::DayOfYear(f)
1628 | Expression::WeekOfYear(f)
1629 | Expression::Quarter(f)
1630 | Expression::Epoch(f)
1631 | Expression::EpochMs(f)
1632 | Expression::BitwiseCount(f)
1633 | Expression::DateFromUnixDate(f)
1634 | Expression::UnixDate(f)
1635 | Expression::UnixSeconds(f)
1636 | Expression::UnixMillis(f)
1637 | Expression::UnixMicros(f)
1638 | Expression::TimeStrToDate(f)
1639 | Expression::DateToDi(f)
1640 | Expression::DiToDate(f)
1641 | Expression::TsOrDiToDi(f)
1642 | Expression::TsOrDsToDatetime(f)
1643 | Expression::TsOrDsToTimestamp(f)
1644 | Expression::YearOfWeek(f)
1645 | Expression::YearOfWeekIso(f)
1646 | Expression::SHA(f)
1647 | Expression::SHA1Digest(f)
1648 | Expression::TimeToUnix(f)
1649 | Expression::TimeStrToUnix(f) => f.inferred_type = Some(dt),
1650
1651 Expression::Power(f)
1653 | Expression::NullIf(f)
1654 | Expression::IfNull(f)
1655 | Expression::Nvl(f)
1656 | Expression::Contains(f)
1657 | Expression::StartsWith(f)
1658 | Expression::EndsWith(f)
1659 | Expression::Levenshtein(f)
1660 | Expression::ModFunc(f)
1661 | Expression::IntDiv(f)
1662 | Expression::Atan2(f)
1663 | Expression::AddMonths(f)
1664 | Expression::MonthsBetween(f)
1665 | Expression::NextDay(f)
1666 | Expression::UnixToTimeStr(f)
1667 | Expression::ArrayContains(f)
1668 | Expression::ArrayPosition(f)
1669 | Expression::ArrayAppend(f)
1670 | Expression::ArrayPrepend(f)
1671 | Expression::ArrayUnion(f)
1672 | Expression::ArrayExcept(f)
1673 | Expression::ArrayRemove(f)
1674 | Expression::StarMap(f)
1675 | Expression::MapFromArrays(f)
1676 | Expression::MapContainsKey(f)
1677 | Expression::ElementAt(f)
1678 | Expression::JsonMergePatch(f) => f.inferred_type = Some(dt),
1679
1680 Expression::Coalesce(f)
1682 | Expression::Greatest(f)
1683 | Expression::Least(f)
1684 | Expression::ArrayConcat(f)
1685 | Expression::ArrayIntersect(f)
1686 | Expression::ArrayZip(f)
1687 | Expression::MapConcat(f)
1688 | Expression::JsonArray(f) => f.inferred_type = Some(dt),
1689
1690 Expression::Sum(f)
1692 | Expression::Avg(f)
1693 | Expression::Min(f)
1694 | Expression::Max(f)
1695 | Expression::ArrayAgg(f)
1696 | Expression::CountIf(f)
1697 | Expression::Stddev(f)
1698 | Expression::StddevPop(f)
1699 | Expression::StddevSamp(f)
1700 | Expression::Variance(f)
1701 | Expression::VarPop(f)
1702 | Expression::VarSamp(f)
1703 | Expression::Median(f)
1704 | Expression::Mode(f)
1705 | Expression::First(f)
1706 | Expression::Last(f)
1707 | Expression::AnyValue(f)
1708 | Expression::ApproxDistinct(f)
1709 | Expression::ApproxCountDistinct(f)
1710 | Expression::LogicalAnd(f)
1711 | Expression::LogicalOr(f)
1712 | Expression::Skewness(f)
1713 | Expression::ArrayConcatAgg(f)
1714 | Expression::ArrayUniqueAgg(f)
1715 | Expression::BoolXorAgg(f)
1716 | Expression::BitwiseAndAgg(f)
1717 | Expression::BitwiseOrAgg(f)
1718 | Expression::BitwiseXorAgg(f) => f.inferred_type = Some(dt),
1719
1720 _ => {}
1722 }
1723 }
1724
1725 pub fn column(name: impl Into<String>) -> Self {
1727 Expression::Column(Box::new(Column {
1728 name: Identifier::new(name),
1729 table: None,
1730 join_mark: false,
1731 trailing_comments: Vec::new(),
1732 span: None,
1733 inferred_type: None,
1734 }))
1735 }
1736
1737 pub fn qualified_column(table: impl Into<String>, column: impl Into<String>) -> Self {
1739 Expression::Column(Box::new(Column {
1740 name: Identifier::new(column),
1741 table: Some(Identifier::new(table)),
1742 join_mark: false,
1743 trailing_comments: Vec::new(),
1744 span: None,
1745 inferred_type: None,
1746 }))
1747 }
1748
1749 pub fn identifier(name: impl Into<String>) -> Self {
1751 Expression::Identifier(Identifier::new(name))
1752 }
1753
1754 pub fn null() -> Self {
1756 Expression::Null(Null)
1757 }
1758
1759 pub fn true_() -> Self {
1761 Expression::Boolean(BooleanLiteral { value: true })
1762 }
1763
1764 pub fn false_() -> Self {
1766 Expression::Boolean(BooleanLiteral { value: false })
1767 }
1768
1769 pub fn star() -> Self {
1771 Expression::Star(Star {
1772 table: None,
1773 except: None,
1774 replace: None,
1775 rename: None,
1776 trailing_comments: Vec::new(),
1777 span: None,
1778 })
1779 }
1780
1781 pub fn alias(self, name: impl Into<String>) -> Self {
1783 Expression::Alias(Box::new(Alias::new(self, Identifier::new(name))))
1784 }
1785
1786 pub fn is_select(&self) -> bool {
1788 matches!(self, Expression::Select(_))
1789 }
1790
1791 pub fn as_select(&self) -> Option<&Select> {
1793 match self {
1794 Expression::Select(s) => Some(s),
1795 _ => None,
1796 }
1797 }
1798
1799 pub fn as_select_mut(&mut self) -> Option<&mut Select> {
1801 match self {
1802 Expression::Select(s) => Some(s),
1803 _ => None,
1804 }
1805 }
1806
1807 #[cfg(feature = "generate")]
1812 pub fn sql(&self) -> String {
1813 crate::generator::Generator::sql(self).unwrap_or_default()
1814 }
1815
1816 #[cfg(feature = "generate")]
1822 pub fn sql_for(&self, dialect: crate::dialects::DialectType) -> String {
1823 crate::generate(self, dialect).unwrap_or_default()
1824 }
1825}
1826
1827impl Expression {
1830 pub fn variant_name(&self) -> &'static str {
1833 match self {
1834 Expression::Literal(_) => "literal",
1835 Expression::Boolean(_) => "boolean",
1836 Expression::Null(_) => "null",
1837 Expression::Identifier(_) => "identifier",
1838 Expression::Column(_) => "column",
1839 Expression::Table(_) => "table",
1840 Expression::Star(_) => "star",
1841 Expression::BracedWildcard(_) => "braced_wildcard",
1842 Expression::Select(_) => "select",
1843 Expression::Union(_) => "union",
1844 Expression::Intersect(_) => "intersect",
1845 Expression::Except(_) => "except",
1846 Expression::Subquery(_) => "subquery",
1847 Expression::PipeOperator(_) => "pipe_operator",
1848 Expression::Pivot(_) => "pivot",
1849 Expression::PivotAlias(_) => "pivot_alias",
1850 Expression::Unpivot(_) => "unpivot",
1851 Expression::Values(_) => "values",
1852 Expression::PreWhere(_) => "pre_where",
1853 Expression::Stream(_) => "stream",
1854 Expression::UsingData(_) => "using_data",
1855 Expression::XmlNamespace(_) => "xml_namespace",
1856 Expression::Insert(_) => "insert",
1857 Expression::Update(_) => "update",
1858 Expression::Delete(_) => "delete",
1859 Expression::Copy(_) => "copy",
1860 Expression::Put(_) => "put",
1861 Expression::StageReference(_) => "stage_reference",
1862 Expression::Alias(_) => "alias",
1863 Expression::Cast(_) => "cast",
1864 Expression::Collation(_) => "collation",
1865 Expression::Case(_) => "case",
1866 Expression::And(_) => "and",
1867 Expression::Or(_) => "or",
1868 Expression::Add(_) => "add",
1869 Expression::Sub(_) => "sub",
1870 Expression::Mul(_) => "mul",
1871 Expression::Div(_) => "div",
1872 Expression::Mod(_) => "mod",
1873 Expression::Eq(_) => "eq",
1874 Expression::Neq(_) => "neq",
1875 Expression::Lt(_) => "lt",
1876 Expression::Lte(_) => "lte",
1877 Expression::Gt(_) => "gt",
1878 Expression::Gte(_) => "gte",
1879 Expression::Like(_) => "like",
1880 Expression::ILike(_) => "i_like",
1881 Expression::Match(_) => "match",
1882 Expression::BitwiseAnd(_) => "bitwise_and",
1883 Expression::BitwiseOr(_) => "bitwise_or",
1884 Expression::BitwiseXor(_) => "bitwise_xor",
1885 Expression::Concat(_) => "concat",
1886 Expression::Adjacent(_) => "adjacent",
1887 Expression::TsMatch(_) => "ts_match",
1888 Expression::PropertyEQ(_) => "property_e_q",
1889 Expression::ArrayContainsAll(_) => "array_contains_all",
1890 Expression::ArrayContainedBy(_) => "array_contained_by",
1891 Expression::ArrayOverlaps(_) => "array_overlaps",
1892 Expression::JSONBContainsAllTopKeys(_) => "j_s_o_n_b_contains_all_top_keys",
1893 Expression::JSONBContainsAnyTopKeys(_) => "j_s_o_n_b_contains_any_top_keys",
1894 Expression::JSONBDeleteAtPath(_) => "j_s_o_n_b_delete_at_path",
1895 Expression::ExtendsLeft(_) => "extends_left",
1896 Expression::ExtendsRight(_) => "extends_right",
1897 Expression::Not(_) => "not",
1898 Expression::Neg(_) => "neg",
1899 Expression::BitwiseNot(_) => "bitwise_not",
1900 Expression::In(_) => "in",
1901 Expression::Between(_) => "between",
1902 Expression::IsNull(_) => "is_null",
1903 Expression::IsTrue(_) => "is_true",
1904 Expression::IsFalse(_) => "is_false",
1905 Expression::IsJson(_) => "is_json",
1906 Expression::Is(_) => "is",
1907 Expression::Exists(_) => "exists",
1908 Expression::MemberOf(_) => "member_of",
1909 Expression::Function(_) => "function",
1910 Expression::AggregateFunction(_) => "aggregate_function",
1911 Expression::WindowFunction(_) => "window_function",
1912 Expression::From(_) => "from",
1913 Expression::Join(_) => "join",
1914 Expression::JoinedTable(_) => "joined_table",
1915 Expression::Where(_) => "where",
1916 Expression::GroupBy(_) => "group_by",
1917 Expression::Having(_) => "having",
1918 Expression::OrderBy(_) => "order_by",
1919 Expression::Limit(_) => "limit",
1920 Expression::Offset(_) => "offset",
1921 Expression::Qualify(_) => "qualify",
1922 Expression::With(_) => "with",
1923 Expression::Cte(_) => "cte",
1924 Expression::DistributeBy(_) => "distribute_by",
1925 Expression::ClusterBy(_) => "cluster_by",
1926 Expression::SortBy(_) => "sort_by",
1927 Expression::LateralView(_) => "lateral_view",
1928 Expression::Hint(_) => "hint",
1929 Expression::Pseudocolumn(_) => "pseudocolumn",
1930 Expression::Connect(_) => "connect",
1931 Expression::Prior(_) => "prior",
1932 Expression::ConnectByRoot(_) => "connect_by_root",
1933 Expression::MatchRecognize(_) => "match_recognize",
1934 Expression::Ordered(_) => "ordered",
1935 Expression::Window(_) => "window",
1936 Expression::Over(_) => "over",
1937 Expression::WithinGroup(_) => "within_group",
1938 Expression::DataType(_) => "data_type",
1939 Expression::Array(_) => "array",
1940 Expression::Struct(_) => "struct",
1941 Expression::Tuple(_) => "tuple",
1942 Expression::Interval(_) => "interval",
1943 Expression::ConcatWs(_) => "concat_ws",
1944 Expression::Substring(_) => "substring",
1945 Expression::Upper(_) => "upper",
1946 Expression::Lower(_) => "lower",
1947 Expression::Length(_) => "length",
1948 Expression::Trim(_) => "trim",
1949 Expression::LTrim(_) => "l_trim",
1950 Expression::RTrim(_) => "r_trim",
1951 Expression::Replace(_) => "replace",
1952 Expression::Reverse(_) => "reverse",
1953 Expression::Left(_) => "left",
1954 Expression::Right(_) => "right",
1955 Expression::Repeat(_) => "repeat",
1956 Expression::Lpad(_) => "lpad",
1957 Expression::Rpad(_) => "rpad",
1958 Expression::Split(_) => "split",
1959 Expression::RegexpLike(_) => "regexp_like",
1960 Expression::RegexpReplace(_) => "regexp_replace",
1961 Expression::RegexpExtract(_) => "regexp_extract",
1962 Expression::Overlay(_) => "overlay",
1963 Expression::Abs(_) => "abs",
1964 Expression::Round(_) => "round",
1965 Expression::Floor(_) => "floor",
1966 Expression::Ceil(_) => "ceil",
1967 Expression::Power(_) => "power",
1968 Expression::Sqrt(_) => "sqrt",
1969 Expression::Cbrt(_) => "cbrt",
1970 Expression::Ln(_) => "ln",
1971 Expression::Log(_) => "log",
1972 Expression::Exp(_) => "exp",
1973 Expression::Sign(_) => "sign",
1974 Expression::Greatest(_) => "greatest",
1975 Expression::Least(_) => "least",
1976 Expression::CurrentDate(_) => "current_date",
1977 Expression::CurrentTime(_) => "current_time",
1978 Expression::CurrentTimestamp(_) => "current_timestamp",
1979 Expression::CurrentTimestampLTZ(_) => "current_timestamp_l_t_z",
1980 Expression::AtTimeZone(_) => "at_time_zone",
1981 Expression::DateAdd(_) => "date_add",
1982 Expression::DateSub(_) => "date_sub",
1983 Expression::DateDiff(_) => "date_diff",
1984 Expression::DateTrunc(_) => "date_trunc",
1985 Expression::Extract(_) => "extract",
1986 Expression::ToDate(_) => "to_date",
1987 Expression::ToTimestamp(_) => "to_timestamp",
1988 Expression::Date(_) => "date",
1989 Expression::Time(_) => "time",
1990 Expression::DateFromUnixDate(_) => "date_from_unix_date",
1991 Expression::UnixDate(_) => "unix_date",
1992 Expression::UnixSeconds(_) => "unix_seconds",
1993 Expression::UnixMillis(_) => "unix_millis",
1994 Expression::UnixMicros(_) => "unix_micros",
1995 Expression::UnixToTimeStr(_) => "unix_to_time_str",
1996 Expression::TimeStrToDate(_) => "time_str_to_date",
1997 Expression::DateToDi(_) => "date_to_di",
1998 Expression::DiToDate(_) => "di_to_date",
1999 Expression::TsOrDiToDi(_) => "ts_or_di_to_di",
2000 Expression::TsOrDsToDatetime(_) => "ts_or_ds_to_datetime",
2001 Expression::TsOrDsToTimestamp(_) => "ts_or_ds_to_timestamp",
2002 Expression::YearOfWeek(_) => "year_of_week",
2003 Expression::YearOfWeekIso(_) => "year_of_week_iso",
2004 Expression::Coalesce(_) => "coalesce",
2005 Expression::NullIf(_) => "null_if",
2006 Expression::IfFunc(_) => "if_func",
2007 Expression::IfNull(_) => "if_null",
2008 Expression::Nvl(_) => "nvl",
2009 Expression::Nvl2(_) => "nvl2",
2010 Expression::TryCast(_) => "try_cast",
2011 Expression::SafeCast(_) => "safe_cast",
2012 Expression::Count(_) => "count",
2013 Expression::Sum(_) => "sum",
2014 Expression::Avg(_) => "avg",
2015 Expression::Min(_) => "min",
2016 Expression::Max(_) => "max",
2017 Expression::GroupConcat(_) => "group_concat",
2018 Expression::StringAgg(_) => "string_agg",
2019 Expression::ListAgg(_) => "list_agg",
2020 Expression::ArrayAgg(_) => "array_agg",
2021 Expression::CountIf(_) => "count_if",
2022 Expression::SumIf(_) => "sum_if",
2023 Expression::Stddev(_) => "stddev",
2024 Expression::StddevPop(_) => "stddev_pop",
2025 Expression::StddevSamp(_) => "stddev_samp",
2026 Expression::Variance(_) => "variance",
2027 Expression::VarPop(_) => "var_pop",
2028 Expression::VarSamp(_) => "var_samp",
2029 Expression::Median(_) => "median",
2030 Expression::Mode(_) => "mode",
2031 Expression::First(_) => "first",
2032 Expression::Last(_) => "last",
2033 Expression::AnyValue(_) => "any_value",
2034 Expression::ApproxDistinct(_) => "approx_distinct",
2035 Expression::ApproxCountDistinct(_) => "approx_count_distinct",
2036 Expression::ApproxPercentile(_) => "approx_percentile",
2037 Expression::Percentile(_) => "percentile",
2038 Expression::LogicalAnd(_) => "logical_and",
2039 Expression::LogicalOr(_) => "logical_or",
2040 Expression::Skewness(_) => "skewness",
2041 Expression::BitwiseCount(_) => "bitwise_count",
2042 Expression::ArrayConcatAgg(_) => "array_concat_agg",
2043 Expression::ArrayUniqueAgg(_) => "array_unique_agg",
2044 Expression::BoolXorAgg(_) => "bool_xor_agg",
2045 Expression::RowNumber(_) => "row_number",
2046 Expression::Rank(_) => "rank",
2047 Expression::DenseRank(_) => "dense_rank",
2048 Expression::NTile(_) => "n_tile",
2049 Expression::Lead(_) => "lead",
2050 Expression::Lag(_) => "lag",
2051 Expression::FirstValue(_) => "first_value",
2052 Expression::LastValue(_) => "last_value",
2053 Expression::NthValue(_) => "nth_value",
2054 Expression::PercentRank(_) => "percent_rank",
2055 Expression::CumeDist(_) => "cume_dist",
2056 Expression::PercentileCont(_) => "percentile_cont",
2057 Expression::PercentileDisc(_) => "percentile_disc",
2058 Expression::Contains(_) => "contains",
2059 Expression::StartsWith(_) => "starts_with",
2060 Expression::EndsWith(_) => "ends_with",
2061 Expression::Position(_) => "position",
2062 Expression::Initcap(_) => "initcap",
2063 Expression::Ascii(_) => "ascii",
2064 Expression::Chr(_) => "chr",
2065 Expression::CharFunc(_) => "char_func",
2066 Expression::Soundex(_) => "soundex",
2067 Expression::Levenshtein(_) => "levenshtein",
2068 Expression::ByteLength(_) => "byte_length",
2069 Expression::Hex(_) => "hex",
2070 Expression::LowerHex(_) => "lower_hex",
2071 Expression::Unicode(_) => "unicode",
2072 Expression::ModFunc(_) => "mod_func",
2073 Expression::Random(_) => "random",
2074 Expression::Rand(_) => "rand",
2075 Expression::TruncFunc(_) => "trunc_func",
2076 Expression::Pi(_) => "pi",
2077 Expression::Radians(_) => "radians",
2078 Expression::Degrees(_) => "degrees",
2079 Expression::Sin(_) => "sin",
2080 Expression::Cos(_) => "cos",
2081 Expression::Tan(_) => "tan",
2082 Expression::Asin(_) => "asin",
2083 Expression::Acos(_) => "acos",
2084 Expression::Atan(_) => "atan",
2085 Expression::Atan2(_) => "atan2",
2086 Expression::IsNan(_) => "is_nan",
2087 Expression::IsInf(_) => "is_inf",
2088 Expression::IntDiv(_) => "int_div",
2089 Expression::Decode(_) => "decode",
2090 Expression::DateFormat(_) => "date_format",
2091 Expression::FormatDate(_) => "format_date",
2092 Expression::Year(_) => "year",
2093 Expression::Month(_) => "month",
2094 Expression::Day(_) => "day",
2095 Expression::Hour(_) => "hour",
2096 Expression::Minute(_) => "minute",
2097 Expression::Second(_) => "second",
2098 Expression::DayOfWeek(_) => "day_of_week",
2099 Expression::DayOfWeekIso(_) => "day_of_week_iso",
2100 Expression::DayOfMonth(_) => "day_of_month",
2101 Expression::DayOfYear(_) => "day_of_year",
2102 Expression::WeekOfYear(_) => "week_of_year",
2103 Expression::Quarter(_) => "quarter",
2104 Expression::AddMonths(_) => "add_months",
2105 Expression::MonthsBetween(_) => "months_between",
2106 Expression::LastDay(_) => "last_day",
2107 Expression::NextDay(_) => "next_day",
2108 Expression::Epoch(_) => "epoch",
2109 Expression::EpochMs(_) => "epoch_ms",
2110 Expression::FromUnixtime(_) => "from_unixtime",
2111 Expression::UnixTimestamp(_) => "unix_timestamp",
2112 Expression::MakeDate(_) => "make_date",
2113 Expression::MakeTimestamp(_) => "make_timestamp",
2114 Expression::TimestampTrunc(_) => "timestamp_trunc",
2115 Expression::TimeStrToUnix(_) => "time_str_to_unix",
2116 Expression::SessionUser(_) => "session_user",
2117 Expression::SHA(_) => "s_h_a",
2118 Expression::SHA1Digest(_) => "s_h_a1_digest",
2119 Expression::TimeToUnix(_) => "time_to_unix",
2120 Expression::ArrayFunc(_) => "array_func",
2121 Expression::ArrayLength(_) => "array_length",
2122 Expression::ArraySize(_) => "array_size",
2123 Expression::Cardinality(_) => "cardinality",
2124 Expression::ArrayContains(_) => "array_contains",
2125 Expression::ArrayPosition(_) => "array_position",
2126 Expression::ArrayAppend(_) => "array_append",
2127 Expression::ArrayPrepend(_) => "array_prepend",
2128 Expression::ArrayConcat(_) => "array_concat",
2129 Expression::ArraySort(_) => "array_sort",
2130 Expression::ArrayReverse(_) => "array_reverse",
2131 Expression::ArrayDistinct(_) => "array_distinct",
2132 Expression::ArrayJoin(_) => "array_join",
2133 Expression::ArrayToString(_) => "array_to_string",
2134 Expression::Unnest(_) => "unnest",
2135 Expression::Explode(_) => "explode",
2136 Expression::ExplodeOuter(_) => "explode_outer",
2137 Expression::ArrayFilter(_) => "array_filter",
2138 Expression::ArrayTransform(_) => "array_transform",
2139 Expression::ArrayFlatten(_) => "array_flatten",
2140 Expression::ArrayCompact(_) => "array_compact",
2141 Expression::ArrayIntersect(_) => "array_intersect",
2142 Expression::ArrayUnion(_) => "array_union",
2143 Expression::ArrayExcept(_) => "array_except",
2144 Expression::ArrayRemove(_) => "array_remove",
2145 Expression::ArrayZip(_) => "array_zip",
2146 Expression::Sequence(_) => "sequence",
2147 Expression::Generate(_) => "generate",
2148 Expression::ExplodingGenerateSeries(_) => "exploding_generate_series",
2149 Expression::ToArray(_) => "to_array",
2150 Expression::StarMap(_) => "star_map",
2151 Expression::StructFunc(_) => "struct_func",
2152 Expression::StructExtract(_) => "struct_extract",
2153 Expression::NamedStruct(_) => "named_struct",
2154 Expression::MapFunc(_) => "map_func",
2155 Expression::MapFromEntries(_) => "map_from_entries",
2156 Expression::MapFromArrays(_) => "map_from_arrays",
2157 Expression::MapKeys(_) => "map_keys",
2158 Expression::MapValues(_) => "map_values",
2159 Expression::MapContainsKey(_) => "map_contains_key",
2160 Expression::MapConcat(_) => "map_concat",
2161 Expression::ElementAt(_) => "element_at",
2162 Expression::TransformKeys(_) => "transform_keys",
2163 Expression::TransformValues(_) => "transform_values",
2164 Expression::FunctionEmits(_) => "function_emits",
2165 Expression::JsonExtract(_) => "json_extract",
2166 Expression::JsonExtractScalar(_) => "json_extract_scalar",
2167 Expression::JsonExtractPath(_) => "json_extract_path",
2168 Expression::JsonArray(_) => "json_array",
2169 Expression::JsonObject(_) => "json_object",
2170 Expression::JsonQuery(_) => "json_query",
2171 Expression::JsonValue(_) => "json_value",
2172 Expression::JsonArrayLength(_) => "json_array_length",
2173 Expression::JsonKeys(_) => "json_keys",
2174 Expression::JsonType(_) => "json_type",
2175 Expression::ParseJson(_) => "parse_json",
2176 Expression::ToJson(_) => "to_json",
2177 Expression::JsonSet(_) => "json_set",
2178 Expression::JsonInsert(_) => "json_insert",
2179 Expression::JsonRemove(_) => "json_remove",
2180 Expression::JsonMergePatch(_) => "json_merge_patch",
2181 Expression::JsonArrayAgg(_) => "json_array_agg",
2182 Expression::JsonObjectAgg(_) => "json_object_agg",
2183 Expression::Convert(_) => "convert",
2184 Expression::Typeof(_) => "typeof",
2185 Expression::Lambda(_) => "lambda",
2186 Expression::Parameter(_) => "parameter",
2187 Expression::Placeholder(_) => "placeholder",
2188 Expression::NamedArgument(_) => "named_argument",
2189 Expression::TableArgument(_) => "table_argument",
2190 Expression::SqlComment(_) => "sql_comment",
2191 Expression::NullSafeEq(_) => "null_safe_eq",
2192 Expression::NullSafeNeq(_) => "null_safe_neq",
2193 Expression::Glob(_) => "glob",
2194 Expression::SimilarTo(_) => "similar_to",
2195 Expression::Any(_) => "any",
2196 Expression::All(_) => "all",
2197 Expression::Overlaps(_) => "overlaps",
2198 Expression::BitwiseLeftShift(_) => "bitwise_left_shift",
2199 Expression::BitwiseRightShift(_) => "bitwise_right_shift",
2200 Expression::BitwiseAndAgg(_) => "bitwise_and_agg",
2201 Expression::BitwiseOrAgg(_) => "bitwise_or_agg",
2202 Expression::BitwiseXorAgg(_) => "bitwise_xor_agg",
2203 Expression::Subscript(_) => "subscript",
2204 Expression::Dot(_) => "dot",
2205 Expression::MethodCall(_) => "method_call",
2206 Expression::ArraySlice(_) => "array_slice",
2207 Expression::CreateTable(_) => "create_table",
2208 Expression::DropTable(_) => "drop_table",
2209 Expression::Undrop(_) => "undrop",
2210 Expression::AlterTable(_) => "alter_table",
2211 Expression::SplitTable(_) => "split_table",
2212 Expression::FlashbackTable(_) => "flashback_table",
2213 Expression::CreateIndex(_) => "create_index",
2214 Expression::DropIndex(_) => "drop_index",
2215 Expression::CreateView(_) => "create_view",
2216 Expression::DropView(_) => "drop_view",
2217 Expression::AlterView(_) => "alter_view",
2218 Expression::AlterIndex(_) => "alter_index",
2219 Expression::Truncate(_) => "truncate",
2220 Expression::Use(_) => "use",
2221 Expression::Cache(_) => "cache",
2222 Expression::Uncache(_) => "uncache",
2223 Expression::LoadData(_) => "load_data",
2224 Expression::Pragma(_) => "pragma",
2225 Expression::Grant(_) => "grant",
2226 Expression::Revoke(_) => "revoke",
2227 Expression::Comment(_) => "comment",
2228 Expression::SetStatement(_) => "set_statement",
2229 Expression::CreateSchema(_) => "create_schema",
2230 Expression::DropSchema(_) => "drop_schema",
2231 Expression::DropNamespace(_) => "drop_namespace",
2232 Expression::CreateDatabase(_) => "create_database",
2233 Expression::DropDatabase(_) => "drop_database",
2234 Expression::CreateFunction(_) => "create_function",
2235 Expression::DropFunction(_) => "drop_function",
2236 Expression::CreateProcedure(_) => "create_procedure",
2237 Expression::DropProcedure(_) => "drop_procedure",
2238 Expression::CreateSequence(_) => "create_sequence",
2239 Expression::CreateSynonym(_) => "create_synonym",
2240 Expression::DropSequence(_) => "drop_sequence",
2241 Expression::AlterSequence(_) => "alter_sequence",
2242 Expression::CreateTrigger(_) => "create_trigger",
2243 Expression::DropTrigger(_) => "drop_trigger",
2244 Expression::CreateType(_) => "create_type",
2245 Expression::DropType(_) => "drop_type",
2246 Expression::Describe(_) => "describe",
2247 Expression::Show(_) => "show",
2248 Expression::Command(_) => "command",
2249 Expression::TryCatch(_) => "try_catch",
2250 Expression::Kill(_) => "kill",
2251 Expression::Prepare(_) => "prepare",
2252 Expression::Execute(_) => "execute",
2253 Expression::Raw(_) => "raw",
2254 Expression::CreateTask(_) => "create_task",
2255 Expression::Paren(_) => "paren",
2256 Expression::Annotated(_) => "annotated",
2257 Expression::Refresh(_) => "refresh",
2258 Expression::LockingStatement(_) => "locking_statement",
2259 Expression::SequenceProperties(_) => "sequence_properties",
2260 Expression::TruncateTable(_) => "truncate_table",
2261 Expression::Clone(_) => "clone",
2262 Expression::Attach(_) => "attach",
2263 Expression::Detach(_) => "detach",
2264 Expression::Install(_) => "install",
2265 Expression::Summarize(_) => "summarize",
2266 Expression::Declare(_) => "declare",
2267 Expression::DeclareItem(_) => "declare_item",
2268 Expression::Set(_) => "set",
2269 Expression::Heredoc(_) => "heredoc",
2270 Expression::SetItem(_) => "set_item",
2271 Expression::QueryBand(_) => "query_band",
2272 Expression::UserDefinedFunction(_) => "user_defined_function",
2273 Expression::RecursiveWithSearch(_) => "recursive_with_search",
2274 Expression::ProjectionDef(_) => "projection_def",
2275 Expression::TableAlias(_) => "table_alias",
2276 Expression::ByteString(_) => "byte_string",
2277 Expression::HexStringExpr(_) => "hex_string_expr",
2278 Expression::UnicodeString(_) => "unicode_string",
2279 Expression::ColumnPosition(_) => "column_position",
2280 Expression::ColumnDef(_) => "column_def",
2281 Expression::AlterColumn(_) => "alter_column",
2282 Expression::AlterSortKey(_) => "alter_sort_key",
2283 Expression::AlterSet(_) => "alter_set",
2284 Expression::RenameColumn(_) => "rename_column",
2285 Expression::Comprehension(_) => "comprehension",
2286 Expression::MergeTreeTTLAction(_) => "merge_tree_t_t_l_action",
2287 Expression::MergeTreeTTL(_) => "merge_tree_t_t_l",
2288 Expression::IndexConstraintOption(_) => "index_constraint_option",
2289 Expression::ColumnConstraint(_) => "column_constraint",
2290 Expression::PeriodForSystemTimeConstraint(_) => "period_for_system_time_constraint",
2291 Expression::CaseSpecificColumnConstraint(_) => "case_specific_column_constraint",
2292 Expression::CharacterSetColumnConstraint(_) => "character_set_column_constraint",
2293 Expression::CheckColumnConstraint(_) => "check_column_constraint",
2294 Expression::AssumeColumnConstraint(_) => "assume_column_constraint",
2295 Expression::CompressColumnConstraint(_) => "compress_column_constraint",
2296 Expression::DateFormatColumnConstraint(_) => "date_format_column_constraint",
2297 Expression::EphemeralColumnConstraint(_) => "ephemeral_column_constraint",
2298 Expression::WithOperator(_) => "with_operator",
2299 Expression::GeneratedAsIdentityColumnConstraint(_) => {
2300 "generated_as_identity_column_constraint"
2301 }
2302 Expression::AutoIncrementColumnConstraint(_) => "auto_increment_column_constraint",
2303 Expression::CommentColumnConstraint(_) => "comment_column_constraint",
2304 Expression::GeneratedAsRowColumnConstraint(_) => "generated_as_row_column_constraint",
2305 Expression::IndexColumnConstraint(_) => "index_column_constraint",
2306 Expression::MaskingPolicyColumnConstraint(_) => "masking_policy_column_constraint",
2307 Expression::NotNullColumnConstraint(_) => "not_null_column_constraint",
2308 Expression::PrimaryKeyColumnConstraint(_) => "primary_key_column_constraint",
2309 Expression::UniqueColumnConstraint(_) => "unique_column_constraint",
2310 Expression::WatermarkColumnConstraint(_) => "watermark_column_constraint",
2311 Expression::ComputedColumnConstraint(_) => "computed_column_constraint",
2312 Expression::InOutColumnConstraint(_) => "in_out_column_constraint",
2313 Expression::DefaultColumnConstraint(_) => "default_column_constraint",
2314 Expression::PathColumnConstraint(_) => "path_column_constraint",
2315 Expression::Constraint(_) => "constraint",
2316 Expression::Export(_) => "export",
2317 Expression::Filter(_) => "filter",
2318 Expression::Changes(_) => "changes",
2319 Expression::CopyParameter(_) => "copy_parameter",
2320 Expression::Credentials(_) => "credentials",
2321 Expression::Directory(_) => "directory",
2322 Expression::ForeignKey(_) => "foreign_key",
2323 Expression::ColumnPrefix(_) => "column_prefix",
2324 Expression::PrimaryKey(_) => "primary_key",
2325 Expression::IntoClause(_) => "into_clause",
2326 Expression::JoinHint(_) => "join_hint",
2327 Expression::Opclass(_) => "opclass",
2328 Expression::Index(_) => "index",
2329 Expression::IndexParameters(_) => "index_parameters",
2330 Expression::ConditionalInsert(_) => "conditional_insert",
2331 Expression::MultitableInserts(_) => "multitable_inserts",
2332 Expression::OnConflict(_) => "on_conflict",
2333 Expression::OnCondition(_) => "on_condition",
2334 Expression::Returning(_) => "returning",
2335 Expression::Introducer(_) => "introducer",
2336 Expression::PartitionRange(_) => "partition_range",
2337 Expression::Fetch(_) => "fetch",
2338 Expression::Group(_) => "group",
2339 Expression::Cube(_) => "cube",
2340 Expression::Rollup(_) => "rollup",
2341 Expression::GroupingSets(_) => "grouping_sets",
2342 Expression::LimitOptions(_) => "limit_options",
2343 Expression::Lateral(_) => "lateral",
2344 Expression::TableFromRows(_) => "table_from_rows",
2345 Expression::RowsFrom(_) => "rows_from",
2346 Expression::MatchRecognizeMeasure(_) => "match_recognize_measure",
2347 Expression::WithFill(_) => "with_fill",
2348 Expression::Property(_) => "property",
2349 Expression::GrantPrivilege(_) => "grant_privilege",
2350 Expression::GrantPrincipal(_) => "grant_principal",
2351 Expression::AllowedValuesProperty(_) => "allowed_values_property",
2352 Expression::AlgorithmProperty(_) => "algorithm_property",
2353 Expression::AutoIncrementProperty(_) => "auto_increment_property",
2354 Expression::AutoRefreshProperty(_) => "auto_refresh_property",
2355 Expression::BackupProperty(_) => "backup_property",
2356 Expression::BuildProperty(_) => "build_property",
2357 Expression::BlockCompressionProperty(_) => "block_compression_property",
2358 Expression::CharacterSetProperty(_) => "character_set_property",
2359 Expression::ChecksumProperty(_) => "checksum_property",
2360 Expression::CollateProperty(_) => "collate_property",
2361 Expression::DataBlocksizeProperty(_) => "data_blocksize_property",
2362 Expression::DataDeletionProperty(_) => "data_deletion_property",
2363 Expression::DefinerProperty(_) => "definer_property",
2364 Expression::DistKeyProperty(_) => "dist_key_property",
2365 Expression::DistributedByProperty(_) => "distributed_by_property",
2366 Expression::DistStyleProperty(_) => "dist_style_property",
2367 Expression::DuplicateKeyProperty(_) => "duplicate_key_property",
2368 Expression::EngineProperty(_) => "engine_property",
2369 Expression::ToTableProperty(_) => "to_table_property",
2370 Expression::ExecuteAsProperty(_) => "execute_as_property",
2371 Expression::ExternalProperty(_) => "external_property",
2372 Expression::FallbackProperty(_) => "fallback_property",
2373 Expression::FileFormatProperty(_) => "file_format_property",
2374 Expression::CredentialsProperty(_) => "credentials_property",
2375 Expression::FreespaceProperty(_) => "freespace_property",
2376 Expression::InheritsProperty(_) => "inherits_property",
2377 Expression::InputModelProperty(_) => "input_model_property",
2378 Expression::OutputModelProperty(_) => "output_model_property",
2379 Expression::IsolatedLoadingProperty(_) => "isolated_loading_property",
2380 Expression::JournalProperty(_) => "journal_property",
2381 Expression::LanguageProperty(_) => "language_property",
2382 Expression::EnviromentProperty(_) => "enviroment_property",
2383 Expression::ClusteredByProperty(_) => "clustered_by_property",
2384 Expression::DictProperty(_) => "dict_property",
2385 Expression::DictRange(_) => "dict_range",
2386 Expression::OnCluster(_) => "on_cluster",
2387 Expression::LikeProperty(_) => "like_property",
2388 Expression::LocationProperty(_) => "location_property",
2389 Expression::LockProperty(_) => "lock_property",
2390 Expression::LockingProperty(_) => "locking_property",
2391 Expression::LogProperty(_) => "log_property",
2392 Expression::MaterializedProperty(_) => "materialized_property",
2393 Expression::MergeBlockRatioProperty(_) => "merge_block_ratio_property",
2394 Expression::OnProperty(_) => "on_property",
2395 Expression::OnCommitProperty(_) => "on_commit_property",
2396 Expression::PartitionedByProperty(_) => "partitioned_by_property",
2397 Expression::PartitionByProperty(_) => "partition_by_property",
2398 Expression::PartitionedByBucket(_) => "partitioned_by_bucket",
2399 Expression::ClusterByColumnsProperty(_) => "cluster_by_columns_property",
2400 Expression::PartitionByTruncate(_) => "partition_by_truncate",
2401 Expression::PartitionByRangeProperty(_) => "partition_by_range_property",
2402 Expression::PartitionByRangePropertyDynamic(_) => "partition_by_range_property_dynamic",
2403 Expression::PartitionByListProperty(_) => "partition_by_list_property",
2404 Expression::PartitionList(_) => "partition_list",
2405 Expression::Partition(_) => "partition",
2406 Expression::RefreshTriggerProperty(_) => "refresh_trigger_property",
2407 Expression::UniqueKeyProperty(_) => "unique_key_property",
2408 Expression::RollupProperty(_) => "rollup_property",
2409 Expression::PartitionBoundSpec(_) => "partition_bound_spec",
2410 Expression::PartitionedOfProperty(_) => "partitioned_of_property",
2411 Expression::RemoteWithConnectionModelProperty(_) => {
2412 "remote_with_connection_model_property"
2413 }
2414 Expression::ReturnsProperty(_) => "returns_property",
2415 Expression::RowFormatProperty(_) => "row_format_property",
2416 Expression::RowFormatDelimitedProperty(_) => "row_format_delimited_property",
2417 Expression::RowFormatSerdeProperty(_) => "row_format_serde_property",
2418 Expression::QueryTransform(_) => "query_transform",
2419 Expression::SampleProperty(_) => "sample_property",
2420 Expression::SecurityProperty(_) => "security_property",
2421 Expression::SchemaCommentProperty(_) => "schema_comment_property",
2422 Expression::SemanticView(_) => "semantic_view",
2423 Expression::SerdeProperties(_) => "serde_properties",
2424 Expression::SetProperty(_) => "set_property",
2425 Expression::SharingProperty(_) => "sharing_property",
2426 Expression::SetConfigProperty(_) => "set_config_property",
2427 Expression::SettingsProperty(_) => "settings_property",
2428 Expression::SortKeyProperty(_) => "sort_key_property",
2429 Expression::SqlReadWriteProperty(_) => "sql_read_write_property",
2430 Expression::SqlSecurityProperty(_) => "sql_security_property",
2431 Expression::StabilityProperty(_) => "stability_property",
2432 Expression::StorageHandlerProperty(_) => "storage_handler_property",
2433 Expression::TemporaryProperty(_) => "temporary_property",
2434 Expression::Tags(_) => "tags",
2435 Expression::TransformModelProperty(_) => "transform_model_property",
2436 Expression::TransientProperty(_) => "transient_property",
2437 Expression::UsingTemplateProperty(_) => "using_template_property",
2438 Expression::ViewAttributeProperty(_) => "view_attribute_property",
2439 Expression::VolatileProperty(_) => "volatile_property",
2440 Expression::WithDataProperty(_) => "with_data_property",
2441 Expression::WithJournalTableProperty(_) => "with_journal_table_property",
2442 Expression::WithSchemaBindingProperty(_) => "with_schema_binding_property",
2443 Expression::WithSystemVersioningProperty(_) => "with_system_versioning_property",
2444 Expression::WithProcedureOptions(_) => "with_procedure_options",
2445 Expression::EncodeProperty(_) => "encode_property",
2446 Expression::IncludeProperty(_) => "include_property",
2447 Expression::Properties(_) => "properties",
2448 Expression::OptionsProperty(_) => "options_property",
2449 Expression::InputOutputFormat(_) => "input_output_format",
2450 Expression::Reference(_) => "reference",
2451 Expression::QueryOption(_) => "query_option",
2452 Expression::WithTableHint(_) => "with_table_hint",
2453 Expression::IndexTableHint(_) => "index_table_hint",
2454 Expression::HistoricalData(_) => "historical_data",
2455 Expression::Get(_) => "get",
2456 Expression::SetOperation(_) => "set_operation",
2457 Expression::Var(_) => "var",
2458 Expression::Variadic(_) => "variadic",
2459 Expression::Version(_) => "version",
2460 Expression::Schema(_) => "schema",
2461 Expression::Lock(_) => "lock",
2462 Expression::TableSample(_) => "table_sample",
2463 Expression::Tag(_) => "tag",
2464 Expression::UnpivotColumns(_) => "unpivot_columns",
2465 Expression::WindowSpec(_) => "window_spec",
2466 Expression::SessionParameter(_) => "session_parameter",
2467 Expression::PseudoType(_) => "pseudo_type",
2468 Expression::ObjectIdentifier(_) => "object_identifier",
2469 Expression::Transaction(_) => "transaction",
2470 Expression::Commit(_) => "commit",
2471 Expression::Rollback(_) => "rollback",
2472 Expression::AlterSession(_) => "alter_session",
2473 Expression::Analyze(_) => "analyze",
2474 Expression::AnalyzeStatistics(_) => "analyze_statistics",
2475 Expression::AnalyzeHistogram(_) => "analyze_histogram",
2476 Expression::AnalyzeSample(_) => "analyze_sample",
2477 Expression::AnalyzeListChainedRows(_) => "analyze_list_chained_rows",
2478 Expression::AnalyzeDelete(_) => "analyze_delete",
2479 Expression::AnalyzeWith(_) => "analyze_with",
2480 Expression::AnalyzeValidate(_) => "analyze_validate",
2481 Expression::AddPartition(_) => "add_partition",
2482 Expression::AttachOption(_) => "attach_option",
2483 Expression::DropPartition(_) => "drop_partition",
2484 Expression::ReplacePartition(_) => "replace_partition",
2485 Expression::DPipe(_) => "d_pipe",
2486 Expression::Operator(_) => "operator",
2487 Expression::PivotAny(_) => "pivot_any",
2488 Expression::Aliases(_) => "aliases",
2489 Expression::AtIndex(_) => "at_index",
2490 Expression::FromTimeZone(_) => "from_time_zone",
2491 Expression::FormatPhrase(_) => "format_phrase",
2492 Expression::ForIn(_) => "for_in",
2493 Expression::TimeUnit(_) => "time_unit",
2494 Expression::IntervalOp(_) => "interval_op",
2495 Expression::IntervalSpan(_) => "interval_span",
2496 Expression::HavingMax(_) => "having_max",
2497 Expression::CosineDistance(_) => "cosine_distance",
2498 Expression::DotProduct(_) => "dot_product",
2499 Expression::EuclideanDistance(_) => "euclidean_distance",
2500 Expression::ManhattanDistance(_) => "manhattan_distance",
2501 Expression::JarowinklerSimilarity(_) => "jarowinkler_similarity",
2502 Expression::Booland(_) => "booland",
2503 Expression::Boolor(_) => "boolor",
2504 Expression::ParameterizedAgg(_) => "parameterized_agg",
2505 Expression::ArgMax(_) => "arg_max",
2506 Expression::ArgMin(_) => "arg_min",
2507 Expression::ApproxTopK(_) => "approx_top_k",
2508 Expression::ApproxTopKAccumulate(_) => "approx_top_k_accumulate",
2509 Expression::ApproxTopKCombine(_) => "approx_top_k_combine",
2510 Expression::ApproxTopKEstimate(_) => "approx_top_k_estimate",
2511 Expression::ApproxTopSum(_) => "approx_top_sum",
2512 Expression::ApproxQuantiles(_) => "approx_quantiles",
2513 Expression::Minhash(_) => "minhash",
2514 Expression::FarmFingerprint(_) => "farm_fingerprint",
2515 Expression::Float64(_) => "float64",
2516 Expression::Transform(_) => "transform",
2517 Expression::Translate(_) => "translate",
2518 Expression::Grouping(_) => "grouping",
2519 Expression::GroupingId(_) => "grouping_id",
2520 Expression::Anonymous(_) => "anonymous",
2521 Expression::AnonymousAggFunc(_) => "anonymous_agg_func",
2522 Expression::CombinedAggFunc(_) => "combined_agg_func",
2523 Expression::CombinedParameterizedAgg(_) => "combined_parameterized_agg",
2524 Expression::HashAgg(_) => "hash_agg",
2525 Expression::Hll(_) => "hll",
2526 Expression::Apply(_) => "apply",
2527 Expression::ToBoolean(_) => "to_boolean",
2528 Expression::List(_) => "list",
2529 Expression::ToMap(_) => "to_map",
2530 Expression::Pad(_) => "pad",
2531 Expression::ToChar(_) => "to_char",
2532 Expression::ToNumber(_) => "to_number",
2533 Expression::ToDouble(_) => "to_double",
2534 Expression::Int64(_) => "int64",
2535 Expression::StringFunc(_) => "string_func",
2536 Expression::ToDecfloat(_) => "to_decfloat",
2537 Expression::TryToDecfloat(_) => "try_to_decfloat",
2538 Expression::ToFile(_) => "to_file",
2539 Expression::Columns(_) => "columns",
2540 Expression::ConvertToCharset(_) => "convert_to_charset",
2541 Expression::ConvertTimezone(_) => "convert_timezone",
2542 Expression::GenerateSeries(_) => "generate_series",
2543 Expression::AIAgg(_) => "a_i_agg",
2544 Expression::AIClassify(_) => "a_i_classify",
2545 Expression::ArrayAll(_) => "array_all",
2546 Expression::ArrayAny(_) => "array_any",
2547 Expression::ArrayConstructCompact(_) => "array_construct_compact",
2548 Expression::StPoint(_) => "st_point",
2549 Expression::StDistance(_) => "st_distance",
2550 Expression::StringToArray(_) => "string_to_array",
2551 Expression::ArraySum(_) => "array_sum",
2552 Expression::ObjectAgg(_) => "object_agg",
2553 Expression::CastToStrType(_) => "cast_to_str_type",
2554 Expression::CheckJson(_) => "check_json",
2555 Expression::CheckXml(_) => "check_xml",
2556 Expression::TranslateCharacters(_) => "translate_characters",
2557 Expression::CurrentSchemas(_) => "current_schemas",
2558 Expression::CurrentDatetime(_) => "current_datetime",
2559 Expression::Localtime(_) => "localtime",
2560 Expression::Localtimestamp(_) => "localtimestamp",
2561 Expression::Systimestamp(_) => "systimestamp",
2562 Expression::CurrentSchema(_) => "current_schema",
2563 Expression::CurrentUser(_) => "current_user",
2564 Expression::UtcTime(_) => "utc_time",
2565 Expression::UtcTimestamp(_) => "utc_timestamp",
2566 Expression::Timestamp(_) => "timestamp",
2567 Expression::DateBin(_) => "date_bin",
2568 Expression::Datetime(_) => "datetime",
2569 Expression::DatetimeAdd(_) => "datetime_add",
2570 Expression::DatetimeSub(_) => "datetime_sub",
2571 Expression::DatetimeDiff(_) => "datetime_diff",
2572 Expression::DatetimeTrunc(_) => "datetime_trunc",
2573 Expression::Dayname(_) => "dayname",
2574 Expression::MakeInterval(_) => "make_interval",
2575 Expression::PreviousDay(_) => "previous_day",
2576 Expression::Elt(_) => "elt",
2577 Expression::TimestampAdd(_) => "timestamp_add",
2578 Expression::TimestampSub(_) => "timestamp_sub",
2579 Expression::TimestampDiff(_) => "timestamp_diff",
2580 Expression::TimeSlice(_) => "time_slice",
2581 Expression::TimeAdd(_) => "time_add",
2582 Expression::TimeSub(_) => "time_sub",
2583 Expression::TimeDiff(_) => "time_diff",
2584 Expression::TimeTrunc(_) => "time_trunc",
2585 Expression::DateFromParts(_) => "date_from_parts",
2586 Expression::TimeFromParts(_) => "time_from_parts",
2587 Expression::DecodeCase(_) => "decode_case",
2588 Expression::Decrypt(_) => "decrypt",
2589 Expression::DecryptRaw(_) => "decrypt_raw",
2590 Expression::Encode(_) => "encode",
2591 Expression::Encrypt(_) => "encrypt",
2592 Expression::EncryptRaw(_) => "encrypt_raw",
2593 Expression::EqualNull(_) => "equal_null",
2594 Expression::ToBinary(_) => "to_binary",
2595 Expression::Base64DecodeBinary(_) => "base64_decode_binary",
2596 Expression::Base64DecodeString(_) => "base64_decode_string",
2597 Expression::Base64Encode(_) => "base64_encode",
2598 Expression::TryBase64DecodeBinary(_) => "try_base64_decode_binary",
2599 Expression::TryBase64DecodeString(_) => "try_base64_decode_string",
2600 Expression::GapFill(_) => "gap_fill",
2601 Expression::GenerateDateArray(_) => "generate_date_array",
2602 Expression::GenerateTimestampArray(_) => "generate_timestamp_array",
2603 Expression::GetExtract(_) => "get_extract",
2604 Expression::Getbit(_) => "getbit",
2605 Expression::OverflowTruncateBehavior(_) => "overflow_truncate_behavior",
2606 Expression::HexEncode(_) => "hex_encode",
2607 Expression::Compress(_) => "compress",
2608 Expression::DecompressBinary(_) => "decompress_binary",
2609 Expression::DecompressString(_) => "decompress_string",
2610 Expression::Xor(_) => "xor",
2611 Expression::Nullif(_) => "nullif",
2612 Expression::JSON(_) => "j_s_o_n",
2613 Expression::JSONPath(_) => "j_s_o_n_path",
2614 Expression::JSONPathFilter(_) => "j_s_o_n_path_filter",
2615 Expression::JSONPathKey(_) => "j_s_o_n_path_key",
2616 Expression::JSONPathRecursive(_) => "j_s_o_n_path_recursive",
2617 Expression::JSONPathScript(_) => "j_s_o_n_path_script",
2618 Expression::JSONPathSlice(_) => "j_s_o_n_path_slice",
2619 Expression::JSONPathSelector(_) => "j_s_o_n_path_selector",
2620 Expression::JSONPathSubscript(_) => "j_s_o_n_path_subscript",
2621 Expression::JSONPathUnion(_) => "j_s_o_n_path_union",
2622 Expression::Format(_) => "format",
2623 Expression::JSONKeys(_) => "j_s_o_n_keys",
2624 Expression::JSONKeyValue(_) => "j_s_o_n_key_value",
2625 Expression::JSONKeysAtDepth(_) => "j_s_o_n_keys_at_depth",
2626 Expression::JSONObject(_) => "j_s_o_n_object",
2627 Expression::JSONObjectAgg(_) => "j_s_o_n_object_agg",
2628 Expression::JSONBObjectAgg(_) => "j_s_o_n_b_object_agg",
2629 Expression::JSONArray(_) => "j_s_o_n_array",
2630 Expression::JSONArrayAgg(_) => "j_s_o_n_array_agg",
2631 Expression::JSONExists(_) => "j_s_o_n_exists",
2632 Expression::JSONColumnDef(_) => "j_s_o_n_column_def",
2633 Expression::JSONSchema(_) => "j_s_o_n_schema",
2634 Expression::JSONSet(_) => "j_s_o_n_set",
2635 Expression::JSONStripNulls(_) => "j_s_o_n_strip_nulls",
2636 Expression::JSONValue(_) => "j_s_o_n_value",
2637 Expression::JSONValueArray(_) => "j_s_o_n_value_array",
2638 Expression::JSONRemove(_) => "j_s_o_n_remove",
2639 Expression::JSONTable(_) => "j_s_o_n_table",
2640 Expression::JSONType(_) => "j_s_o_n_type",
2641 Expression::ObjectInsert(_) => "object_insert",
2642 Expression::OpenJSONColumnDef(_) => "open_j_s_o_n_column_def",
2643 Expression::OpenJSON(_) => "open_j_s_o_n",
2644 Expression::JSONBExists(_) => "j_s_o_n_b_exists",
2645 Expression::JSONBContains(_) => "j_s_o_n_b_contains",
2646 Expression::JSONBExtract(_) => "j_s_o_n_b_extract",
2647 Expression::JSONCast(_) => "j_s_o_n_cast",
2648 Expression::JSONExtract(_) => "j_s_o_n_extract",
2649 Expression::JSONExtractQuote(_) => "j_s_o_n_extract_quote",
2650 Expression::JSONExtractArray(_) => "j_s_o_n_extract_array",
2651 Expression::JSONExtractScalar(_) => "j_s_o_n_extract_scalar",
2652 Expression::JSONBExtractScalar(_) => "j_s_o_n_b_extract_scalar",
2653 Expression::JSONFormat(_) => "j_s_o_n_format",
2654 Expression::JSONBool(_) => "j_s_o_n_bool",
2655 Expression::JSONPathRoot(_) => "j_s_o_n_path_root",
2656 Expression::JSONArrayAppend(_) => "j_s_o_n_array_append",
2657 Expression::JSONArrayContains(_) => "j_s_o_n_array_contains",
2658 Expression::JSONArrayInsert(_) => "j_s_o_n_array_insert",
2659 Expression::ParseJSON(_) => "parse_j_s_o_n",
2660 Expression::ParseUrl(_) => "parse_url",
2661 Expression::ParseIp(_) => "parse_ip",
2662 Expression::ParseTime(_) => "parse_time",
2663 Expression::ParseDatetime(_) => "parse_datetime",
2664 Expression::Map(_) => "map",
2665 Expression::MapCat(_) => "map_cat",
2666 Expression::MapDelete(_) => "map_delete",
2667 Expression::MapInsert(_) => "map_insert",
2668 Expression::MapPick(_) => "map_pick",
2669 Expression::ScopeResolution(_) => "scope_resolution",
2670 Expression::Slice(_) => "slice",
2671 Expression::VarMap(_) => "var_map",
2672 Expression::MatchAgainst(_) => "match_against",
2673 Expression::MD5Digest(_) => "m_d5_digest",
2674 Expression::MD5NumberLower64(_) => "m_d5_number_lower64",
2675 Expression::MD5NumberUpper64(_) => "m_d5_number_upper64",
2676 Expression::Monthname(_) => "monthname",
2677 Expression::Ntile(_) => "ntile",
2678 Expression::Normalize(_) => "normalize",
2679 Expression::Normal(_) => "normal",
2680 Expression::Predict(_) => "predict",
2681 Expression::MLTranslate(_) => "m_l_translate",
2682 Expression::FeaturesAtTime(_) => "features_at_time",
2683 Expression::GenerateEmbedding(_) => "generate_embedding",
2684 Expression::MLForecast(_) => "m_l_forecast",
2685 Expression::ModelAttribute(_) => "model_attribute",
2686 Expression::VectorSearch(_) => "vector_search",
2687 Expression::Quantile(_) => "quantile",
2688 Expression::ApproxQuantile(_) => "approx_quantile",
2689 Expression::ApproxPercentileEstimate(_) => "approx_percentile_estimate",
2690 Expression::Randn(_) => "randn",
2691 Expression::Randstr(_) => "randstr",
2692 Expression::RangeN(_) => "range_n",
2693 Expression::RangeBucket(_) => "range_bucket",
2694 Expression::ReadCSV(_) => "read_c_s_v",
2695 Expression::ReadParquet(_) => "read_parquet",
2696 Expression::Reduce(_) => "reduce",
2697 Expression::RegexpExtractAll(_) => "regexp_extract_all",
2698 Expression::RegexpILike(_) => "regexp_i_like",
2699 Expression::RegexpFullMatch(_) => "regexp_full_match",
2700 Expression::RegexpInstr(_) => "regexp_instr",
2701 Expression::RegexpSplit(_) => "regexp_split",
2702 Expression::RegexpCount(_) => "regexp_count",
2703 Expression::RegrValx(_) => "regr_valx",
2704 Expression::RegrValy(_) => "regr_valy",
2705 Expression::RegrAvgy(_) => "regr_avgy",
2706 Expression::RegrAvgx(_) => "regr_avgx",
2707 Expression::RegrCount(_) => "regr_count",
2708 Expression::RegrIntercept(_) => "regr_intercept",
2709 Expression::RegrR2(_) => "regr_r2",
2710 Expression::RegrSxx(_) => "regr_sxx",
2711 Expression::RegrSxy(_) => "regr_sxy",
2712 Expression::RegrSyy(_) => "regr_syy",
2713 Expression::RegrSlope(_) => "regr_slope",
2714 Expression::SafeAdd(_) => "safe_add",
2715 Expression::SafeDivide(_) => "safe_divide",
2716 Expression::SafeMultiply(_) => "safe_multiply",
2717 Expression::SafeSubtract(_) => "safe_subtract",
2718 Expression::SHA2(_) => "s_h_a2",
2719 Expression::SHA2Digest(_) => "s_h_a2_digest",
2720 Expression::SortArray(_) => "sort_array",
2721 Expression::SplitPart(_) => "split_part",
2722 Expression::SubstringIndex(_) => "substring_index",
2723 Expression::StandardHash(_) => "standard_hash",
2724 Expression::StrPosition(_) => "str_position",
2725 Expression::Search(_) => "search",
2726 Expression::SearchIp(_) => "search_ip",
2727 Expression::StrToDate(_) => "str_to_date",
2728 Expression::DateStrToDate(_) => "date_str_to_date",
2729 Expression::DateToDateStr(_) => "date_to_date_str",
2730 Expression::StrToTime(_) => "str_to_time",
2731 Expression::StrToUnix(_) => "str_to_unix",
2732 Expression::StrToMap(_) => "str_to_map",
2733 Expression::NumberToStr(_) => "number_to_str",
2734 Expression::FromBase(_) => "from_base",
2735 Expression::Stuff(_) => "stuff",
2736 Expression::TimeToStr(_) => "time_to_str",
2737 Expression::TimeStrToTime(_) => "time_str_to_time",
2738 Expression::TsOrDsAdd(_) => "ts_or_ds_add",
2739 Expression::TsOrDsDiff(_) => "ts_or_ds_diff",
2740 Expression::TsOrDsToDate(_) => "ts_or_ds_to_date",
2741 Expression::TsOrDsToTime(_) => "ts_or_ds_to_time",
2742 Expression::Unhex(_) => "unhex",
2743 Expression::Uniform(_) => "uniform",
2744 Expression::UnixToStr(_) => "unix_to_str",
2745 Expression::UnixToTime(_) => "unix_to_time",
2746 Expression::Uuid(_) => "uuid",
2747 Expression::TimestampFromParts(_) => "timestamp_from_parts",
2748 Expression::TimestampTzFromParts(_) => "timestamp_tz_from_parts",
2749 Expression::Corr(_) => "corr",
2750 Expression::WidthBucket(_) => "width_bucket",
2751 Expression::CovarSamp(_) => "covar_samp",
2752 Expression::CovarPop(_) => "covar_pop",
2753 Expression::Week(_) => "week",
2754 Expression::XMLElement(_) => "x_m_l_element",
2755 Expression::XMLGet(_) => "x_m_l_get",
2756 Expression::XMLTable(_) => "x_m_l_table",
2757 Expression::XMLKeyValueOption(_) => "x_m_l_key_value_option",
2758 Expression::Zipf(_) => "zipf",
2759 Expression::Merge(_) => "merge",
2760 Expression::When(_) => "when",
2761 Expression::Whens(_) => "whens",
2762 Expression::NextValueFor(_) => "next_value_for",
2763 Expression::ReturnStmt(_) => "return_stmt",
2764 }
2765 }
2766
2767 pub fn get_this(&self) -> Option<&Expression> {
2769 match self {
2770 Expression::Not(u) | Expression::Neg(u) | Expression::BitwiseNot(u) => Some(&u.this),
2772 Expression::Upper(f)
2774 | Expression::Lower(f)
2775 | Expression::Length(f)
2776 | Expression::LTrim(f)
2777 | Expression::RTrim(f)
2778 | Expression::Reverse(f)
2779 | Expression::Abs(f)
2780 | Expression::Sqrt(f)
2781 | Expression::Cbrt(f)
2782 | Expression::Ln(f)
2783 | Expression::Exp(f)
2784 | Expression::Sign(f)
2785 | Expression::Date(f)
2786 | Expression::Time(f)
2787 | Expression::Initcap(f)
2788 | Expression::Ascii(f)
2789 | Expression::Chr(f)
2790 | Expression::Soundex(f)
2791 | Expression::ByteLength(f)
2792 | Expression::Hex(f)
2793 | Expression::LowerHex(f)
2794 | Expression::Unicode(f)
2795 | Expression::Typeof(f)
2796 | Expression::Explode(f)
2797 | Expression::ExplodeOuter(f)
2798 | Expression::MapFromEntries(f)
2799 | Expression::MapKeys(f)
2800 | Expression::MapValues(f)
2801 | Expression::ArrayLength(f)
2802 | Expression::ArraySize(f)
2803 | Expression::Cardinality(f)
2804 | Expression::ArrayReverse(f)
2805 | Expression::ArrayDistinct(f)
2806 | Expression::ArrayFlatten(f)
2807 | Expression::ArrayCompact(f)
2808 | Expression::ToArray(f)
2809 | Expression::JsonArrayLength(f)
2810 | Expression::JsonKeys(f)
2811 | Expression::JsonType(f)
2812 | Expression::ParseJson(f)
2813 | Expression::ToJson(f)
2814 | Expression::Radians(f)
2815 | Expression::Degrees(f)
2816 | Expression::Sin(f)
2817 | Expression::Cos(f)
2818 | Expression::Tan(f)
2819 | Expression::Asin(f)
2820 | Expression::Acos(f)
2821 | Expression::Atan(f)
2822 | Expression::IsNan(f)
2823 | Expression::IsInf(f)
2824 | Expression::Year(f)
2825 | Expression::Month(f)
2826 | Expression::Day(f)
2827 | Expression::Hour(f)
2828 | Expression::Minute(f)
2829 | Expression::Second(f)
2830 | Expression::DayOfWeek(f)
2831 | Expression::DayOfWeekIso(f)
2832 | Expression::DayOfMonth(f)
2833 | Expression::DayOfYear(f)
2834 | Expression::WeekOfYear(f)
2835 | Expression::Quarter(f)
2836 | Expression::Epoch(f)
2837 | Expression::EpochMs(f)
2838 | Expression::BitwiseCount(f)
2839 | Expression::DateFromUnixDate(f)
2840 | Expression::UnixDate(f)
2841 | Expression::UnixSeconds(f)
2842 | Expression::UnixMillis(f)
2843 | Expression::UnixMicros(f)
2844 | Expression::TimeStrToDate(f)
2845 | Expression::DateToDi(f)
2846 | Expression::DiToDate(f)
2847 | Expression::TsOrDiToDi(f)
2848 | Expression::TsOrDsToDatetime(f)
2849 | Expression::TsOrDsToTimestamp(f)
2850 | Expression::YearOfWeek(f)
2851 | Expression::YearOfWeekIso(f)
2852 | Expression::SHA(f)
2853 | Expression::SHA1Digest(f)
2854 | Expression::TimeToUnix(f)
2855 | Expression::TimeStrToUnix(f)
2856 | Expression::Int64(f)
2857 | Expression::JSONBool(f)
2858 | Expression::MD5NumberLower64(f)
2859 | Expression::MD5NumberUpper64(f)
2860 | Expression::DateStrToDate(f)
2861 | Expression::DateToDateStr(f) => Some(&f.this),
2862 Expression::Power(f)
2864 | Expression::NullIf(f)
2865 | Expression::IfNull(f)
2866 | Expression::Nvl(f)
2867 | Expression::Contains(f)
2868 | Expression::StartsWith(f)
2869 | Expression::EndsWith(f)
2870 | Expression::Levenshtein(f)
2871 | Expression::ModFunc(f)
2872 | Expression::IntDiv(f)
2873 | Expression::Atan2(f)
2874 | Expression::AddMonths(f)
2875 | Expression::MonthsBetween(f)
2876 | Expression::NextDay(f)
2877 | Expression::UnixToTimeStr(f)
2878 | Expression::ArrayContains(f)
2879 | Expression::ArrayPosition(f)
2880 | Expression::ArrayAppend(f)
2881 | Expression::ArrayPrepend(f)
2882 | Expression::ArrayUnion(f)
2883 | Expression::ArrayExcept(f)
2884 | Expression::ArrayRemove(f)
2885 | Expression::StarMap(f)
2886 | Expression::MapFromArrays(f)
2887 | Expression::MapContainsKey(f)
2888 | Expression::ElementAt(f)
2889 | Expression::JsonMergePatch(f)
2890 | Expression::JSONBContains(f)
2891 | Expression::JSONBExtract(f) => Some(&f.this),
2892 Expression::Sum(af)
2894 | Expression::Avg(af)
2895 | Expression::Min(af)
2896 | Expression::Max(af)
2897 | Expression::ArrayAgg(af)
2898 | Expression::CountIf(af)
2899 | Expression::Stddev(af)
2900 | Expression::StddevPop(af)
2901 | Expression::StddevSamp(af)
2902 | Expression::Variance(af)
2903 | Expression::VarPop(af)
2904 | Expression::VarSamp(af)
2905 | Expression::Median(af)
2906 | Expression::Mode(af)
2907 | Expression::First(af)
2908 | Expression::Last(af)
2909 | Expression::AnyValue(af)
2910 | Expression::ApproxDistinct(af)
2911 | Expression::ApproxCountDistinct(af)
2912 | Expression::LogicalAnd(af)
2913 | Expression::LogicalOr(af)
2914 | Expression::Skewness(af)
2915 | Expression::ArrayConcatAgg(af)
2916 | Expression::ArrayUniqueAgg(af)
2917 | Expression::BoolXorAgg(af)
2918 | Expression::BitwiseAndAgg(af)
2919 | Expression::BitwiseOrAgg(af)
2920 | Expression::BitwiseXorAgg(af) => Some(&af.this),
2921 Expression::And(op)
2923 | Expression::Or(op)
2924 | Expression::Add(op)
2925 | Expression::Sub(op)
2926 | Expression::Mul(op)
2927 | Expression::Div(op)
2928 | Expression::Mod(op)
2929 | Expression::Eq(op)
2930 | Expression::Neq(op)
2931 | Expression::Lt(op)
2932 | Expression::Lte(op)
2933 | Expression::Gt(op)
2934 | Expression::Gte(op)
2935 | Expression::BitwiseAnd(op)
2936 | Expression::BitwiseOr(op)
2937 | Expression::BitwiseXor(op)
2938 | Expression::Concat(op)
2939 | Expression::Adjacent(op)
2940 | Expression::TsMatch(op)
2941 | Expression::PropertyEQ(op)
2942 | Expression::ArrayContainsAll(op)
2943 | Expression::ArrayContainedBy(op)
2944 | Expression::ArrayOverlaps(op)
2945 | Expression::JSONBContainsAllTopKeys(op)
2946 | Expression::JSONBContainsAnyTopKeys(op)
2947 | Expression::JSONBDeleteAtPath(op)
2948 | Expression::ExtendsLeft(op)
2949 | Expression::ExtendsRight(op)
2950 | Expression::Is(op)
2951 | Expression::MemberOf(op)
2952 | Expression::Match(op)
2953 | Expression::NullSafeEq(op)
2954 | Expression::NullSafeNeq(op)
2955 | Expression::Glob(op)
2956 | Expression::BitwiseLeftShift(op)
2957 | Expression::BitwiseRightShift(op) => Some(&op.left),
2958 Expression::Like(op) | Expression::ILike(op) => Some(&op.left),
2960 Expression::Alias(a) => Some(&a.this),
2962 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => Some(&c.this),
2963 Expression::Paren(p) => Some(&p.this),
2964 Expression::Annotated(a) => Some(&a.this),
2965 Expression::Subquery(s) => Some(&s.this),
2966 Expression::Where(w) => Some(&w.this),
2967 Expression::Having(h) => Some(&h.this),
2968 Expression::Qualify(q) => Some(&q.this),
2969 Expression::IsNull(i) => Some(&i.this),
2970 Expression::Exists(e) => Some(&e.this),
2971 Expression::Ordered(o) => Some(&o.this),
2972 Expression::WindowFunction(wf) => Some(&wf.this),
2973 Expression::Cte(cte) => Some(&cte.this),
2974 Expression::Between(b) => Some(&b.this),
2975 Expression::In(i) => Some(&i.this),
2976 Expression::ReturnStmt(e) => Some(e),
2977 _ => None,
2978 }
2979 }
2980
2981 pub fn get_expression(&self) -> Option<&Expression> {
2983 match self {
2984 Expression::And(op)
2986 | Expression::Or(op)
2987 | Expression::Add(op)
2988 | Expression::Sub(op)
2989 | Expression::Mul(op)
2990 | Expression::Div(op)
2991 | Expression::Mod(op)
2992 | Expression::Eq(op)
2993 | Expression::Neq(op)
2994 | Expression::Lt(op)
2995 | Expression::Lte(op)
2996 | Expression::Gt(op)
2997 | Expression::Gte(op)
2998 | Expression::BitwiseAnd(op)
2999 | Expression::BitwiseOr(op)
3000 | Expression::BitwiseXor(op)
3001 | Expression::Concat(op)
3002 | Expression::Adjacent(op)
3003 | Expression::TsMatch(op)
3004 | Expression::PropertyEQ(op)
3005 | Expression::ArrayContainsAll(op)
3006 | Expression::ArrayContainedBy(op)
3007 | Expression::ArrayOverlaps(op)
3008 | Expression::JSONBContainsAllTopKeys(op)
3009 | Expression::JSONBContainsAnyTopKeys(op)
3010 | Expression::JSONBDeleteAtPath(op)
3011 | Expression::ExtendsLeft(op)
3012 | Expression::ExtendsRight(op)
3013 | Expression::Is(op)
3014 | Expression::MemberOf(op)
3015 | Expression::Match(op)
3016 | Expression::NullSafeEq(op)
3017 | Expression::NullSafeNeq(op)
3018 | Expression::Glob(op)
3019 | Expression::BitwiseLeftShift(op)
3020 | Expression::BitwiseRightShift(op) => Some(&op.right),
3021 Expression::Like(op) | Expression::ILike(op) => Some(&op.right),
3023 Expression::Power(f)
3025 | Expression::NullIf(f)
3026 | Expression::IfNull(f)
3027 | Expression::Nvl(f)
3028 | Expression::Contains(f)
3029 | Expression::StartsWith(f)
3030 | Expression::EndsWith(f)
3031 | Expression::Levenshtein(f)
3032 | Expression::ModFunc(f)
3033 | Expression::IntDiv(f)
3034 | Expression::Atan2(f)
3035 | Expression::AddMonths(f)
3036 | Expression::MonthsBetween(f)
3037 | Expression::NextDay(f)
3038 | Expression::UnixToTimeStr(f)
3039 | Expression::ArrayContains(f)
3040 | Expression::ArrayPosition(f)
3041 | Expression::ArrayAppend(f)
3042 | Expression::ArrayPrepend(f)
3043 | Expression::ArrayUnion(f)
3044 | Expression::ArrayExcept(f)
3045 | Expression::ArrayRemove(f)
3046 | Expression::StarMap(f)
3047 | Expression::MapFromArrays(f)
3048 | Expression::MapContainsKey(f)
3049 | Expression::ElementAt(f)
3050 | Expression::JsonMergePatch(f)
3051 | Expression::JSONBContains(f)
3052 | Expression::JSONBExtract(f) => Some(&f.expression),
3053 _ => None,
3054 }
3055 }
3056
3057 pub fn get_expressions(&self) -> &[Expression] {
3059 match self {
3060 Expression::Select(s) => &s.expressions,
3061 Expression::Function(f) => &f.args,
3062 Expression::AggregateFunction(f) => &f.args,
3063 Expression::From(f) => &f.expressions,
3064 Expression::GroupBy(g) => &g.expressions,
3065 Expression::In(i) => &i.expressions,
3066 Expression::Array(a) => &a.expressions,
3067 Expression::Tuple(t) => &t.expressions,
3068 Expression::Coalesce(f)
3069 | Expression::Greatest(f)
3070 | Expression::Least(f)
3071 | Expression::ArrayConcat(f)
3072 | Expression::ArrayIntersect(f)
3073 | Expression::ArrayZip(f)
3074 | Expression::MapConcat(f)
3075 | Expression::JsonArray(f) => &f.expressions,
3076 _ => &[],
3077 }
3078 }
3079
3080 pub fn get_name(&self) -> &str {
3082 match self {
3083 Expression::Identifier(id) => &id.name,
3084 Expression::Column(col) => &col.name.name,
3085 Expression::Table(t) => &t.name.name,
3086 Expression::Literal(lit) => lit.value_str(),
3087 Expression::Star(_) => "*",
3088 Expression::Function(f) => &f.name,
3089 Expression::AggregateFunction(f) => &f.name,
3090 Expression::Alias(a) => a.this.get_name(),
3091 Expression::Boolean(b) => {
3092 if b.value {
3093 "TRUE"
3094 } else {
3095 "FALSE"
3096 }
3097 }
3098 Expression::Null(_) => "NULL",
3099 _ => "",
3100 }
3101 }
3102
3103 pub fn get_alias(&self) -> &str {
3105 match self {
3106 Expression::Alias(a) => &a.alias.name,
3107 Expression::Table(t) => t.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3108 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3109 _ => "",
3110 }
3111 }
3112
3113 pub fn get_output_name(&self) -> &str {
3115 match self {
3116 Expression::Alias(a) => &a.alias.name,
3117 Expression::Column(c) => &c.name.name,
3118 Expression::Identifier(id) => &id.name,
3119 Expression::Literal(lit) => lit.value_str(),
3120 Expression::Subquery(s) => s.alias.as_ref().map(|a| a.name.as_str()).unwrap_or(""),
3121 Expression::Star(_) => "*",
3122 _ => "",
3123 }
3124 }
3125
3126 pub fn get_comments(&self) -> Vec<&str> {
3128 match self {
3129 Expression::Identifier(id) => id.trailing_comments.iter().map(|s| s.as_str()).collect(),
3130 Expression::Column(c) => c.trailing_comments.iter().map(|s| s.as_str()).collect(),
3131 Expression::Star(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3132 Expression::Paren(p) => p.trailing_comments.iter().map(|s| s.as_str()).collect(),
3133 Expression::Annotated(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3134 Expression::Alias(a) => a.trailing_comments.iter().map(|s| s.as_str()).collect(),
3135 Expression::Cast(c) | Expression::TryCast(c) | Expression::SafeCast(c) => {
3136 c.trailing_comments.iter().map(|s| s.as_str()).collect()
3137 }
3138 Expression::And(op)
3139 | Expression::Or(op)
3140 | Expression::Add(op)
3141 | Expression::Sub(op)
3142 | Expression::Mul(op)
3143 | Expression::Div(op)
3144 | Expression::Mod(op)
3145 | Expression::Eq(op)
3146 | Expression::Neq(op)
3147 | Expression::Lt(op)
3148 | Expression::Lte(op)
3149 | Expression::Gt(op)
3150 | Expression::Gte(op)
3151 | Expression::Concat(op)
3152 | Expression::BitwiseAnd(op)
3153 | Expression::BitwiseOr(op)
3154 | Expression::BitwiseXor(op) => {
3155 op.trailing_comments.iter().map(|s| s.as_str()).collect()
3156 }
3157 Expression::Function(f) => f.trailing_comments.iter().map(|s| s.as_str()).collect(),
3158 Expression::Subquery(s) => s.trailing_comments.iter().map(|s| s.as_str()).collect(),
3159 _ => Vec::new(),
3160 }
3161 }
3162}
3163
3164impl fmt::Display for Expression {
3165 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3166 match self {
3168 Expression::Literal(lit) => write!(f, "{}", lit),
3169 Expression::Identifier(id) => write!(f, "{}", id),
3170 Expression::Column(col) => write!(f, "{}", col),
3171 Expression::Star(_) => write!(f, "*"),
3172 Expression::Null(_) => write!(f, "NULL"),
3173 Expression::Boolean(b) => write!(f, "{}", if b.value { "TRUE" } else { "FALSE" }),
3174 Expression::Select(_) => write!(f, "SELECT ..."),
3175 _ => write!(f, "{:?}", self),
3176 }
3177 }
3178}
3179
3180#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3190#[cfg_attr(feature = "bindings", derive(TS))]
3191#[serde(tag = "literal_type", content = "value", rename_all = "snake_case")]
3192pub enum Literal {
3193 String(String),
3195 Number(String),
3197 HexString(String),
3199 HexNumber(String),
3201 BitString(String),
3202 ByteString(String),
3204 NationalString(String),
3206 Date(String),
3208 Time(String),
3210 Timestamp(String),
3212 Datetime(String),
3214 TripleQuotedString(String, char),
3217 EscapeString(String),
3219 DollarString(String),
3221 RawString(String),
3225}
3226
3227impl Literal {
3228 pub fn value_str(&self) -> &str {
3230 match self {
3231 Literal::String(s)
3232 | Literal::Number(s)
3233 | Literal::HexString(s)
3234 | Literal::HexNumber(s)
3235 | Literal::BitString(s)
3236 | Literal::ByteString(s)
3237 | Literal::NationalString(s)
3238 | Literal::Date(s)
3239 | Literal::Time(s)
3240 | Literal::Timestamp(s)
3241 | Literal::Datetime(s)
3242 | Literal::EscapeString(s)
3243 | Literal::DollarString(s)
3244 | Literal::RawString(s) => s.as_str(),
3245 Literal::TripleQuotedString(s, _) => s.as_str(),
3246 }
3247 }
3248
3249 pub fn is_string(&self) -> bool {
3251 matches!(
3252 self,
3253 Literal::String(_)
3254 | Literal::NationalString(_)
3255 | Literal::EscapeString(_)
3256 | Literal::DollarString(_)
3257 | Literal::RawString(_)
3258 | Literal::TripleQuotedString(_, _)
3259 )
3260 }
3261
3262 pub fn is_number(&self) -> bool {
3264 matches!(self, Literal::Number(_) | Literal::HexNumber(_))
3265 }
3266}
3267
3268impl fmt::Display for Literal {
3269 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3270 match self {
3271 Literal::String(s) => write!(f, "'{}'", s),
3272 Literal::Number(n) => write!(f, "{}", n),
3273 Literal::HexString(h) => write!(f, "X'{}'", h),
3274 Literal::HexNumber(h) => write!(f, "0x{}", h),
3275 Literal::BitString(b) => write!(f, "B'{}'", b),
3276 Literal::ByteString(b) => write!(f, "b'{}'", b),
3277 Literal::NationalString(s) => write!(f, "N'{}'", s),
3278 Literal::Date(d) => write!(f, "DATE '{}'", d),
3279 Literal::Time(t) => write!(f, "TIME '{}'", t),
3280 Literal::Timestamp(ts) => write!(f, "TIMESTAMP '{}'", ts),
3281 Literal::Datetime(dt) => write!(f, "DATETIME '{}'", dt),
3282 Literal::TripleQuotedString(s, q) => {
3283 write!(f, "{0}{0}{0}{1}{0}{0}{0}", q, s)
3284 }
3285 Literal::EscapeString(s) => write!(f, "E'{}'", s),
3286 Literal::DollarString(s) => write!(f, "$${}$$", s),
3287 Literal::RawString(s) => write!(f, "r'{}'", s),
3288 }
3289 }
3290}
3291
3292#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3294#[cfg_attr(feature = "bindings", derive(TS))]
3295pub struct BooleanLiteral {
3296 pub value: bool,
3297}
3298
3299#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3301#[cfg_attr(feature = "bindings", derive(TS))]
3302pub struct Null;
3303
3304#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3311#[cfg_attr(feature = "bindings", derive(TS))]
3312pub struct Identifier {
3313 pub name: String,
3315 pub quoted: bool,
3317 #[serde(default)]
3318 pub trailing_comments: Vec<String>,
3319 #[serde(default, skip_serializing_if = "Option::is_none")]
3321 pub span: Option<Span>,
3322}
3323
3324impl Identifier {
3325 pub fn new(name: impl Into<String>) -> Self {
3326 Self {
3327 name: name.into(),
3328 quoted: false,
3329 trailing_comments: Vec::new(),
3330 span: None,
3331 }
3332 }
3333
3334 pub fn quoted(name: impl Into<String>) -> Self {
3335 Self {
3336 name: name.into(),
3337 quoted: true,
3338 trailing_comments: Vec::new(),
3339 span: None,
3340 }
3341 }
3342
3343 pub fn empty() -> Self {
3344 Self {
3345 name: String::new(),
3346 quoted: false,
3347 trailing_comments: Vec::new(),
3348 span: None,
3349 }
3350 }
3351
3352 pub fn is_empty(&self) -> bool {
3353 self.name.is_empty()
3354 }
3355
3356 pub fn with_span(mut self, span: Span) -> Self {
3358 self.span = Some(span);
3359 self
3360 }
3361}
3362
3363impl fmt::Display for Identifier {
3364 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3365 if self.quoted {
3366 write!(f, "\"{}\"", self.name)
3367 } else {
3368 write!(f, "{}", self.name)
3369 }
3370 }
3371}
3372
3373#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3379#[cfg_attr(feature = "bindings", derive(TS))]
3380pub struct Column {
3381 pub name: Identifier,
3383 pub table: Option<Identifier>,
3385 #[serde(default)]
3387 pub join_mark: bool,
3388 #[serde(default)]
3390 pub trailing_comments: Vec<String>,
3391 #[serde(default, skip_serializing_if = "Option::is_none")]
3393 pub span: Option<Span>,
3394 #[serde(default, skip_serializing_if = "Option::is_none")]
3396 #[ast(skip)]
3397 pub inferred_type: Option<DataType>,
3398}
3399
3400impl fmt::Display for Column {
3401 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3402 if let Some(table) = &self.table {
3403 write!(f, "{}.{}", table, self.name)
3404 } else {
3405 write!(f, "{}", self.name)
3406 }
3407 }
3408}
3409
3410#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3417#[cfg_attr(feature = "bindings", derive(TS))]
3418pub struct TableRef {
3419 pub name: Identifier,
3421 pub schema: Option<Identifier>,
3423 pub catalog: Option<Identifier>,
3425 pub alias: Option<Identifier>,
3427 #[serde(default)]
3429 pub alias_explicit_as: bool,
3430 #[serde(default)]
3432 pub column_aliases: Vec<Identifier>,
3433 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3435 pub leading_comments: Vec<String>,
3436 #[serde(default)]
3438 pub trailing_comments: Vec<String>,
3439 #[serde(default)]
3441 pub when: Option<Box<HistoricalData>>,
3442 #[serde(default)]
3444 pub only: bool,
3445 #[serde(default)]
3447 pub final_: bool,
3448 #[serde(default, skip_serializing_if = "Option::is_none")]
3450 pub table_sample: Option<Box<Sample>>,
3451 #[serde(default)]
3453 pub hints: Vec<Expression>,
3454 #[serde(default, skip_serializing_if = "Option::is_none")]
3457 pub system_time: Option<String>,
3458 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3460 pub partitions: Vec<Identifier>,
3461 #[serde(default, skip_serializing_if = "Option::is_none")]
3464 pub identifier_func: Option<Box<Expression>>,
3465 #[serde(default, skip_serializing_if = "Option::is_none")]
3467 pub changes: Option<Box<Changes>>,
3468 #[serde(default, skip_serializing_if = "Option::is_none")]
3470 pub version: Option<Box<Version>>,
3471 #[serde(default, skip_serializing_if = "Option::is_none")]
3473 pub span: Option<Span>,
3474}
3475
3476impl TableRef {
3477 pub fn new(name: impl Into<String>) -> Self {
3478 Self {
3479 name: Identifier::new(name),
3480 schema: None,
3481 catalog: None,
3482 alias: None,
3483 alias_explicit_as: false,
3484 column_aliases: Vec::new(),
3485 leading_comments: Vec::new(),
3486 trailing_comments: Vec::new(),
3487 when: None,
3488 only: false,
3489 final_: false,
3490 table_sample: None,
3491 hints: Vec::new(),
3492 system_time: None,
3493 partitions: Vec::new(),
3494 identifier_func: None,
3495 changes: None,
3496 version: None,
3497 span: None,
3498 }
3499 }
3500
3501 pub fn new_with_schema(name: impl Into<String>, schema: impl Into<String>) -> Self {
3503 let mut t = Self::new(name);
3504 t.schema = Some(Identifier::new(schema));
3505 t
3506 }
3507
3508 pub fn new_with_catalog(
3510 name: impl Into<String>,
3511 schema: impl Into<String>,
3512 catalog: impl Into<String>,
3513 ) -> Self {
3514 let mut t = Self::new(name);
3515 t.schema = Some(Identifier::new(schema));
3516 t.catalog = Some(Identifier::new(catalog));
3517 t
3518 }
3519
3520 pub fn from_identifier(name: Identifier) -> Self {
3522 Self {
3523 name,
3524 schema: None,
3525 catalog: None,
3526 alias: None,
3527 alias_explicit_as: false,
3528 column_aliases: Vec::new(),
3529 leading_comments: Vec::new(),
3530 trailing_comments: Vec::new(),
3531 when: None,
3532 only: false,
3533 final_: false,
3534 table_sample: None,
3535 hints: Vec::new(),
3536 system_time: None,
3537 partitions: Vec::new(),
3538 identifier_func: None,
3539 changes: None,
3540 version: None,
3541 span: None,
3542 }
3543 }
3544
3545 pub fn with_alias(mut self, alias: impl Into<String>) -> Self {
3546 self.alias = Some(Identifier::new(alias));
3547 self
3548 }
3549
3550 pub fn with_schema(mut self, schema: impl Into<String>) -> Self {
3551 self.schema = Some(Identifier::new(schema));
3552 self
3553 }
3554}
3555
3556#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3561#[cfg_attr(feature = "bindings", derive(TS))]
3562pub struct Star {
3563 pub table: Option<Identifier>,
3565 pub except: Option<Vec<Identifier>>,
3567 pub replace: Option<Vec<Alias>>,
3569 pub rename: Option<Vec<(Identifier, Identifier)>>,
3571 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3573 pub trailing_comments: Vec<String>,
3574 #[serde(default, skip_serializing_if = "Option::is_none")]
3576 pub span: Option<Span>,
3577}
3578
3579#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3603#[cfg_attr(feature = "bindings", derive(TS))]
3604pub struct Select {
3605 pub expressions: Vec<Expression>,
3607 pub from: Option<From>,
3609 pub joins: Vec<Join>,
3611 pub lateral_views: Vec<LateralView>,
3612 #[serde(default, skip_serializing_if = "Option::is_none")]
3614 pub prewhere: Option<Expression>,
3615 pub where_clause: Option<Where>,
3616 pub group_by: Option<GroupBy>,
3617 pub having: Option<Having>,
3618 pub qualify: Option<Qualify>,
3619 pub order_by: Option<OrderBy>,
3620 pub distribute_by: Option<DistributeBy>,
3621 pub cluster_by: Option<ClusterBy>,
3622 pub sort_by: Option<SortBy>,
3623 pub limit: Option<Limit>,
3624 pub offset: Option<Offset>,
3625 #[serde(default, skip_serializing_if = "Option::is_none")]
3627 pub limit_by: Option<Vec<Expression>>,
3628 pub fetch: Option<Fetch>,
3629 pub distinct: bool,
3630 pub distinct_on: Option<Vec<Expression>>,
3631 pub top: Option<Top>,
3632 pub with: Option<With>,
3633 pub sample: Option<Sample>,
3634 #[serde(default, skip_serializing_if = "Option::is_none")]
3636 pub settings: Option<Vec<Expression>>,
3637 #[serde(default, skip_serializing_if = "Option::is_none")]
3639 pub format: Option<Expression>,
3640 pub windows: Option<Vec<NamedWindow>>,
3641 pub hint: Option<Hint>,
3642 pub connect: Option<Connect>,
3644 pub into: Option<SelectInto>,
3646 #[serde(default)]
3648 pub locks: Vec<Lock>,
3649 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3651 pub for_xml: Vec<Expression>,
3652 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3654 pub for_json: Vec<Expression>,
3655 #[serde(default)]
3657 pub leading_comments: Vec<String>,
3658 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3661 pub post_select_comments: Vec<String>,
3662 #[serde(default, skip_serializing_if = "Option::is_none")]
3664 pub kind: Option<String>,
3665 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3667 pub operation_modifiers: Vec<String>,
3668 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
3670 pub qualify_after_window: bool,
3671 #[serde(default, skip_serializing_if = "Option::is_none")]
3673 pub option: Option<String>,
3674 #[serde(default, skip_serializing_if = "Option::is_none")]
3677 pub exclude: Option<Vec<Expression>>,
3678}
3679
3680impl Select {
3681 pub fn new() -> Self {
3682 Self {
3683 expressions: Vec::new(),
3684 from: None,
3685 joins: Vec::new(),
3686 lateral_views: Vec::new(),
3687 prewhere: None,
3688 where_clause: None,
3689 group_by: None,
3690 having: None,
3691 qualify: None,
3692 order_by: None,
3693 distribute_by: None,
3694 cluster_by: None,
3695 sort_by: None,
3696 limit: None,
3697 offset: None,
3698 limit_by: None,
3699 fetch: None,
3700 distinct: false,
3701 distinct_on: None,
3702 top: None,
3703 with: None,
3704 sample: None,
3705 settings: None,
3706 format: None,
3707 windows: None,
3708 hint: None,
3709 connect: None,
3710 into: None,
3711 locks: Vec::new(),
3712 for_xml: Vec::new(),
3713 for_json: Vec::new(),
3714 leading_comments: Vec::new(),
3715 post_select_comments: Vec::new(),
3716 kind: None,
3717 operation_modifiers: Vec::new(),
3718 qualify_after_window: false,
3719 option: None,
3720 exclude: None,
3721 }
3722 }
3723
3724 pub fn column(mut self, expr: Expression) -> Self {
3726 self.expressions.push(expr);
3727 self
3728 }
3729
3730 pub fn from(mut self, table: Expression) -> Self {
3732 self.from = Some(From {
3733 expressions: vec![table],
3734 });
3735 self
3736 }
3737
3738 pub fn where_(mut self, condition: Expression) -> Self {
3740 self.where_clause = Some(Where { this: condition });
3741 self
3742 }
3743
3744 pub fn distinct(mut self) -> Self {
3746 self.distinct = true;
3747 self
3748 }
3749
3750 pub fn join(mut self, join: Join) -> Self {
3752 self.joins.push(join);
3753 self
3754 }
3755
3756 pub fn order_by(mut self, expressions: Vec<Ordered>) -> Self {
3758 self.order_by = Some(OrderBy {
3759 expressions,
3760 siblings: false,
3761 comments: Vec::new(),
3762 });
3763 self
3764 }
3765
3766 pub fn limit(mut self, n: Expression) -> Self {
3768 self.limit = Some(Limit {
3769 this: n,
3770 percent: false,
3771 comments: Vec::new(),
3772 });
3773 self
3774 }
3775
3776 pub fn offset(mut self, n: Expression) -> Self {
3778 self.offset = Some(Offset {
3779 this: n,
3780 rows: None,
3781 });
3782 self
3783 }
3784}
3785
3786impl Default for Select {
3787 fn default() -> Self {
3788 Self::new()
3789 }
3790}
3791
3792#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3798#[cfg_attr(feature = "bindings", derive(TS))]
3799pub struct Union {
3800 pub left: Expression,
3802 pub right: Expression,
3804 pub all: bool,
3806 #[serde(default)]
3808 pub distinct: bool,
3809 pub with: Option<With>,
3811 pub order_by: Option<OrderBy>,
3813 pub limit: Option<Box<Expression>>,
3815 pub offset: Option<Box<Expression>>,
3817 #[serde(default, skip_serializing_if = "Option::is_none")]
3819 pub distribute_by: Option<DistributeBy>,
3820 #[serde(default, skip_serializing_if = "Option::is_none")]
3822 pub sort_by: Option<SortBy>,
3823 #[serde(default, skip_serializing_if = "Option::is_none")]
3825 pub cluster_by: Option<ClusterBy>,
3826 #[serde(default)]
3828 pub by_name: bool,
3829 #[serde(default, skip_serializing_if = "Option::is_none")]
3831 pub side: Option<String>,
3832 #[serde(default, skip_serializing_if = "Option::is_none")]
3834 pub kind: Option<String>,
3835 #[serde(default)]
3837 pub corresponding: bool,
3838 #[serde(default)]
3840 pub strict: bool,
3841 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3843 pub on_columns: Vec<Expression>,
3844}
3845
3846impl Drop for Union {
3849 fn drop(&mut self) {
3850 loop {
3851 if let Expression::Union(ref mut inner) = self.left {
3852 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3853 let old_left = std::mem::replace(&mut self.left, next_left);
3854 drop(old_left);
3855 } else {
3856 break;
3857 }
3858 }
3859 }
3860}
3861
3862#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3867#[cfg_attr(feature = "bindings", derive(TS))]
3868pub struct Intersect {
3869 pub left: Expression,
3871 pub right: Expression,
3873 pub all: bool,
3875 #[serde(default)]
3877 pub distinct: bool,
3878 pub with: Option<With>,
3880 pub order_by: Option<OrderBy>,
3882 pub limit: Option<Box<Expression>>,
3884 pub offset: Option<Box<Expression>>,
3886 #[serde(default, skip_serializing_if = "Option::is_none")]
3888 pub distribute_by: Option<DistributeBy>,
3889 #[serde(default, skip_serializing_if = "Option::is_none")]
3891 pub sort_by: Option<SortBy>,
3892 #[serde(default, skip_serializing_if = "Option::is_none")]
3894 pub cluster_by: Option<ClusterBy>,
3895 #[serde(default)]
3897 pub by_name: bool,
3898 #[serde(default, skip_serializing_if = "Option::is_none")]
3900 pub side: Option<String>,
3901 #[serde(default, skip_serializing_if = "Option::is_none")]
3903 pub kind: Option<String>,
3904 #[serde(default)]
3906 pub corresponding: bool,
3907 #[serde(default)]
3909 pub strict: bool,
3910 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3912 pub on_columns: Vec<Expression>,
3913}
3914
3915impl Drop for Intersect {
3916 fn drop(&mut self) {
3917 loop {
3918 if let Expression::Intersect(ref mut inner) = self.left {
3919 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3920 let old_left = std::mem::replace(&mut self.left, next_left);
3921 drop(old_left);
3922 } else {
3923 break;
3924 }
3925 }
3926 }
3927}
3928
3929#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3934#[cfg_attr(feature = "bindings", derive(TS))]
3935pub struct Except {
3936 pub left: Expression,
3938 pub right: Expression,
3940 pub all: bool,
3942 #[serde(default)]
3944 pub distinct: bool,
3945 pub with: Option<With>,
3947 pub order_by: Option<OrderBy>,
3949 pub limit: Option<Box<Expression>>,
3951 pub offset: Option<Box<Expression>>,
3953 #[serde(default, skip_serializing_if = "Option::is_none")]
3955 pub distribute_by: Option<DistributeBy>,
3956 #[serde(default, skip_serializing_if = "Option::is_none")]
3958 pub sort_by: Option<SortBy>,
3959 #[serde(default, skip_serializing_if = "Option::is_none")]
3961 pub cluster_by: Option<ClusterBy>,
3962 #[serde(default)]
3964 pub by_name: bool,
3965 #[serde(default, skip_serializing_if = "Option::is_none")]
3967 pub side: Option<String>,
3968 #[serde(default, skip_serializing_if = "Option::is_none")]
3970 pub kind: Option<String>,
3971 #[serde(default)]
3973 pub corresponding: bool,
3974 #[serde(default)]
3976 pub strict: bool,
3977 #[serde(default, skip_serializing_if = "Vec::is_empty")]
3979 pub on_columns: Vec<Expression>,
3980}
3981
3982impl Drop for Except {
3983 fn drop(&mut self) {
3984 loop {
3985 if let Expression::Except(ref mut inner) = self.left {
3986 let next_left = std::mem::replace(&mut inner.left, Expression::Null(Null));
3987 let old_left = std::mem::replace(&mut self.left, next_left);
3988 drop(old_left);
3989 } else {
3990 break;
3991 }
3992 }
3993 }
3994}
3995
3996#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
3998#[cfg_attr(feature = "bindings", derive(TS))]
3999pub struct SelectInto {
4000 pub this: Expression,
4002 #[serde(default)]
4004 pub temporary: bool,
4005 #[serde(default)]
4007 pub unlogged: bool,
4008 #[serde(default)]
4010 pub bulk_collect: bool,
4011 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4013 pub expressions: Vec<Expression>,
4014}
4015
4016#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4026#[cfg_attr(feature = "bindings", derive(TS))]
4027pub struct Subquery {
4028 pub this: Expression,
4030 pub alias: Option<Identifier>,
4032 pub column_aliases: Vec<Identifier>,
4034 #[serde(default)]
4036 pub alias_explicit_as: bool,
4037 #[serde(skip_serializing_if = "Option::is_none", default)]
4039 pub alias_keyword: Option<String>,
4040 pub order_by: Option<OrderBy>,
4042 pub limit: Option<Limit>,
4044 pub offset: Option<Offset>,
4046 #[serde(default, skip_serializing_if = "Option::is_none")]
4048 pub distribute_by: Option<DistributeBy>,
4049 #[serde(default, skip_serializing_if = "Option::is_none")]
4051 pub sort_by: Option<SortBy>,
4052 #[serde(default, skip_serializing_if = "Option::is_none")]
4054 pub cluster_by: Option<ClusterBy>,
4055 #[serde(default)]
4057 pub lateral: bool,
4058 #[serde(default)]
4062 pub modifiers_inside: bool,
4063 #[serde(default)]
4065 pub trailing_comments: Vec<String>,
4066 #[serde(default, skip_serializing_if = "Option::is_none")]
4068 #[ast(skip)]
4069 pub inferred_type: Option<DataType>,
4070}
4071
4072#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4077#[cfg_attr(feature = "bindings", derive(TS))]
4078pub struct PipeOperator {
4079 pub this: Expression,
4081 pub expression: Expression,
4083}
4084
4085#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4087#[cfg_attr(feature = "bindings", derive(TS))]
4088pub struct Values {
4089 pub expressions: Vec<Tuple>,
4091 pub alias: Option<Identifier>,
4093 pub column_aliases: Vec<Identifier>,
4095}
4096
4097#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4107#[cfg_attr(feature = "bindings", derive(TS))]
4108pub struct Pivot {
4109 pub this: Expression,
4111 #[serde(default)]
4114 pub expressions: Vec<Expression>,
4115 #[serde(default)]
4117 pub fields: Vec<Expression>,
4118 #[serde(default)]
4120 pub using: Vec<Expression>,
4121 #[serde(default)]
4123 pub group: Option<Box<Expression>>,
4124 #[serde(default)]
4126 pub unpivot: bool,
4127 #[serde(default)]
4129 pub into: Option<Box<Expression>>,
4130 #[serde(default)]
4132 pub alias: Option<Identifier>,
4133 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4135 pub alias_columns: Vec<Identifier>,
4136 #[serde(default)]
4138 pub include_nulls: Option<bool>,
4139 #[serde(default)]
4141 pub default_on_null: Option<Box<Expression>>,
4142 #[serde(default, skip_serializing_if = "Option::is_none")]
4144 pub with: Option<With>,
4145}
4146
4147#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4149#[cfg_attr(feature = "bindings", derive(TS))]
4150pub struct Unpivot {
4151 pub this: Expression,
4152 pub value_column: Identifier,
4153 pub name_column: Identifier,
4154 pub columns: Vec<Expression>,
4155 pub alias: Option<Identifier>,
4156 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4158 pub alias_columns: Vec<Identifier>,
4159 #[serde(default)]
4161 pub value_column_parenthesized: bool,
4162 #[serde(default)]
4164 pub include_nulls: Option<bool>,
4165 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4167 pub extra_value_columns: Vec<Identifier>,
4168}
4169
4170#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4173#[cfg_attr(feature = "bindings", derive(TS))]
4174pub struct PivotAlias {
4175 pub this: Expression,
4176 pub alias: Expression,
4177}
4178
4179#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4181#[cfg_attr(feature = "bindings", derive(TS))]
4182pub struct PreWhere {
4183 pub this: Expression,
4184}
4185
4186#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4188#[cfg_attr(feature = "bindings", derive(TS))]
4189pub struct Stream {
4190 pub this: Expression,
4191 #[serde(skip_serializing_if = "Option::is_none")]
4192 pub on: Option<Expression>,
4193 #[serde(skip_serializing_if = "Option::is_none")]
4194 pub show_initial_rows: Option<bool>,
4195}
4196
4197#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4199#[cfg_attr(feature = "bindings", derive(TS))]
4200pub struct UsingData {
4201 pub this: Expression,
4202}
4203
4204#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4206#[cfg_attr(feature = "bindings", derive(TS))]
4207pub struct XmlNamespace {
4208 pub this: Expression,
4209 #[serde(skip_serializing_if = "Option::is_none")]
4210 pub alias: Option<Identifier>,
4211}
4212
4213#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4215#[cfg_attr(feature = "bindings", derive(TS))]
4216pub struct RowFormat {
4217 pub delimited: bool,
4218 pub fields_terminated_by: Option<String>,
4219 pub collection_items_terminated_by: Option<String>,
4220 pub map_keys_terminated_by: Option<String>,
4221 pub lines_terminated_by: Option<String>,
4222 pub null_defined_as: Option<String>,
4223}
4224
4225#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4227#[cfg_attr(feature = "bindings", derive(TS))]
4228pub struct DirectoryInsert {
4229 pub local: bool,
4230 pub path: String,
4231 pub row_format: Option<RowFormat>,
4232 #[serde(default)]
4234 pub stored_as: Option<String>,
4235}
4236
4237#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4239#[cfg_attr(feature = "bindings", derive(TS))]
4240pub struct Insert {
4241 pub table: TableRef,
4242 pub columns: Vec<Identifier>,
4243 pub values: Vec<Vec<Expression>>,
4244 pub query: Option<Expression>,
4245 pub overwrite: bool,
4247 pub partition: Vec<(Identifier, Option<Expression>)>,
4249 #[serde(default)]
4251 pub directory: Option<DirectoryInsert>,
4252 #[serde(default)]
4254 pub returning: Vec<Expression>,
4255 #[serde(default)]
4257 pub output: Option<OutputClause>,
4258 #[serde(default)]
4260 pub on_conflict: Option<Box<Expression>>,
4261 #[serde(default)]
4263 pub leading_comments: Vec<String>,
4264 #[serde(default)]
4266 pub if_exists: bool,
4267 #[serde(default)]
4269 pub with: Option<With>,
4270 #[serde(default)]
4272 pub ignore: bool,
4273 #[serde(default)]
4275 pub source_alias: Option<Identifier>,
4276 #[serde(default)]
4278 pub alias: Option<Identifier>,
4279 #[serde(default)]
4281 pub alias_explicit_as: bool,
4282 #[serde(default)]
4284 pub default_values: bool,
4285 #[serde(default)]
4287 pub by_name: bool,
4288 #[serde(default, skip_serializing_if = "Option::is_none")]
4290 pub conflict_action: Option<String>,
4291 #[serde(default)]
4293 pub is_replace: bool,
4294 #[serde(default, skip_serializing_if = "Option::is_none")]
4296 pub hint: Option<Hint>,
4297 #[serde(default)]
4299 pub replace_where: Option<Box<Expression>>,
4300 #[serde(default)]
4302 pub source: Option<Box<Expression>>,
4303 #[serde(default, skip_serializing_if = "Option::is_none")]
4305 pub function_target: Option<Box<Expression>>,
4306 #[serde(default, skip_serializing_if = "Option::is_none")]
4308 pub partition_by: Option<Box<Expression>>,
4309 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4311 pub settings: Vec<Expression>,
4312}
4313
4314#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4316#[cfg_attr(feature = "bindings", derive(TS))]
4317pub struct OutputClause {
4318 pub columns: Vec<Expression>,
4320 #[serde(default)]
4322 pub into_table: Option<Expression>,
4323}
4324
4325#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4327#[cfg_attr(feature = "bindings", derive(TS))]
4328pub struct Update {
4329 pub table: TableRef,
4330 #[serde(default)]
4331 pub hint: Option<Hint>,
4332 #[serde(default)]
4334 pub extra_tables: Vec<TableRef>,
4335 #[serde(default)]
4337 pub table_joins: Vec<Join>,
4338 pub set: Vec<(Identifier, Expression)>,
4339 pub from_clause: Option<From>,
4340 #[serde(default)]
4342 pub from_joins: Vec<Join>,
4343 pub where_clause: Option<Where>,
4344 #[serde(default)]
4346 pub returning: Vec<Expression>,
4347 #[serde(default)]
4349 pub output: Option<OutputClause>,
4350 #[serde(default)]
4352 pub with: Option<With>,
4353 #[serde(default)]
4355 pub leading_comments: Vec<String>,
4356 #[serde(default)]
4358 pub limit: Option<Expression>,
4359 #[serde(default)]
4361 pub order_by: Option<OrderBy>,
4362 #[serde(default)]
4364 pub from_before_set: bool,
4365}
4366
4367#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4369#[cfg_attr(feature = "bindings", derive(TS))]
4370pub struct Delete {
4371 pub table: TableRef,
4372 #[serde(default)]
4373 pub hint: Option<Hint>,
4374 #[serde(default, skip_serializing_if = "Option::is_none")]
4376 pub on_cluster: Option<OnCluster>,
4377 pub alias: Option<Identifier>,
4379 #[serde(default)]
4381 pub alias_explicit_as: bool,
4382 pub using: Vec<TableRef>,
4384 pub where_clause: Option<Where>,
4385 #[serde(default)]
4387 pub output: Option<OutputClause>,
4388 #[serde(default)]
4390 pub leading_comments: Vec<String>,
4391 #[serde(default)]
4393 pub with: Option<With>,
4394 #[serde(default)]
4396 pub limit: Option<Expression>,
4397 #[serde(default)]
4399 pub order_by: Option<OrderBy>,
4400 #[serde(default)]
4402 pub returning: Vec<Expression>,
4403 #[serde(default)]
4406 pub tables: Vec<TableRef>,
4407 #[serde(default)]
4410 pub tables_from_using: bool,
4411 #[serde(default)]
4413 pub joins: Vec<Join>,
4414 #[serde(default)]
4416 pub force_index: Option<String>,
4417 #[serde(default)]
4419 pub no_from: bool,
4420}
4421
4422#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4424#[cfg_attr(feature = "bindings", derive(TS))]
4425pub struct CopyStmt {
4426 pub this: Expression,
4428 pub kind: bool,
4430 pub files: Vec<Expression>,
4432 #[serde(default)]
4434 pub params: Vec<CopyParameter>,
4435 #[serde(default)]
4437 pub credentials: Option<Box<Credentials>>,
4438 #[serde(default)]
4440 pub is_into: bool,
4441 #[serde(default)]
4443 pub with_wrapped: bool,
4444}
4445
4446#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4448#[cfg_attr(feature = "bindings", derive(TS))]
4449pub struct CopyParameter {
4450 pub name: String,
4451 pub value: Option<Expression>,
4452 pub values: Vec<Expression>,
4453 #[serde(default)]
4455 pub eq: bool,
4456}
4457
4458#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4460#[cfg_attr(feature = "bindings", derive(TS))]
4461pub struct Credentials {
4462 pub credentials: Vec<(String, String)>,
4463 pub encryption: Option<String>,
4464 pub storage: Option<String>,
4465}
4466
4467#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4469#[cfg_attr(feature = "bindings", derive(TS))]
4470pub struct PutStmt {
4471 pub source: String,
4473 #[serde(default)]
4475 pub source_quoted: bool,
4476 pub target: Expression,
4478 #[serde(default)]
4480 pub params: Vec<CopyParameter>,
4481}
4482
4483#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4485#[cfg_attr(feature = "bindings", derive(TS))]
4486pub struct StageReference {
4487 pub name: String,
4489 #[serde(default)]
4491 pub path: Option<String>,
4492 #[serde(default)]
4494 pub file_format: Option<Expression>,
4495 #[serde(default)]
4497 pub pattern: Option<String>,
4498 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4500 pub quoted: bool,
4501}
4502
4503#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4505#[cfg_attr(feature = "bindings", derive(TS))]
4506pub struct HistoricalData {
4507 pub this: Box<Expression>,
4509 pub kind: String,
4511 pub expression: Box<Expression>,
4513}
4514
4515#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4520#[cfg_attr(feature = "bindings", derive(TS))]
4521pub struct Alias {
4522 pub this: Expression,
4524 pub alias: Identifier,
4526 #[serde(default)]
4528 pub column_aliases: Vec<Identifier>,
4529 #[serde(default)]
4531 pub alias_explicit_as: bool,
4532 #[serde(skip_serializing_if = "Option::is_none", default)]
4534 pub alias_keyword: Option<String>,
4535 #[serde(default)]
4537 pub pre_alias_comments: Vec<String>,
4538 #[serde(default)]
4540 pub trailing_comments: Vec<String>,
4541 #[serde(default, skip_serializing_if = "Option::is_none")]
4543 #[ast(skip)]
4544 pub inferred_type: Option<DataType>,
4545}
4546
4547impl Alias {
4548 pub fn new(this: Expression, alias: Identifier) -> Self {
4550 Self {
4551 this,
4552 alias,
4553 column_aliases: Vec::new(),
4554 alias_explicit_as: false,
4555 alias_keyword: None,
4556 pre_alias_comments: Vec::new(),
4557 trailing_comments: Vec::new(),
4558 inferred_type: None,
4559 }
4560 }
4561
4562 pub fn with_columns(this: Expression, column_aliases: Vec<Identifier>) -> Self {
4564 Self {
4565 this,
4566 alias: Identifier::empty(),
4567 column_aliases,
4568 alias_explicit_as: false,
4569 alias_keyword: None,
4570 pre_alias_comments: Vec::new(),
4571 trailing_comments: Vec::new(),
4572 inferred_type: None,
4573 }
4574 }
4575}
4576
4577#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4584#[cfg_attr(feature = "bindings", derive(TS))]
4585pub struct Cast {
4586 pub this: Expression,
4588 pub to: DataType,
4590 #[serde(default)]
4591 pub trailing_comments: Vec<String>,
4592 #[serde(default)]
4594 pub double_colon_syntax: bool,
4595 #[serde(skip_serializing_if = "Option::is_none", default)]
4597 pub format: Option<Box<Expression>>,
4598 #[serde(skip_serializing_if = "Option::is_none", default)]
4600 pub default: Option<Box<Expression>>,
4601 #[serde(default, skip_serializing_if = "Option::is_none")]
4603 #[ast(skip)]
4604 pub inferred_type: Option<DataType>,
4605}
4606
4607#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4609#[cfg_attr(feature = "bindings", derive(TS))]
4610pub struct CollationExpr {
4611 pub this: Expression,
4612 pub collation: String,
4613 #[serde(default)]
4615 pub quoted: bool,
4616 #[serde(default)]
4618 pub double_quoted: bool,
4619}
4620
4621#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4627#[cfg_attr(feature = "bindings", derive(TS))]
4628pub struct Case {
4629 pub operand: Option<Expression>,
4631 pub whens: Vec<(Expression, Expression)>,
4633 pub else_: Option<Expression>,
4635 #[serde(default)]
4637 #[serde(skip_serializing_if = "Vec::is_empty")]
4638 pub comments: Vec<String>,
4639 #[serde(default, skip_serializing_if = "Option::is_none")]
4641 #[ast(skip)]
4642 pub inferred_type: Option<DataType>,
4643}
4644
4645#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4653#[cfg_attr(feature = "bindings", derive(TS))]
4654pub struct BinaryOp {
4655 pub left: Expression,
4656 pub right: Expression,
4657 #[serde(default)]
4659 pub left_comments: Vec<String>,
4660 #[serde(default)]
4662 pub operator_comments: Vec<String>,
4663 #[serde(default)]
4665 pub trailing_comments: Vec<String>,
4666 #[serde(default, skip_serializing_if = "Option::is_none")]
4668 #[ast(skip)]
4669 pub inferred_type: Option<DataType>,
4670}
4671
4672impl BinaryOp {
4673 pub fn new(left: Expression, right: Expression) -> Self {
4674 Self {
4675 left,
4676 right,
4677 left_comments: Vec::new(),
4678 operator_comments: Vec::new(),
4679 trailing_comments: Vec::new(),
4680 inferred_type: None,
4681 }
4682 }
4683}
4684
4685#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4687#[cfg_attr(feature = "bindings", derive(TS))]
4688pub struct LikeOp {
4689 pub left: Expression,
4690 pub right: Expression,
4691 #[serde(default)]
4693 pub escape: Option<Expression>,
4694 #[serde(default)]
4696 pub quantifier: Option<String>,
4697 #[serde(default, skip_serializing_if = "Option::is_none")]
4699 #[ast(skip)]
4700 pub inferred_type: Option<DataType>,
4701}
4702
4703impl LikeOp {
4704 pub fn new(left: Expression, right: Expression) -> Self {
4705 Self {
4706 left,
4707 right,
4708 escape: None,
4709 quantifier: None,
4710 inferred_type: None,
4711 }
4712 }
4713
4714 pub fn with_escape(left: Expression, right: Expression, escape: Expression) -> Self {
4715 Self {
4716 left,
4717 right,
4718 escape: Some(escape),
4719 quantifier: None,
4720 inferred_type: None,
4721 }
4722 }
4723}
4724
4725#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4729#[cfg_attr(feature = "bindings", derive(TS))]
4730pub struct UnaryOp {
4731 pub this: Expression,
4733 #[serde(default, skip_serializing_if = "Option::is_none")]
4735 #[ast(skip)]
4736 pub inferred_type: Option<DataType>,
4737}
4738
4739impl UnaryOp {
4740 pub fn new(this: Expression) -> Self {
4741 Self {
4742 this,
4743 inferred_type: None,
4744 }
4745 }
4746}
4747
4748#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4753#[cfg_attr(feature = "bindings", derive(TS))]
4754pub struct In {
4755 pub this: Expression,
4757 pub expressions: Vec<Expression>,
4759 pub query: Option<Expression>,
4761 pub not: bool,
4763 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4764 pub global: bool,
4765 #[serde(default, skip_serializing_if = "Option::is_none")]
4767 pub unnest: Option<Box<Expression>>,
4768 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
4772 pub is_field: bool,
4773}
4774
4775#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4777#[cfg_attr(feature = "bindings", derive(TS))]
4778pub struct Between {
4779 pub this: Expression,
4781 pub low: Expression,
4783 pub high: Expression,
4785 pub not: bool,
4787 #[serde(default)]
4789 pub symmetric: Option<bool>,
4790}
4791
4792#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4794#[cfg_attr(feature = "bindings", derive(TS))]
4795pub struct IsNull {
4796 pub this: Expression,
4797 pub not: bool,
4798 #[serde(default)]
4800 pub postfix_form: bool,
4801}
4802
4803#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4805#[cfg_attr(feature = "bindings", derive(TS))]
4806pub struct IsTrueFalse {
4807 pub this: Expression,
4808 pub not: bool,
4809}
4810
4811#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4814#[cfg_attr(feature = "bindings", derive(TS))]
4815pub struct IsJson {
4816 pub this: Expression,
4817 pub json_type: Option<String>,
4819 pub unique_keys: Option<JsonUniqueKeys>,
4821 pub negated: bool,
4823}
4824
4825#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4827#[cfg_attr(feature = "bindings", derive(TS))]
4828pub enum JsonUniqueKeys {
4829 With,
4831 Without,
4833 Shorthand,
4835}
4836
4837#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4839#[cfg_attr(feature = "bindings", derive(TS))]
4840pub struct Exists {
4841 pub this: Expression,
4843 pub not: bool,
4845}
4846
4847#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4854#[cfg_attr(feature = "bindings", derive(TS))]
4855pub struct Function {
4856 pub name: String,
4858 pub args: Vec<Expression>,
4860 pub distinct: bool,
4862 #[serde(default)]
4863 pub trailing_comments: Vec<String>,
4864 #[serde(default)]
4866 pub use_bracket_syntax: bool,
4867 #[serde(default)]
4869 pub no_parens: bool,
4870 #[serde(default)]
4872 pub quoted: bool,
4873 #[serde(default, skip_serializing_if = "Option::is_none")]
4875 pub span: Option<Span>,
4876 #[serde(default, skip_serializing_if = "Option::is_none")]
4878 #[ast(skip)]
4879 pub inferred_type: Option<DataType>,
4880}
4881
4882impl Default for Function {
4883 fn default() -> Self {
4884 Self {
4885 name: String::new(),
4886 args: Vec::new(),
4887 distinct: false,
4888 trailing_comments: Vec::new(),
4889 use_bracket_syntax: false,
4890 no_parens: false,
4891 quoted: false,
4892 span: None,
4893 inferred_type: None,
4894 }
4895 }
4896}
4897
4898impl Function {
4899 pub fn new(name: impl Into<String>, args: Vec<Expression>) -> Self {
4900 Self {
4901 name: name.into(),
4902 args,
4903 distinct: false,
4904 trailing_comments: Vec::new(),
4905 use_bracket_syntax: false,
4906 no_parens: false,
4907 quoted: false,
4908 span: None,
4909 inferred_type: None,
4910 }
4911 }
4912}
4913
4914#[derive(
4921 polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Default, Serialize, Deserialize,
4922)]
4923#[cfg_attr(feature = "bindings", derive(TS))]
4924pub struct AggregateFunction {
4925 pub name: String,
4927 pub args: Vec<Expression>,
4929 pub distinct: bool,
4931 pub filter: Option<Expression>,
4933 #[serde(default, skip_serializing_if = "Vec::is_empty")]
4935 pub order_by: Vec<Ordered>,
4936 #[serde(default, skip_serializing_if = "Option::is_none")]
4938 pub limit: Option<Box<Expression>>,
4939 #[serde(default, skip_serializing_if = "Option::is_none")]
4941 pub ignore_nulls: Option<bool>,
4942 #[serde(default, skip_serializing_if = "Option::is_none")]
4944 #[ast(skip)]
4945 pub inferred_type: Option<DataType>,
4946}
4947
4948#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4955#[cfg_attr(feature = "bindings", derive(TS))]
4956pub struct WindowFunction {
4957 pub this: Expression,
4959 pub over: Over,
4961 #[serde(default, skip_serializing_if = "Option::is_none")]
4963 pub keep: Option<Keep>,
4964 #[serde(default, skip_serializing_if = "Option::is_none")]
4966 #[ast(skip)]
4967 pub inferred_type: Option<DataType>,
4968}
4969
4970#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4973#[cfg_attr(feature = "bindings", derive(TS))]
4974pub struct Keep {
4975 pub first: bool,
4977 pub order_by: Vec<Ordered>,
4979}
4980
4981#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4983#[cfg_attr(feature = "bindings", derive(TS))]
4984pub struct WithinGroup {
4985 pub this: Expression,
4987 pub order_by: Vec<Ordered>,
4989}
4990
4991#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
4996#[cfg_attr(feature = "bindings", derive(TS))]
4997pub struct From {
4998 pub expressions: Vec<Expression>,
5000}
5001
5002#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5008#[cfg_attr(feature = "bindings", derive(TS))]
5009pub struct Join {
5010 pub this: Expression,
5012 pub on: Option<Expression>,
5014 pub using: Vec<Identifier>,
5016 pub kind: JoinKind,
5018 pub use_inner_keyword: bool,
5020 pub use_outer_keyword: bool,
5022 pub deferred_condition: bool,
5024 #[serde(default, skip_serializing_if = "Option::is_none")]
5026 pub join_hint: Option<String>,
5027 #[serde(default, skip_serializing_if = "Option::is_none")]
5029 pub match_condition: Option<Expression>,
5030 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5032 pub pivots: Vec<Expression>,
5033 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5035 pub comments: Vec<String>,
5036 #[serde(default)]
5040 pub nesting_group: usize,
5041 #[serde(default)]
5043 pub directed: bool,
5044}
5045
5046#[derive(
5053 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5054)]
5055#[cfg_attr(feature = "bindings", derive(TS))]
5056pub enum JoinKind {
5057 Inner,
5058 Left,
5059 Right,
5060 Full,
5061 Outer, Cross,
5063 Natural,
5064 NaturalLeft,
5065 NaturalRight,
5066 NaturalFull,
5067 Semi,
5068 Anti,
5069 LeftSemi,
5071 LeftAnti,
5072 RightSemi,
5073 RightAnti,
5074 CrossApply,
5076 OuterApply,
5077 AsOf,
5079 AsOfLeft,
5080 AsOfRight,
5081 Lateral,
5083 LeftLateral,
5084 Straight,
5086 Implicit,
5088 Array,
5090 LeftArray,
5091 Paste,
5093 Positional,
5095}
5096
5097impl Default for JoinKind {
5098 fn default() -> Self {
5099 JoinKind::Inner
5100 }
5101}
5102
5103#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5106#[cfg_attr(feature = "bindings", derive(TS))]
5107pub struct JoinedTable {
5108 pub left: Expression,
5110 pub joins: Vec<Join>,
5112 pub lateral_views: Vec<LateralView>,
5114 pub alias: Option<Identifier>,
5116}
5117
5118#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5120#[cfg_attr(feature = "bindings", derive(TS))]
5121pub struct Where {
5122 pub this: Expression,
5124}
5125
5126#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5131#[cfg_attr(feature = "bindings", derive(TS))]
5132pub struct GroupBy {
5133 pub expressions: Vec<Expression>,
5135 #[serde(default)]
5137 pub all: Option<bool>,
5138 #[serde(default)]
5140 pub totals: bool,
5141 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5143 pub comments: Vec<String>,
5144}
5145
5146#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5148#[cfg_attr(feature = "bindings", derive(TS))]
5149pub struct Having {
5150 pub this: Expression,
5152 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5154 pub comments: Vec<String>,
5155}
5156
5157#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5159#[cfg_attr(feature = "bindings", derive(TS))]
5160pub struct OrderBy {
5161 pub expressions: Vec<Ordered>,
5163 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5165 pub siblings: bool,
5166 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5168 pub comments: Vec<String>,
5169}
5170
5171#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5178#[cfg_attr(feature = "bindings", derive(TS))]
5179pub struct Ordered {
5180 pub this: Expression,
5182 pub desc: bool,
5184 pub nulls_first: Option<bool>,
5186 #[serde(default)]
5188 pub explicit_asc: bool,
5189 #[serde(default, skip_serializing_if = "Option::is_none")]
5191 pub with_fill: Option<Box<WithFill>>,
5192}
5193
5194impl Ordered {
5195 pub fn asc(expr: Expression) -> Self {
5196 Self {
5197 this: expr,
5198 desc: false,
5199 nulls_first: None,
5200 explicit_asc: false,
5201 with_fill: None,
5202 }
5203 }
5204
5205 pub fn desc(expr: Expression) -> Self {
5206 Self {
5207 this: expr,
5208 desc: true,
5209 nulls_first: None,
5210 explicit_asc: false,
5211 with_fill: None,
5212 }
5213 }
5214}
5215
5216#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5219#[cfg_attr(feature = "bindings", derive(TS))]
5220#[cfg_attr(feature = "bindings", ts(export))]
5221pub struct DistributeBy {
5222 pub expressions: Vec<Expression>,
5223}
5224
5225#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5228#[cfg_attr(feature = "bindings", derive(TS))]
5229#[cfg_attr(feature = "bindings", ts(export))]
5230pub struct ClusterBy {
5231 pub expressions: Vec<Ordered>,
5232}
5233
5234#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5237#[cfg_attr(feature = "bindings", derive(TS))]
5238#[cfg_attr(feature = "bindings", ts(export))]
5239pub struct SortBy {
5240 pub expressions: Vec<Ordered>,
5241}
5242
5243#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5246#[cfg_attr(feature = "bindings", derive(TS))]
5247#[cfg_attr(feature = "bindings", ts(export))]
5248pub struct LateralView {
5249 pub this: Expression,
5251 pub table_alias: Option<Identifier>,
5253 pub column_aliases: Vec<Identifier>,
5255 pub outer: bool,
5257}
5258
5259#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5261#[cfg_attr(feature = "bindings", derive(TS))]
5262#[cfg_attr(feature = "bindings", ts(export))]
5263pub struct Hint {
5264 pub expressions: Vec<HintExpression>,
5265}
5266
5267#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5269#[cfg_attr(feature = "bindings", derive(TS))]
5270#[cfg_attr(feature = "bindings", ts(export))]
5271pub enum HintExpression {
5272 Function { name: String, args: Vec<Expression> },
5274 Identifier(String),
5276 Raw(String),
5278}
5279
5280#[derive(
5282 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5283)]
5284#[cfg_attr(feature = "bindings", derive(TS))]
5285#[cfg_attr(feature = "bindings", ts(export))]
5286pub enum PseudocolumnType {
5287 Rownum, Rowid, Level, Sysdate, ObjectId, ObjectValue, }
5294
5295impl PseudocolumnType {
5296 pub fn as_str(&self) -> &'static str {
5297 match self {
5298 PseudocolumnType::Rownum => "ROWNUM",
5299 PseudocolumnType::Rowid => "ROWID",
5300 PseudocolumnType::Level => "LEVEL",
5301 PseudocolumnType::Sysdate => "SYSDATE",
5302 PseudocolumnType::ObjectId => "OBJECT_ID",
5303 PseudocolumnType::ObjectValue => "OBJECT_VALUE",
5304 }
5305 }
5306
5307 pub fn from_str(s: &str) -> Option<Self> {
5308 match s.to_uppercase().as_str() {
5309 "ROWNUM" => Some(PseudocolumnType::Rownum),
5310 "ROWID" => Some(PseudocolumnType::Rowid),
5311 "LEVEL" => Some(PseudocolumnType::Level),
5312 "SYSDATE" => Some(PseudocolumnType::Sysdate),
5313 "OBJECT_ID" => Some(PseudocolumnType::ObjectId),
5314 "OBJECT_VALUE" => Some(PseudocolumnType::ObjectValue),
5315 _ => None,
5316 }
5317 }
5318}
5319
5320#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5323#[cfg_attr(feature = "bindings", derive(TS))]
5324#[cfg_attr(feature = "bindings", ts(export))]
5325pub struct Pseudocolumn {
5326 pub kind: PseudocolumnType,
5327}
5328
5329impl Pseudocolumn {
5330 pub fn rownum() -> Self {
5331 Self {
5332 kind: PseudocolumnType::Rownum,
5333 }
5334 }
5335
5336 pub fn rowid() -> Self {
5337 Self {
5338 kind: PseudocolumnType::Rowid,
5339 }
5340 }
5341
5342 pub fn level() -> Self {
5343 Self {
5344 kind: PseudocolumnType::Level,
5345 }
5346 }
5347}
5348
5349#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5351#[cfg_attr(feature = "bindings", derive(TS))]
5352#[cfg_attr(feature = "bindings", ts(export))]
5353pub struct Connect {
5354 pub start: Option<Expression>,
5356 pub connect: Expression,
5358 pub nocycle: bool,
5360}
5361
5362#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5364#[cfg_attr(feature = "bindings", derive(TS))]
5365#[cfg_attr(feature = "bindings", ts(export))]
5366pub struct Prior {
5367 pub this: Expression,
5368}
5369
5370#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5372#[cfg_attr(feature = "bindings", derive(TS))]
5373#[cfg_attr(feature = "bindings", ts(export))]
5374pub struct ConnectByRoot {
5375 pub this: Expression,
5376}
5377
5378#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5380#[cfg_attr(feature = "bindings", derive(TS))]
5381#[cfg_attr(feature = "bindings", ts(export))]
5382pub struct MatchRecognize {
5383 pub this: Option<Box<Expression>>,
5385 pub partition_by: Option<Vec<Expression>>,
5387 pub order_by: Option<Vec<Ordered>>,
5389 pub measures: Option<Vec<MatchRecognizeMeasure>>,
5391 pub rows: Option<MatchRecognizeRows>,
5393 pub after: Option<MatchRecognizeAfter>,
5395 pub pattern: Option<String>,
5397 pub define: Option<Vec<(Identifier, Expression)>>,
5399 pub alias: Option<Identifier>,
5401 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5403 pub alias_explicit_as: bool,
5404}
5405
5406#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5408#[cfg_attr(feature = "bindings", derive(TS))]
5409#[cfg_attr(feature = "bindings", ts(export))]
5410pub struct MatchRecognizeMeasure {
5411 pub this: Expression,
5413 pub window_frame: Option<MatchRecognizeSemantics>,
5415}
5416
5417#[derive(
5419 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5420)]
5421#[cfg_attr(feature = "bindings", derive(TS))]
5422#[cfg_attr(feature = "bindings", ts(export))]
5423pub enum MatchRecognizeSemantics {
5424 Running,
5425 Final,
5426}
5427
5428#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5430#[cfg_attr(feature = "bindings", derive(TS))]
5431#[cfg_attr(feature = "bindings", ts(export))]
5432pub enum MatchRecognizeRows {
5433 OneRowPerMatch,
5434 AllRowsPerMatch,
5435 AllRowsPerMatchShowEmptyMatches,
5436 AllRowsPerMatchOmitEmptyMatches,
5437 AllRowsPerMatchWithUnmatchedRows,
5438}
5439
5440#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5442#[cfg_attr(feature = "bindings", derive(TS))]
5443#[cfg_attr(feature = "bindings", ts(export))]
5444pub enum MatchRecognizeAfter {
5445 PastLastRow,
5446 ToNextRow,
5447 ToFirst(Identifier),
5448 ToLast(Identifier),
5449}
5450
5451#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5453#[cfg_attr(feature = "bindings", derive(TS))]
5454pub struct Limit {
5455 pub this: Expression,
5457 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5459 pub percent: bool,
5460 #[serde(default)]
5462 #[serde(skip_serializing_if = "Vec::is_empty")]
5463 pub comments: Vec<String>,
5464}
5465
5466#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5468#[cfg_attr(feature = "bindings", derive(TS))]
5469pub struct Offset {
5470 pub this: Expression,
5471 #[serde(skip_serializing_if = "Option::is_none", default)]
5473 pub rows: Option<bool>,
5474}
5475
5476#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5478#[cfg_attr(feature = "bindings", derive(TS))]
5479pub struct Top {
5480 pub this: Expression,
5481 pub percent: bool,
5482 pub with_ties: bool,
5483 #[serde(default)]
5485 pub parenthesized: bool,
5486}
5487
5488#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5490#[cfg_attr(feature = "bindings", derive(TS))]
5491pub struct Fetch {
5492 pub direction: String,
5494 pub count: Option<Expression>,
5496 pub percent: bool,
5498 pub rows: bool,
5500 pub with_ties: bool,
5502}
5503
5504#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5510#[cfg_attr(feature = "bindings", derive(TS))]
5511pub struct Qualify {
5512 pub this: Expression,
5514}
5515
5516#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5518#[cfg_attr(feature = "bindings", derive(TS))]
5519pub struct Sample {
5520 pub method: SampleMethod,
5521 pub size: Expression,
5522 pub seed: Option<Expression>,
5523 #[serde(default)]
5525 pub offset: Option<Expression>,
5526 pub unit_after_size: bool,
5528 #[serde(default)]
5530 pub use_sample_keyword: bool,
5531 #[serde(default)]
5533 pub explicit_method: bool,
5534 #[serde(default)]
5536 pub method_before_size: bool,
5537 #[serde(default)]
5539 pub use_seed_keyword: bool,
5540 pub bucket_numerator: Option<Box<Expression>>,
5542 pub bucket_denominator: Option<Box<Expression>>,
5544 pub bucket_field: Option<Box<Expression>>,
5546 #[serde(default)]
5548 pub is_using_sample: bool,
5549 #[serde(default)]
5551 pub is_percent: bool,
5552 #[serde(default)]
5554 pub suppress_method_output: bool,
5555}
5556
5557#[derive(
5559 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5560)]
5561#[cfg_attr(feature = "bindings", derive(TS))]
5562pub enum SampleMethod {
5563 Bernoulli,
5564 System,
5565 Block,
5566 Row,
5567 Percent,
5568 Bucket,
5570 Reservoir,
5572}
5573
5574#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5576#[cfg_attr(feature = "bindings", derive(TS))]
5577pub struct NamedWindow {
5578 pub name: Identifier,
5579 pub spec: Over,
5580}
5581
5582#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5588#[cfg_attr(feature = "bindings", derive(TS))]
5589pub struct With {
5590 pub ctes: Vec<Cte>,
5592 pub recursive: bool,
5594 #[serde(default)]
5596 pub leading_comments: Vec<String>,
5597 #[serde(default, skip_serializing_if = "Option::is_none")]
5599 pub search: Option<Box<Expression>>,
5600}
5601
5602#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5609#[cfg_attr(feature = "bindings", derive(TS))]
5610pub struct Cte {
5611 pub alias: Identifier,
5613 pub this: Expression,
5615 pub columns: Vec<Identifier>,
5617 pub materialized: Option<bool>,
5619 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5621 pub key_expressions: Vec<Identifier>,
5622 #[serde(default)]
5624 pub alias_first: bool,
5625 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5627 pub comments: Vec<String>,
5628}
5629
5630#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5632#[cfg_attr(feature = "bindings", derive(TS))]
5633pub struct WindowSpec {
5634 pub partition_by: Vec<Expression>,
5635 pub order_by: Vec<Ordered>,
5636 pub frame: Option<WindowFrame>,
5637}
5638
5639#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5641#[cfg_attr(feature = "bindings", derive(TS))]
5642pub struct Over {
5643 pub window_name: Option<Identifier>,
5645 pub partition_by: Vec<Expression>,
5646 pub order_by: Vec<Ordered>,
5647 pub frame: Option<WindowFrame>,
5648 pub alias: Option<Identifier>,
5649}
5650
5651#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5653#[cfg_attr(feature = "bindings", derive(TS))]
5654pub struct WindowFrame {
5655 pub kind: WindowFrameKind,
5656 pub start: WindowFrameBound,
5657 pub end: Option<WindowFrameBound>,
5658 pub exclude: Option<WindowFrameExclude>,
5659 #[serde(default, skip_serializing_if = "Option::is_none")]
5661 pub kind_text: Option<String>,
5662 #[serde(default, skip_serializing_if = "Option::is_none")]
5664 pub start_side_text: Option<String>,
5665 #[serde(default, skip_serializing_if = "Option::is_none")]
5667 pub end_side_text: Option<String>,
5668}
5669
5670#[derive(
5671 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5672)]
5673#[cfg_attr(feature = "bindings", derive(TS))]
5674pub enum WindowFrameKind {
5675 Rows,
5676 Range,
5677 Groups,
5678}
5679
5680#[derive(
5682 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5683)]
5684#[cfg_attr(feature = "bindings", derive(TS))]
5685pub enum WindowFrameExclude {
5686 CurrentRow,
5687 Group,
5688 Ties,
5689 NoOthers,
5690}
5691
5692#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5693#[cfg_attr(feature = "bindings", derive(TS))]
5694pub enum WindowFrameBound {
5695 CurrentRow,
5696 UnboundedPreceding,
5697 UnboundedFollowing,
5698 Preceding(Box<Expression>),
5699 Following(Box<Expression>),
5700 BarePreceding,
5702 BareFollowing,
5704 Value(Box<Expression>),
5706}
5707
5708#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5710#[cfg_attr(feature = "bindings", derive(TS))]
5711pub struct StructField {
5712 pub name: String,
5713 pub data_type: DataType,
5714 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5715 pub options: Vec<Expression>,
5716 #[serde(default, skip_serializing_if = "Option::is_none")]
5717 pub comment: Option<String>,
5718}
5719
5720impl StructField {
5721 pub fn new(name: String, data_type: DataType) -> Self {
5723 Self {
5724 name,
5725 data_type,
5726 options: Vec::new(),
5727 comment: None,
5728 }
5729 }
5730
5731 pub fn with_options(name: String, data_type: DataType, options: Vec<Expression>) -> Self {
5733 Self {
5734 name,
5735 data_type,
5736 options,
5737 comment: None,
5738 }
5739 }
5740
5741 pub fn with_options_and_comment(
5743 name: String,
5744 data_type: DataType,
5745 options: Vec<Expression>,
5746 comment: Option<String>,
5747 ) -> Self {
5748 Self {
5749 name,
5750 data_type,
5751 options,
5752 comment,
5753 }
5754 }
5755}
5756
5757#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5764#[cfg_attr(feature = "bindings", derive(TS))]
5765#[serde(tag = "oracle_data_type", rename_all = "snake_case")]
5766pub enum OracleDataType {
5767 Number {
5768 precision: Option<u32>,
5769 scale: Option<i32>,
5770 },
5771 BinaryFloat,
5772 BinaryDouble,
5773 Float {
5774 precision: Option<u32>,
5775 },
5776 Character {
5777 kind: OracleCharacterKind,
5778 length: Option<u32>,
5779 semantics: Option<OracleCharacterLengthSemantics>,
5780 },
5781 Date,
5782 Timestamp {
5783 precision: Option<u32>,
5784 timezone: OracleTimestampTimeZone,
5785 },
5786 IntervalYearToMonth {
5787 year_precision: Option<u32>,
5788 },
5789 IntervalDayToSecond {
5790 day_precision: Option<u32>,
5791 fractional_seconds_precision: Option<u32>,
5792 },
5793 Clob {
5794 national: bool,
5795 },
5796 Blob,
5797 Raw {
5798 length: Option<u32>,
5799 },
5800 Long {
5801 raw: bool,
5802 },
5803 RowId,
5804}
5805
5806#[derive(
5807 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5808)]
5809#[cfg_attr(feature = "bindings", derive(TS))]
5810#[serde(rename_all = "snake_case")]
5811pub enum OracleCharacterKind {
5812 Char,
5813 VarChar,
5814 NChar,
5815 NVarChar,
5816}
5817
5818#[derive(
5819 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5820)]
5821#[cfg_attr(feature = "bindings", derive(TS))]
5822#[serde(rename_all = "snake_case")]
5823pub enum OracleCharacterLengthSemantics {
5824 Byte,
5825 Char,
5826}
5827
5828#[derive(
5829 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
5830)]
5831#[cfg_attr(feature = "bindings", derive(TS))]
5832#[serde(rename_all = "snake_case")]
5833pub enum OracleTimestampTimeZone {
5834 None,
5835 WithTimeZone,
5836 WithLocalTimeZone,
5837}
5838
5839#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
5851#[cfg_attr(feature = "bindings", derive(TS))]
5852#[serde(tag = "data_type", rename_all = "snake_case")]
5853pub enum DataType {
5854 Boolean,
5856 TinyInt {
5857 length: Option<u32>,
5858 },
5859 SmallInt {
5860 length: Option<u32>,
5861 },
5862 Int {
5866 length: Option<u32>,
5867 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5868 integer_spelling: bool,
5869 },
5870 BigInt {
5871 length: Option<u32>,
5872 },
5873 Float {
5877 precision: Option<u32>,
5878 scale: Option<u32>,
5879 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5880 real_spelling: bool,
5881 },
5882 Double {
5883 precision: Option<u32>,
5884 scale: Option<u32>,
5885 },
5886 Decimal {
5887 precision: Option<u32>,
5888 scale: Option<u32>,
5889 },
5890 Oracle {
5892 oracle_type: OracleDataType,
5893 },
5894
5895 Char {
5897 length: Option<u32>,
5898 },
5899 VarChar {
5902 length: Option<u32>,
5903 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
5904 parenthesized_length: bool,
5905 },
5906 String {
5908 length: Option<u32>,
5909 },
5910 Text,
5911 TextWithLength {
5913 length: u32,
5914 },
5915
5916 Binary {
5918 length: Option<u32>,
5919 },
5920 VarBinary {
5921 length: Option<u32>,
5922 },
5923 Blob,
5924
5925 Bit {
5927 length: Option<u32>,
5928 },
5929 VarBit {
5930 length: Option<u32>,
5931 },
5932
5933 Date,
5935 Time {
5936 precision: Option<u32>,
5937 #[serde(default)]
5938 timezone: bool,
5939 },
5940 Timestamp {
5941 precision: Option<u32>,
5942 timezone: bool,
5943 },
5944 Interval {
5945 unit: Option<String>,
5946 #[serde(default, skip_serializing_if = "Option::is_none")]
5948 to: Option<String>,
5949 },
5950
5951 Json,
5953 JsonB,
5954
5955 Uuid,
5957
5958 Array {
5960 element_type: Box<DataType>,
5961 #[serde(default, skip_serializing_if = "Option::is_none")]
5963 dimension: Option<u32>,
5964 },
5965
5966 List {
5969 element_type: Box<DataType>,
5970 },
5971
5972 Struct {
5976 fields: Vec<StructField>,
5977 nested: bool,
5978 },
5979 Map {
5980 key_type: Box<DataType>,
5981 value_type: Box<DataType>,
5982 },
5983
5984 Enum {
5986 values: Vec<String>,
5987 #[serde(default, skip_serializing_if = "Vec::is_empty")]
5988 assignments: Vec<Option<String>>,
5989 },
5990
5991 Set {
5993 values: Vec<String>,
5994 },
5995
5996 Union {
5998 fields: Vec<(String, DataType)>,
5999 },
6000
6001 Vector {
6003 #[serde(default)]
6004 element_type: Option<Box<DataType>>,
6005 dimension: Option<u32>,
6006 },
6007
6008 Object {
6011 fields: Vec<(String, DataType, bool)>,
6012 modifier: Option<String>,
6013 },
6014
6015 Nullable {
6017 inner: Box<DataType>,
6018 },
6019
6020 Custom {
6022 name: String,
6023 },
6024
6025 Geometry {
6027 subtype: Option<String>,
6028 srid: Option<u32>,
6029 },
6030 Geography {
6031 subtype: Option<String>,
6032 srid: Option<u32>,
6033 },
6034
6035 CharacterSet {
6038 name: String,
6039 },
6040
6041 Unknown,
6043}
6044
6045#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6047#[cfg_attr(feature = "bindings", derive(TS))]
6048#[cfg_attr(feature = "bindings", ts(rename = "SqlArray"))]
6049pub struct Array {
6050 pub expressions: Vec<Expression>,
6051}
6052
6053#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6055#[cfg_attr(feature = "bindings", derive(TS))]
6056pub struct Struct {
6057 pub fields: Vec<(Option<String>, Expression)>,
6058}
6059
6060#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6062#[cfg_attr(feature = "bindings", derive(TS))]
6063pub struct Tuple {
6064 pub expressions: Vec<Expression>,
6065}
6066
6067#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6069#[cfg_attr(feature = "bindings", derive(TS))]
6070pub struct Interval {
6071 pub this: Option<Expression>,
6073 pub unit: Option<IntervalUnitSpec>,
6075}
6076
6077#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6079#[cfg_attr(feature = "bindings", derive(TS))]
6080#[serde(tag = "type", rename_all = "snake_case")]
6081pub enum IntervalUnitSpec {
6082 Simple {
6084 unit: IntervalUnit,
6085 use_plural: bool,
6087 },
6088 Span(IntervalSpan),
6090 ExprSpan(IntervalSpanExpr),
6093 Expr(Box<Expression>),
6095}
6096
6097#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6099#[cfg_attr(feature = "bindings", derive(TS))]
6100pub struct IntervalSpan {
6101 pub this: IntervalUnit,
6103 pub expression: IntervalUnit,
6105}
6106
6107#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6110#[cfg_attr(feature = "bindings", derive(TS))]
6111pub struct IntervalSpanExpr {
6112 pub this: Box<Expression>,
6114 pub expression: Box<Expression>,
6116}
6117
6118#[derive(
6119 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
6120)]
6121#[cfg_attr(feature = "bindings", derive(TS))]
6122pub enum IntervalUnit {
6123 Year,
6124 Quarter,
6125 Month,
6126 Week,
6127 Day,
6128 Hour,
6129 Minute,
6130 Second,
6131 Millisecond,
6132 Microsecond,
6133 Nanosecond,
6134}
6135
6136#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6138#[cfg_attr(feature = "bindings", derive(TS))]
6139pub struct Command {
6140 pub this: String,
6142}
6143
6144#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6147#[cfg_attr(feature = "bindings", derive(TS))]
6148pub struct PrepareStatement {
6149 pub name: Identifier,
6151 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6153 pub parameter_types: Vec<DataType>,
6154 pub statement: Expression,
6156}
6157
6158#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6160#[cfg_attr(feature = "bindings", derive(TS))]
6161pub struct TryCatch {
6162 #[serde(default)]
6164 pub try_body: Vec<Expression>,
6165 #[serde(default, skip_serializing_if = "Option::is_none")]
6167 pub catch_body: Option<Vec<Expression>>,
6168}
6169
6170#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6173#[cfg_attr(feature = "bindings", derive(TS))]
6174pub struct ExecuteStatement {
6175 pub this: Expression,
6177 #[serde(default, skip_serializing_if = "Option::is_none")]
6179 pub return_status: Option<String>,
6180 #[serde(default)]
6182 pub parameters: Vec<ExecuteParameter>,
6183 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6185 pub arguments: Vec<Expression>,
6186 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6188 pub prepared: bool,
6189 #[serde(default, skip_serializing_if = "Option::is_none")]
6191 pub suffix: Option<String>,
6192}
6193
6194#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6196#[cfg_attr(feature = "bindings", derive(TS))]
6197pub struct ExecuteParameter {
6198 pub name: String,
6200 pub value: Expression,
6202 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6204 pub positional: bool,
6205 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
6207 pub output: bool,
6208}
6209
6210#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6213#[cfg_attr(feature = "bindings", derive(TS))]
6214pub struct Kill {
6215 pub this: Expression,
6217 pub kind: Option<String>,
6219}
6220
6221#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6223#[cfg_attr(feature = "bindings", derive(TS))]
6224pub struct CreateTask {
6225 pub or_replace: bool,
6226 pub if_not_exists: bool,
6227 pub name: String,
6229 pub properties: String,
6231 pub body: Expression,
6233}
6234
6235#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6237#[cfg_attr(feature = "bindings", derive(TS))]
6238pub struct Raw {
6239 pub sql: String,
6240}
6241
6242#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6248#[cfg_attr(feature = "bindings", derive(TS))]
6249pub struct UnaryFunc {
6250 pub this: Expression,
6251 #[serde(skip_serializing_if = "Option::is_none", default)]
6253 pub original_name: Option<String>,
6254 #[serde(default, skip_serializing_if = "Option::is_none")]
6256 #[ast(skip)]
6257 pub inferred_type: Option<DataType>,
6258}
6259
6260impl UnaryFunc {
6261 pub fn new(this: Expression) -> Self {
6263 Self {
6264 this,
6265 original_name: None,
6266 inferred_type: None,
6267 }
6268 }
6269
6270 pub fn with_name(this: Expression, name: String) -> Self {
6272 Self {
6273 this,
6274 original_name: Some(name),
6275 inferred_type: None,
6276 }
6277 }
6278}
6279
6280#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6284#[cfg_attr(feature = "bindings", derive(TS))]
6285pub struct CharFunc {
6286 pub args: Vec<Expression>,
6287 #[serde(skip_serializing_if = "Option::is_none", default)]
6288 pub charset: Option<String>,
6289 #[serde(skip_serializing_if = "Option::is_none", default)]
6291 pub name: Option<String>,
6292}
6293
6294#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6296#[cfg_attr(feature = "bindings", derive(TS))]
6297pub struct BinaryFunc {
6298 pub this: Expression,
6299 pub expression: Expression,
6300 #[serde(skip_serializing_if = "Option::is_none", default)]
6302 pub original_name: Option<String>,
6303 #[serde(default, skip_serializing_if = "Option::is_none")]
6305 #[ast(skip)]
6306 pub inferred_type: Option<DataType>,
6307}
6308
6309#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6311#[cfg_attr(feature = "bindings", derive(TS))]
6312pub struct VarArgFunc {
6313 pub expressions: Vec<Expression>,
6314 #[serde(skip_serializing_if = "Option::is_none", default)]
6316 pub original_name: Option<String>,
6317 #[serde(default, skip_serializing_if = "Option::is_none")]
6319 #[ast(skip)]
6320 pub inferred_type: Option<DataType>,
6321}
6322
6323#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6325#[cfg_attr(feature = "bindings", derive(TS))]
6326pub struct ConcatWs {
6327 pub separator: Expression,
6328 pub expressions: Vec<Expression>,
6329}
6330
6331#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6333#[cfg_attr(feature = "bindings", derive(TS))]
6334pub struct SubstringFunc {
6335 pub this: Expression,
6336 pub start: Expression,
6337 pub length: Option<Expression>,
6338 #[serde(default)]
6340 pub from_for_syntax: bool,
6341}
6342
6343#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6345#[cfg_attr(feature = "bindings", derive(TS))]
6346pub struct OverlayFunc {
6347 pub this: Expression,
6348 pub replacement: Expression,
6349 pub from: Expression,
6350 pub length: Option<Expression>,
6351}
6352
6353#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6355#[cfg_attr(feature = "bindings", derive(TS))]
6356pub struct TrimFunc {
6357 pub this: Expression,
6358 pub characters: Option<Expression>,
6359 pub position: TrimPosition,
6360 #[serde(default)]
6362 pub sql_standard_syntax: bool,
6363 #[serde(default)]
6365 pub position_explicit: bool,
6366}
6367
6368#[derive(
6369 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
6370)]
6371#[cfg_attr(feature = "bindings", derive(TS))]
6372pub enum TrimPosition {
6373 Both,
6374 Leading,
6375 Trailing,
6376}
6377
6378#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6380#[cfg_attr(feature = "bindings", derive(TS))]
6381pub struct ReplaceFunc {
6382 pub this: Expression,
6383 pub old: Expression,
6384 pub new: Expression,
6385}
6386
6387#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6389#[cfg_attr(feature = "bindings", derive(TS))]
6390pub struct LeftRightFunc {
6391 pub this: Expression,
6392 pub length: Expression,
6393}
6394
6395#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6397#[cfg_attr(feature = "bindings", derive(TS))]
6398pub struct RepeatFunc {
6399 pub this: Expression,
6400 pub times: Expression,
6401}
6402
6403#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6405#[cfg_attr(feature = "bindings", derive(TS))]
6406pub struct PadFunc {
6407 pub this: Expression,
6408 pub length: Expression,
6409 pub fill: Option<Expression>,
6410}
6411
6412#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6414#[cfg_attr(feature = "bindings", derive(TS))]
6415pub struct SplitFunc {
6416 pub this: Expression,
6417 pub delimiter: Expression,
6418}
6419
6420#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6422#[cfg_attr(feature = "bindings", derive(TS))]
6423pub struct RegexpFunc {
6424 pub this: Expression,
6425 pub pattern: Expression,
6426 pub flags: Option<Expression>,
6427}
6428
6429#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6431#[cfg_attr(feature = "bindings", derive(TS))]
6432pub struct RegexpReplaceFunc {
6433 pub this: Expression,
6434 pub pattern: Expression,
6435 pub replacement: Expression,
6436 pub flags: Option<Expression>,
6437}
6438
6439#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6441#[cfg_attr(feature = "bindings", derive(TS))]
6442pub struct RegexpExtractFunc {
6443 pub this: Expression,
6444 pub pattern: Expression,
6445 pub group: Option<Expression>,
6446}
6447
6448#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6450#[cfg_attr(feature = "bindings", derive(TS))]
6451pub struct RoundFunc {
6452 pub this: Expression,
6453 pub decimals: Option<Expression>,
6454}
6455
6456#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6458#[cfg_attr(feature = "bindings", derive(TS))]
6459pub struct FloorFunc {
6460 pub this: Expression,
6461 pub scale: Option<Expression>,
6462 #[serde(skip_serializing_if = "Option::is_none", default)]
6464 pub to: Option<Expression>,
6465}
6466
6467#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6469#[cfg_attr(feature = "bindings", derive(TS))]
6470pub struct CeilFunc {
6471 pub this: Expression,
6472 #[serde(skip_serializing_if = "Option::is_none", default)]
6473 pub decimals: Option<Expression>,
6474 #[serde(skip_serializing_if = "Option::is_none", default)]
6476 pub to: Option<Expression>,
6477}
6478
6479#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6481#[cfg_attr(feature = "bindings", derive(TS))]
6482pub struct LogFunc {
6483 pub this: Expression,
6484 pub base: Option<Expression>,
6485}
6486
6487#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6489#[cfg_attr(feature = "bindings", derive(TS))]
6490pub struct CurrentDate;
6491
6492#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6494#[cfg_attr(feature = "bindings", derive(TS))]
6495pub struct CurrentTime {
6496 pub precision: Option<u32>,
6497}
6498
6499#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6501#[cfg_attr(feature = "bindings", derive(TS))]
6502pub struct CurrentTimestamp {
6503 pub precision: Option<u32>,
6504 #[serde(default)]
6506 pub sysdate: bool,
6507}
6508
6509#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6511#[cfg_attr(feature = "bindings", derive(TS))]
6512pub struct CurrentTimestampLTZ {
6513 pub precision: Option<u32>,
6514}
6515
6516#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6518#[cfg_attr(feature = "bindings", derive(TS))]
6519pub struct AtTimeZone {
6520 pub this: Expression,
6522 pub zone: Expression,
6524}
6525
6526#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6528#[cfg_attr(feature = "bindings", derive(TS))]
6529pub struct DateAddFunc {
6530 pub this: Expression,
6531 pub interval: Expression,
6532 pub unit: IntervalUnit,
6533}
6534
6535#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6537#[cfg_attr(feature = "bindings", derive(TS))]
6538pub struct DateDiffFunc {
6539 pub this: Expression,
6540 pub expression: Expression,
6541 pub unit: Option<IntervalUnit>,
6542}
6543
6544#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6546#[cfg_attr(feature = "bindings", derive(TS))]
6547pub struct DateTruncFunc {
6548 pub this: Expression,
6549 pub unit: DateTimeField,
6550}
6551
6552#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6554#[cfg_attr(feature = "bindings", derive(TS))]
6555pub struct ExtractFunc {
6556 pub this: Expression,
6557 pub field: DateTimeField,
6558}
6559
6560#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
6561#[cfg_attr(feature = "bindings", derive(TS))]
6562pub enum DateTimeField {
6563 Year,
6564 Month,
6565 Day,
6566 Hour,
6567 Minute,
6568 Second,
6569 Millisecond,
6570 Microsecond,
6571 DayOfWeek,
6572 DayOfYear,
6573 Week,
6574 WeekWithModifier(String),
6576 Quarter,
6577 Epoch,
6578 Timezone,
6579 TimezoneHour,
6580 TimezoneMinute,
6581 Date,
6582 Time,
6583 Custom(String),
6585}
6586
6587#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6589#[cfg_attr(feature = "bindings", derive(TS))]
6590pub struct ToDateFunc {
6591 pub this: Expression,
6592 pub format: Option<Expression>,
6593}
6594
6595#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6597#[cfg_attr(feature = "bindings", derive(TS))]
6598pub struct ToTimestampFunc {
6599 pub this: Expression,
6600 pub format: Option<Expression>,
6601}
6602
6603#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6605#[cfg_attr(feature = "bindings", derive(TS))]
6606pub struct IfFunc {
6607 pub condition: Expression,
6608 pub true_value: Expression,
6609 pub false_value: Option<Expression>,
6610 #[serde(skip_serializing_if = "Option::is_none", default)]
6612 pub original_name: Option<String>,
6613 #[serde(default, skip_serializing_if = "Option::is_none")]
6615 #[ast(skip)]
6616 pub inferred_type: Option<DataType>,
6617}
6618
6619#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6621#[cfg_attr(feature = "bindings", derive(TS))]
6622pub struct Nvl2Func {
6623 pub this: Expression,
6624 pub true_value: Expression,
6625 pub false_value: Expression,
6626 #[serde(default, skip_serializing_if = "Option::is_none")]
6628 #[ast(skip)]
6629 pub inferred_type: Option<DataType>,
6630}
6631
6632#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6638#[cfg_attr(feature = "bindings", derive(TS))]
6639pub struct AggFunc {
6640 pub this: Expression,
6641 pub distinct: bool,
6642 pub filter: Option<Expression>,
6643 pub order_by: Vec<Ordered>,
6644 #[serde(skip_serializing_if = "Option::is_none", default)]
6646 pub name: Option<String>,
6647 #[serde(skip_serializing_if = "Option::is_none", default)]
6649 pub ignore_nulls: Option<bool>,
6650 #[serde(skip_serializing_if = "Option::is_none", default)]
6653 pub having_max: Option<(Box<Expression>, bool)>,
6654 #[serde(skip_serializing_if = "Option::is_none", default)]
6656 pub limit: Option<Box<Expression>>,
6657 #[serde(default, skip_serializing_if = "Option::is_none")]
6659 #[ast(skip)]
6660 pub inferred_type: Option<DataType>,
6661}
6662
6663#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6665#[cfg_attr(feature = "bindings", derive(TS))]
6666pub struct CountFunc {
6667 pub this: Option<Expression>,
6668 pub star: bool,
6669 pub distinct: bool,
6670 pub filter: Option<Expression>,
6671 #[serde(default, skip_serializing_if = "Option::is_none")]
6673 pub ignore_nulls: Option<bool>,
6674 #[serde(default, skip_serializing_if = "Option::is_none")]
6676 pub original_name: Option<String>,
6677 #[serde(default, skip_serializing_if = "Option::is_none")]
6679 #[ast(skip)]
6680 pub inferred_type: Option<DataType>,
6681}
6682
6683#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6685#[cfg_attr(feature = "bindings", derive(TS))]
6686pub struct GroupConcatFunc {
6687 pub this: Expression,
6688 pub separator: Option<Expression>,
6689 pub order_by: Option<Vec<Ordered>>,
6690 pub distinct: bool,
6691 pub filter: Option<Expression>,
6692 #[serde(default, skip_serializing_if = "Option::is_none")]
6694 pub limit: Option<Box<Expression>>,
6695 #[serde(default, skip_serializing_if = "Option::is_none")]
6697 #[ast(skip)]
6698 pub inferred_type: Option<DataType>,
6699}
6700
6701#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6703#[cfg_attr(feature = "bindings", derive(TS))]
6704pub struct StringAggFunc {
6705 pub this: Expression,
6706 #[serde(default)]
6707 pub separator: Option<Expression>,
6708 #[serde(default)]
6709 pub order_by: Option<Vec<Ordered>>,
6710 #[serde(default)]
6711 pub distinct: bool,
6712 #[serde(default)]
6713 pub filter: Option<Expression>,
6714 #[serde(default, skip_serializing_if = "Option::is_none")]
6716 pub limit: Option<Box<Expression>>,
6717 #[serde(default, skip_serializing_if = "Option::is_none")]
6719 #[ast(skip)]
6720 pub inferred_type: Option<DataType>,
6721}
6722
6723#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6725#[cfg_attr(feature = "bindings", derive(TS))]
6726pub struct ListAggFunc {
6727 pub this: Expression,
6728 pub separator: Option<Expression>,
6729 pub on_overflow: Option<ListAggOverflow>,
6730 pub order_by: Option<Vec<Ordered>>,
6731 pub distinct: bool,
6732 pub filter: Option<Expression>,
6733 #[serde(default, skip_serializing_if = "Option::is_none")]
6735 #[ast(skip)]
6736 pub inferred_type: Option<DataType>,
6737}
6738
6739#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6741#[cfg_attr(feature = "bindings", derive(TS))]
6742pub enum ListAggOverflow {
6743 Error,
6744 Truncate {
6745 filler: Option<Expression>,
6746 with_count: bool,
6747 },
6748}
6749
6750#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6752#[cfg_attr(feature = "bindings", derive(TS))]
6753pub struct SumIfFunc {
6754 pub this: Expression,
6755 pub condition: Expression,
6756 pub filter: Option<Expression>,
6757 #[serde(default, skip_serializing_if = "Option::is_none")]
6759 #[ast(skip)]
6760 pub inferred_type: Option<DataType>,
6761}
6762
6763#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6765#[cfg_attr(feature = "bindings", derive(TS))]
6766pub struct ApproxPercentileFunc {
6767 pub this: Expression,
6768 pub percentile: Expression,
6769 pub accuracy: Option<Expression>,
6770 pub filter: Option<Expression>,
6771}
6772
6773#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6775#[cfg_attr(feature = "bindings", derive(TS))]
6776pub struct PercentileFunc {
6777 pub this: Expression,
6778 pub percentile: Expression,
6779 pub order_by: Option<Vec<Ordered>>,
6780 pub filter: Option<Expression>,
6781}
6782
6783#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6789#[cfg_attr(feature = "bindings", derive(TS))]
6790pub struct RowNumber;
6791
6792#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6794#[cfg_attr(feature = "bindings", derive(TS))]
6795pub struct Rank {
6796 #[serde(default, skip_serializing_if = "Option::is_none")]
6798 pub order_by: Option<Vec<Ordered>>,
6799 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6801 pub args: Vec<Expression>,
6802}
6803
6804#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6806#[cfg_attr(feature = "bindings", derive(TS))]
6807pub struct DenseRank {
6808 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6810 pub args: Vec<Expression>,
6811}
6812
6813#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6815#[cfg_attr(feature = "bindings", derive(TS))]
6816pub struct NTileFunc {
6817 #[serde(default, skip_serializing_if = "Option::is_none")]
6819 pub num_buckets: Option<Expression>,
6820 #[serde(default, skip_serializing_if = "Option::is_none")]
6822 pub order_by: Option<Vec<Ordered>>,
6823}
6824
6825#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6827#[cfg_attr(feature = "bindings", derive(TS))]
6828pub struct LeadLagFunc {
6829 pub this: Expression,
6830 pub offset: Option<Expression>,
6831 pub default: Option<Expression>,
6832 #[serde(default, skip_serializing_if = "Option::is_none")]
6834 pub ignore_nulls: Option<bool>,
6835}
6836
6837#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6839#[cfg_attr(feature = "bindings", derive(TS))]
6840pub struct ValueFunc {
6841 pub this: Expression,
6842 #[serde(default, skip_serializing_if = "Option::is_none")]
6844 pub ignore_nulls: Option<bool>,
6845 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6847 pub order_by: Vec<Ordered>,
6848}
6849
6850#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6852#[cfg_attr(feature = "bindings", derive(TS))]
6853pub struct NthValueFunc {
6854 pub this: Expression,
6855 pub offset: Expression,
6856 #[serde(default, skip_serializing_if = "Option::is_none")]
6858 pub ignore_nulls: Option<bool>,
6859 #[serde(default, skip_serializing_if = "Option::is_none")]
6862 pub from_first: Option<bool>,
6863}
6864
6865#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6867#[cfg_attr(feature = "bindings", derive(TS))]
6868pub struct PercentRank {
6869 #[serde(default, skip_serializing_if = "Option::is_none")]
6871 pub order_by: Option<Vec<Ordered>>,
6872 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6874 pub args: Vec<Expression>,
6875}
6876
6877#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6879#[cfg_attr(feature = "bindings", derive(TS))]
6880pub struct CumeDist {
6881 #[serde(default, skip_serializing_if = "Option::is_none")]
6883 pub order_by: Option<Vec<Ordered>>,
6884 #[serde(default, skip_serializing_if = "Vec::is_empty")]
6886 pub args: Vec<Expression>,
6887}
6888
6889#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6895#[cfg_attr(feature = "bindings", derive(TS))]
6896pub struct PositionFunc {
6897 pub substring: Expression,
6898 pub string: Expression,
6899 pub start: Option<Expression>,
6900}
6901
6902#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6908#[cfg_attr(feature = "bindings", derive(TS))]
6909pub struct Random;
6910
6911#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6913#[cfg_attr(feature = "bindings", derive(TS))]
6914pub struct Rand {
6915 pub seed: Option<Box<Expression>>,
6916 #[serde(default)]
6918 pub lower: Option<Box<Expression>>,
6919 #[serde(default)]
6921 pub upper: Option<Box<Expression>>,
6922}
6923
6924#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6926#[cfg_attr(feature = "bindings", derive(TS))]
6927pub struct TruncateFunc {
6928 pub this: Expression,
6929 pub decimals: Option<Expression>,
6930}
6931
6932#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6934#[cfg_attr(feature = "bindings", derive(TS))]
6935pub struct Pi;
6936
6937#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6943#[cfg_attr(feature = "bindings", derive(TS))]
6944pub struct DecodeFunc {
6945 pub this: Expression,
6946 pub search_results: Vec<(Expression, Expression)>,
6947 pub default: Option<Expression>,
6948}
6949
6950#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6956#[cfg_attr(feature = "bindings", derive(TS))]
6957pub struct DateFormatFunc {
6958 pub this: Expression,
6959 pub format: Expression,
6960}
6961
6962#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6964#[cfg_attr(feature = "bindings", derive(TS))]
6965pub struct FromUnixtimeFunc {
6966 pub this: Expression,
6967 pub format: Option<Expression>,
6968}
6969
6970#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6972#[cfg_attr(feature = "bindings", derive(TS))]
6973pub struct UnixTimestampFunc {
6974 pub this: Option<Expression>,
6975 pub format: Option<Expression>,
6976}
6977
6978#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6980#[cfg_attr(feature = "bindings", derive(TS))]
6981pub struct MakeDateFunc {
6982 pub year: Expression,
6983 pub month: Expression,
6984 pub day: Expression,
6985}
6986
6987#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
6989#[cfg_attr(feature = "bindings", derive(TS))]
6990pub struct MakeTimestampFunc {
6991 pub year: Expression,
6992 pub month: Expression,
6993 pub day: Expression,
6994 pub hour: Expression,
6995 pub minute: Expression,
6996 pub second: Expression,
6997 pub timezone: Option<Expression>,
6998}
6999
7000#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7002#[cfg_attr(feature = "bindings", derive(TS))]
7003pub struct LastDayFunc {
7004 pub this: Expression,
7005 #[serde(skip_serializing_if = "Option::is_none", default)]
7007 pub unit: Option<DateTimeField>,
7008}
7009
7010#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7016#[cfg_attr(feature = "bindings", derive(TS))]
7017pub struct ArrayConstructor {
7018 pub expressions: Vec<Expression>,
7019 pub bracket_notation: bool,
7020 pub use_list_keyword: bool,
7022}
7023
7024#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7026#[cfg_attr(feature = "bindings", derive(TS))]
7027pub struct ArraySortFunc {
7028 pub this: Expression,
7029 pub comparator: Option<Expression>,
7030 pub desc: bool,
7031 pub nulls_first: Option<bool>,
7032}
7033
7034#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7036#[cfg_attr(feature = "bindings", derive(TS))]
7037pub struct ArrayJoinFunc {
7038 pub this: Expression,
7039 pub separator: Expression,
7040 pub null_replacement: Option<Expression>,
7041}
7042
7043#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7045#[cfg_attr(feature = "bindings", derive(TS))]
7046pub struct UnnestFunc {
7047 pub this: Expression,
7048 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7050 pub expressions: Vec<Expression>,
7051 pub with_ordinality: bool,
7052 pub alias: Option<Identifier>,
7053 #[serde(default, skip_serializing_if = "Option::is_none")]
7055 pub offset_alias: Option<Identifier>,
7056 #[serde(default, skip_serializing_if = "Option::is_none")]
7058 #[ast(skip)]
7059 pub inferred_type: Option<DataType>,
7060}
7061
7062#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7064#[cfg_attr(feature = "bindings", derive(TS))]
7065pub struct ArrayFilterFunc {
7066 pub this: Expression,
7067 pub filter: Expression,
7068}
7069
7070#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7072#[cfg_attr(feature = "bindings", derive(TS))]
7073pub struct ArrayTransformFunc {
7074 pub this: Expression,
7075 pub transform: Expression,
7076}
7077
7078#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7080#[cfg_attr(feature = "bindings", derive(TS))]
7081pub struct SequenceFunc {
7082 pub start: Expression,
7083 pub stop: Expression,
7084 pub step: Option<Expression>,
7085}
7086
7087#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7093#[cfg_attr(feature = "bindings", derive(TS))]
7094pub struct StructConstructor {
7095 pub fields: Vec<(Option<Identifier>, Expression)>,
7096}
7097
7098#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7100#[cfg_attr(feature = "bindings", derive(TS))]
7101pub struct StructExtractFunc {
7102 pub this: Expression,
7103 pub field: Identifier,
7104}
7105
7106#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7108#[cfg_attr(feature = "bindings", derive(TS))]
7109pub struct NamedStructFunc {
7110 pub pairs: Vec<(Expression, Expression)>,
7111}
7112
7113#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7119#[cfg_attr(feature = "bindings", derive(TS))]
7120pub struct MapConstructor {
7121 pub keys: Vec<Expression>,
7122 pub values: Vec<Expression>,
7123 #[serde(default)]
7125 pub curly_brace_syntax: bool,
7126 #[serde(default)]
7128 pub with_map_keyword: bool,
7129}
7130
7131#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7133#[cfg_attr(feature = "bindings", derive(TS))]
7134pub struct TransformFunc {
7135 pub this: Expression,
7136 pub transform: Expression,
7137}
7138
7139#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7142#[cfg_attr(feature = "bindings", derive(TS))]
7143pub struct FunctionEmits {
7144 pub this: Expression,
7146 pub emits: Expression,
7148}
7149
7150#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7156#[cfg_attr(feature = "bindings", derive(TS))]
7157pub struct JsonExtractFunc {
7158 pub this: Expression,
7159 pub path: Expression,
7160 pub returning: Option<DataType>,
7161 #[serde(default)]
7163 pub arrow_syntax: bool,
7164 #[serde(default)]
7166 pub hash_arrow_syntax: bool,
7167 #[serde(default)]
7169 pub wrapper_option: Option<String>,
7170 #[serde(default)]
7172 pub quotes_option: Option<String>,
7173 #[serde(default)]
7175 pub on_scalar_string: bool,
7176 #[serde(default)]
7178 pub on_error: Option<String>,
7179}
7180
7181#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7183#[cfg_attr(feature = "bindings", derive(TS))]
7184pub struct JsonPathFunc {
7185 pub this: Expression,
7186 pub paths: Vec<Expression>,
7187}
7188
7189#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7191#[cfg_attr(feature = "bindings", derive(TS))]
7192pub struct JsonObjectFunc {
7193 pub pairs: Vec<(Expression, Expression)>,
7194 pub null_handling: Option<JsonNullHandling>,
7195 #[serde(default)]
7196 pub with_unique_keys: bool,
7197 #[serde(default)]
7198 pub returning_type: Option<DataType>,
7199 #[serde(default)]
7200 pub format_json: bool,
7201 #[serde(default)]
7202 pub encoding: Option<String>,
7203 #[serde(default)]
7205 pub star: bool,
7206}
7207
7208#[derive(
7210 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
7211)]
7212#[cfg_attr(feature = "bindings", derive(TS))]
7213pub enum JsonNullHandling {
7214 NullOnNull,
7215 AbsentOnNull,
7216}
7217
7218#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7220#[cfg_attr(feature = "bindings", derive(TS))]
7221pub struct JsonModifyFunc {
7222 pub this: Expression,
7223 pub path_values: Vec<(Expression, Expression)>,
7224}
7225
7226#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7228#[cfg_attr(feature = "bindings", derive(TS))]
7229pub struct JsonArrayAggFunc {
7230 pub this: Expression,
7231 pub order_by: Option<Vec<Ordered>>,
7232 pub null_handling: Option<JsonNullHandling>,
7233 pub filter: Option<Expression>,
7234}
7235
7236#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7238#[cfg_attr(feature = "bindings", derive(TS))]
7239pub struct JsonObjectAggFunc {
7240 pub key: Expression,
7241 pub value: Expression,
7242 pub null_handling: Option<JsonNullHandling>,
7243 pub filter: Option<Expression>,
7244}
7245
7246#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7252#[cfg_attr(feature = "bindings", derive(TS))]
7253pub struct ConvertFunc {
7254 pub this: Expression,
7255 pub to: DataType,
7256 pub style: Option<Expression>,
7257}
7258
7259#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7265#[cfg_attr(feature = "bindings", derive(TS))]
7266pub struct LambdaExpr {
7267 pub parameters: Vec<Identifier>,
7268 pub body: Expression,
7269 #[serde(default)]
7271 pub colon: bool,
7272 #[serde(default)]
7275 pub parameter_types: Vec<Option<DataType>>,
7276}
7277
7278#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7280#[cfg_attr(feature = "bindings", derive(TS))]
7281pub struct Parameter {
7282 pub name: Option<String>,
7283 pub index: Option<u32>,
7284 pub style: ParameterStyle,
7285 #[serde(default)]
7287 pub quoted: bool,
7288 #[serde(default)]
7290 pub string_quoted: bool,
7291 #[serde(default)]
7293 pub expression: Option<String>,
7294}
7295
7296#[derive(
7298 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
7299)]
7300#[cfg_attr(feature = "bindings", derive(TS))]
7301pub enum ParameterStyle {
7302 Question, Dollar, DollarBrace, Brace, Colon, At, DoubleAt, DoubleDollar, Percent, }
7312
7313#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7315#[cfg_attr(feature = "bindings", derive(TS))]
7316pub struct Placeholder {
7317 pub index: Option<u32>,
7318}
7319
7320#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7322#[cfg_attr(feature = "bindings", derive(TS))]
7323pub struct NamedArgument {
7324 pub name: Identifier,
7325 pub value: Expression,
7326 pub separator: NamedArgSeparator,
7328}
7329
7330#[derive(
7332 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
7333)]
7334#[cfg_attr(feature = "bindings", derive(TS))]
7335pub enum NamedArgSeparator {
7336 DArrow,
7338 ColonEq,
7340 Eq,
7342}
7343
7344#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7347#[cfg_attr(feature = "bindings", derive(TS))]
7348pub struct TableArgument {
7349 pub prefix: String,
7351 pub this: Expression,
7353}
7354
7355#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7357#[cfg_attr(feature = "bindings", derive(TS))]
7358pub struct SqlComment {
7359 pub text: String,
7360 pub is_block: bool,
7361}
7362
7363#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7369#[cfg_attr(feature = "bindings", derive(TS))]
7370pub struct SimilarToExpr {
7371 pub this: Expression,
7372 pub pattern: Expression,
7373 pub escape: Option<Expression>,
7374 pub not: bool,
7375}
7376
7377#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7379#[cfg_attr(feature = "bindings", derive(TS))]
7380pub struct QuantifiedExpr {
7381 pub this: Expression,
7382 pub subquery: Expression,
7383 pub op: Option<QuantifiedOp>,
7384}
7385
7386#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7388#[cfg_attr(feature = "bindings", derive(TS))]
7389pub enum QuantifiedOp {
7390 Eq,
7391 Neq,
7392 Lt,
7393 Lte,
7394 Gt,
7395 Gte,
7396}
7397
7398#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7403#[cfg_attr(feature = "bindings", derive(TS))]
7404pub struct OverlapsExpr {
7405 #[serde(skip_serializing_if = "Option::is_none")]
7407 pub this: Option<Expression>,
7408 #[serde(skip_serializing_if = "Option::is_none")]
7410 pub expression: Option<Expression>,
7411 #[serde(skip_serializing_if = "Option::is_none")]
7413 pub left_start: Option<Expression>,
7414 #[serde(skip_serializing_if = "Option::is_none")]
7416 pub left_end: Option<Expression>,
7417 #[serde(skip_serializing_if = "Option::is_none")]
7419 pub right_start: Option<Expression>,
7420 #[serde(skip_serializing_if = "Option::is_none")]
7422 pub right_end: Option<Expression>,
7423}
7424
7425#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7431#[cfg_attr(feature = "bindings", derive(TS))]
7432pub struct Subscript {
7433 pub this: Expression,
7434 pub index: Expression,
7435}
7436
7437#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7439#[cfg_attr(feature = "bindings", derive(TS))]
7440pub struct DotAccess {
7441 pub this: Expression,
7442 pub field: Identifier,
7443 #[serde(default, skip_serializing_if = "Option::is_none")]
7444 pub inferred_type: Option<DataType>,
7445}
7446
7447#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7449#[cfg_attr(feature = "bindings", derive(TS))]
7450pub struct MethodCall {
7451 pub this: Expression,
7452 pub method: Identifier,
7453 pub args: Vec<Expression>,
7454}
7455
7456#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7458#[cfg_attr(feature = "bindings", derive(TS))]
7459pub struct ArraySlice {
7460 pub this: Expression,
7461 pub start: Option<Expression>,
7462 pub end: Option<Expression>,
7463}
7464
7465#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7471#[cfg_attr(feature = "bindings", derive(TS))]
7472pub enum OnCommit {
7473 PreserveRows,
7475 DeleteRows,
7477}
7478
7479#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7481#[cfg_attr(feature = "bindings", derive(TS))]
7482pub struct TiDBAutoRandom {
7483 #[serde(default, skip_serializing_if = "Option::is_none")]
7484 pub shard_bits: Option<u64>,
7485 #[serde(default, skip_serializing_if = "Option::is_none")]
7486 pub range_bits: Option<u64>,
7487 #[serde(default)]
7489 pub executable_comment: bool,
7490}
7491
7492#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7494#[cfg_attr(feature = "bindings", derive(TS))]
7495pub struct TiDBTableOption {
7496 pub kind: TiDBTableOptionKind,
7497 #[serde(default)]
7499 pub executable_comment: bool,
7500}
7501
7502#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7504#[cfg_attr(feature = "bindings", derive(TS))]
7505#[serde(tag = "type", rename_all = "snake_case")]
7506pub enum TiDBTableOptionKind {
7507 ShardRowIdBits {
7508 bits: u64,
7509 },
7510 PreSplitRegions {
7511 regions: u64,
7512 },
7513 AutoRandomBase {
7514 value: u64,
7515 },
7516 PlacementPolicy {
7518 policy: Option<Identifier>,
7519 },
7520 Ttl {
7521 column: Identifier,
7522 interval: Interval,
7523 #[serde(default, skip_serializing_if = "Option::is_none")]
7524 enabled: Option<bool>,
7525 },
7526 TtlEnable {
7527 enabled: bool,
7528 },
7529 TtlJobInterval {
7530 interval: String,
7531 },
7532}
7533
7534#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7536#[cfg_attr(feature = "bindings", derive(TS))]
7537pub struct CreateTable {
7538 pub name: TableRef,
7539 #[serde(default, skip_serializing_if = "Option::is_none")]
7541 pub on_cluster: Option<OnCluster>,
7542 pub columns: Vec<ColumnDef>,
7543 pub constraints: Vec<TableConstraint>,
7544 pub if_not_exists: bool,
7545 pub temporary: bool,
7546 pub or_replace: bool,
7547 #[serde(default, skip_serializing_if = "Option::is_none")]
7549 pub table_modifier: Option<String>,
7550 pub as_select: Option<Expression>,
7551 #[serde(default)]
7553 pub as_select_parenthesized: bool,
7554 #[serde(default)]
7556 pub on_commit: Option<OnCommit>,
7557 #[serde(default)]
7559 pub clone_source: Option<TableRef>,
7560 #[serde(default, skip_serializing_if = "Option::is_none")]
7562 pub clone_at_clause: Option<Expression>,
7563 #[serde(default)]
7565 pub is_copy: bool,
7566 #[serde(default)]
7568 pub shallow_clone: bool,
7569 #[serde(default)]
7571 pub deep_clone: bool,
7572 #[serde(default)]
7574 pub leading_comments: Vec<String>,
7575 #[serde(default)]
7577 pub with_properties: Vec<(String, String)>,
7578 #[serde(default)]
7580 pub teradata_post_name_options: Vec<String>,
7581 #[serde(default)]
7583 pub with_data: Option<bool>,
7584 #[serde(default)]
7586 pub with_statistics: Option<bool>,
7587 #[serde(default)]
7589 pub teradata_indexes: Vec<TeradataIndex>,
7590 #[serde(default)]
7592 pub with_cte: Option<With>,
7593 #[serde(default)]
7595 pub properties: Vec<Expression>,
7596 #[serde(default, skip_serializing_if = "Option::is_none")]
7598 pub partition_of: Option<Expression>,
7599 #[serde(default)]
7601 pub post_table_properties: Vec<Expression>,
7602 #[serde(default)]
7604 pub mysql_table_options: Vec<(String, String)>,
7605 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7607 pub tidb_table_options: Vec<TiDBTableOption>,
7608 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7610 pub inherits: Vec<TableRef>,
7611 #[serde(default, skip_serializing_if = "Option::is_none")]
7613 pub on_property: Option<OnProperty>,
7614 #[serde(default)]
7616 pub copy_grants: bool,
7617 #[serde(default, skip_serializing_if = "Option::is_none")]
7619 pub using_template: Option<Box<Expression>>,
7620 #[serde(default, skip_serializing_if = "Option::is_none")]
7622 pub rollup: Option<RollupProperty>,
7623 #[serde(default, skip_serializing_if = "Option::is_none")]
7625 pub uuid: Option<String>,
7626 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7630 pub with_partition_columns: Vec<ColumnDef>,
7631 #[serde(default, skip_serializing_if = "Option::is_none")]
7634 pub with_connection: Option<TableRef>,
7635}
7636
7637#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7639#[cfg_attr(feature = "bindings", derive(TS))]
7640pub struct TeradataIndex {
7641 pub kind: TeradataIndexKind,
7643 pub name: Option<String>,
7645 pub columns: Vec<String>,
7647}
7648
7649#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7651#[cfg_attr(feature = "bindings", derive(TS))]
7652pub enum TeradataIndexKind {
7653 NoPrimary,
7655 Primary,
7657 PrimaryAmp,
7659 Unique,
7661 UniquePrimary,
7663 Secondary,
7665}
7666
7667impl CreateTable {
7668 pub fn new(name: impl Into<String>) -> Self {
7669 Self {
7670 name: TableRef::new(name),
7671 on_cluster: None,
7672 columns: Vec::new(),
7673 constraints: Vec::new(),
7674 if_not_exists: false,
7675 temporary: false,
7676 or_replace: false,
7677 table_modifier: None,
7678 as_select: None,
7679 as_select_parenthesized: false,
7680 on_commit: None,
7681 clone_source: None,
7682 clone_at_clause: None,
7683 shallow_clone: false,
7684 deep_clone: false,
7685 is_copy: false,
7686 leading_comments: Vec::new(),
7687 with_properties: Vec::new(),
7688 teradata_post_name_options: Vec::new(),
7689 with_data: None,
7690 with_statistics: None,
7691 teradata_indexes: Vec::new(),
7692 with_cte: None,
7693 properties: Vec::new(),
7694 partition_of: None,
7695 post_table_properties: Vec::new(),
7696 mysql_table_options: Vec::new(),
7697 tidb_table_options: Vec::new(),
7698 inherits: Vec::new(),
7699 on_property: None,
7700 copy_grants: false,
7701 using_template: None,
7702 rollup: None,
7703 uuid: None,
7704 with_partition_columns: Vec::new(),
7705 with_connection: None,
7706 }
7707 }
7708}
7709
7710#[derive(
7712 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Serialize, Deserialize,
7713)]
7714#[cfg_attr(feature = "bindings", derive(TS))]
7715pub enum SortOrder {
7716 Asc,
7717 Desc,
7718}
7719
7720#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7722#[cfg_attr(feature = "bindings", derive(TS))]
7723pub enum ConstraintType {
7724 NotNull,
7725 Null,
7726 PrimaryKey,
7727 Unique,
7728 Default,
7729 AutoIncrement,
7730 AutoRandom,
7731 Collate,
7732 Comment,
7733 References,
7734 Check,
7735 GeneratedAsIdentity,
7736 Tags,
7738 ComputedColumn,
7740 GeneratedAsRow,
7742 OnUpdate,
7744 Path,
7746 Encode,
7748}
7749
7750#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7752#[cfg_attr(feature = "bindings", derive(TS))]
7753pub struct ColumnDef {
7754 pub name: Identifier,
7755 pub data_type: DataType,
7756 pub nullable: Option<bool>,
7757 pub default: Option<Expression>,
7758 pub primary_key: bool,
7759 #[serde(default)]
7761 pub primary_key_order: Option<SortOrder>,
7762 pub unique: bool,
7763 #[serde(default)]
7765 pub unique_nulls_not_distinct: bool,
7766 pub auto_increment: bool,
7767 #[serde(default, skip_serializing_if = "Option::is_none")]
7769 pub auto_random: Option<TiDBAutoRandom>,
7770 pub comment: Option<String>,
7771 pub constraints: Vec<ColumnConstraint>,
7772 #[serde(default)]
7774 pub constraint_order: Vec<ConstraintType>,
7775 #[serde(default)]
7777 pub format: Option<String>,
7778 #[serde(default)]
7780 pub title: Option<String>,
7781 #[serde(default)]
7783 pub inline_length: Option<u64>,
7784 #[serde(default)]
7786 pub compress: Option<Vec<Expression>>,
7787 #[serde(default)]
7789 pub character_set: Option<String>,
7790 #[serde(default)]
7792 pub uppercase: bool,
7793 #[serde(default)]
7795 pub casespecific: Option<bool>,
7796 #[serde(default)]
7798 pub auto_increment_start: Option<Box<Expression>>,
7799 #[serde(default)]
7801 pub auto_increment_increment: Option<Box<Expression>>,
7802 #[serde(default)]
7804 pub auto_increment_order: Option<bool>,
7805 #[serde(default)]
7807 pub unsigned: bool,
7808 #[serde(default)]
7810 pub zerofill: bool,
7811 #[serde(default, skip_serializing_if = "Option::is_none")]
7813 pub on_update: Option<Expression>,
7814 #[serde(default, skip_serializing_if = "Option::is_none")]
7816 pub visible: Option<bool>,
7817 #[serde(default, skip_serializing_if = "Option::is_none")]
7819 pub unique_constraint_name: Option<String>,
7820 #[serde(default, skip_serializing_if = "Option::is_none")]
7822 pub not_null_constraint_name: Option<String>,
7823 #[serde(default, skip_serializing_if = "Option::is_none")]
7825 pub primary_key_constraint_name: Option<String>,
7826 #[serde(default, skip_serializing_if = "Option::is_none")]
7828 pub check_constraint_name: Option<String>,
7829 #[serde(default, skip_serializing_if = "Vec::is_empty")]
7831 pub options: Vec<Expression>,
7832 #[serde(default)]
7834 pub no_type: bool,
7835 #[serde(default, skip_serializing_if = "Option::is_none")]
7837 pub encoding: Option<String>,
7838 #[serde(default, skip_serializing_if = "Option::is_none")]
7840 pub codec: Option<String>,
7841 #[serde(default, skip_serializing_if = "Option::is_none")]
7843 pub ephemeral: Option<Option<Box<Expression>>>,
7844 #[serde(default, skip_serializing_if = "Option::is_none")]
7846 pub materialized_expr: Option<Box<Expression>>,
7847 #[serde(default, skip_serializing_if = "Option::is_none")]
7849 pub alias_expr: Option<Box<Expression>>,
7850 #[serde(default, skip_serializing_if = "Option::is_none")]
7852 pub ttl_expr: Option<Box<Expression>>,
7853 #[serde(default)]
7855 pub not_for_replication: bool,
7856}
7857
7858impl ColumnDef {
7859 pub fn new(name: impl Into<String>, data_type: DataType) -> Self {
7860 Self {
7861 name: Identifier::new(name),
7862 data_type,
7863 nullable: None,
7864 default: None,
7865 primary_key: false,
7866 primary_key_order: None,
7867 unique: false,
7868 unique_nulls_not_distinct: false,
7869 auto_increment: false,
7870 auto_random: None,
7871 comment: None,
7872 constraints: Vec::new(),
7873 constraint_order: Vec::new(),
7874 format: None,
7875 title: None,
7876 inline_length: None,
7877 compress: None,
7878 character_set: None,
7879 uppercase: false,
7880 casespecific: None,
7881 auto_increment_start: None,
7882 auto_increment_increment: None,
7883 auto_increment_order: None,
7884 unsigned: false,
7885 zerofill: false,
7886 on_update: None,
7887 visible: None,
7888 unique_constraint_name: None,
7889 not_null_constraint_name: None,
7890 primary_key_constraint_name: None,
7891 check_constraint_name: None,
7892 options: Vec::new(),
7893 no_type: false,
7894 encoding: None,
7895 codec: None,
7896 ephemeral: None,
7897 materialized_expr: None,
7898 alias_expr: None,
7899 ttl_expr: None,
7900 not_for_replication: false,
7901 }
7902 }
7903}
7904
7905#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7907#[cfg_attr(feature = "bindings", derive(TS))]
7908pub enum ColumnConstraint {
7909 NotNull,
7910 Null,
7911 Unique,
7912 PrimaryKey,
7913 Default(Expression),
7914 Check(Expression),
7915 References(ForeignKeyRef),
7916 GeneratedAsIdentity(GeneratedAsIdentity),
7917 Collate(Identifier),
7918 Comment(String),
7919 Tags(Tags),
7921 ComputedColumn(ComputedColumn),
7924 GeneratedAsRow(GeneratedAsRow),
7926 Path(Expression),
7928}
7929
7930#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7932#[cfg_attr(feature = "bindings", derive(TS))]
7933pub struct ComputedColumn {
7934 pub expression: Box<Expression>,
7936 #[serde(default)]
7938 pub persisted: bool,
7939 #[serde(default)]
7941 pub not_null: bool,
7942 #[serde(default)]
7945 pub persistence_kind: Option<String>,
7946 #[serde(default, skip_serializing_if = "Option::is_none")]
7948 pub data_type: Option<DataType>,
7949}
7950
7951#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7953#[cfg_attr(feature = "bindings", derive(TS))]
7954pub struct GeneratedAsRow {
7955 pub start: bool,
7957 #[serde(default)]
7959 pub hidden: bool,
7960}
7961
7962#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
7964#[cfg_attr(feature = "bindings", derive(TS))]
7965pub struct GeneratedAsIdentity {
7966 pub always: bool,
7968 pub on_null: bool,
7970 pub start: Option<Box<Expression>>,
7972 pub increment: Option<Box<Expression>>,
7974 pub minvalue: Option<Box<Expression>>,
7976 pub maxvalue: Option<Box<Expression>>,
7978 pub cycle: Option<bool>,
7980}
7981
7982#[derive(
7984 polyglot_sql_ast_derive::AstNode, Debug, Clone, Default, PartialEq, Serialize, Deserialize,
7985)]
7986#[cfg_attr(feature = "bindings", derive(TS))]
7987pub struct ConstraintModifiers {
7988 pub enforced: Option<bool>,
7990 pub deferrable: Option<bool>,
7992 pub initially_deferred: Option<bool>,
7994 pub norely: bool,
7996 pub rely: bool,
7998 #[serde(default)]
8000 pub using: Option<String>,
8001 #[serde(default)]
8003 pub using_before_columns: bool,
8004 #[serde(default, skip_serializing_if = "Option::is_none")]
8006 pub comment: Option<String>,
8007 #[serde(default, skip_serializing_if = "Option::is_none")]
8009 pub visible: Option<bool>,
8010 #[serde(default, skip_serializing_if = "Option::is_none")]
8012 pub engine_attribute: Option<String>,
8013 #[serde(default, skip_serializing_if = "Option::is_none")]
8015 pub with_parser: Option<String>,
8016 #[serde(default)]
8018 pub not_valid: bool,
8019 #[serde(default, skip_serializing_if = "Option::is_none")]
8021 pub clustered: Option<String>,
8022 #[serde(default, skip_serializing_if = "Option::is_none")]
8024 pub on_conflict: Option<String>,
8025 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8027 pub with_options: Vec<(String, String)>,
8028 #[serde(default, skip_serializing_if = "Option::is_none")]
8030 pub on_filegroup: Option<Identifier>,
8031}
8032
8033#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8035#[cfg_attr(feature = "bindings", derive(TS))]
8036pub enum TableConstraint {
8037 PrimaryKey {
8038 name: Option<Identifier>,
8039 columns: Vec<Identifier>,
8040 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8042 timeseries_columns: Vec<Identifier>,
8043 #[serde(default)]
8045 include_columns: Vec<Identifier>,
8046 #[serde(default)]
8047 modifiers: ConstraintModifiers,
8048 #[serde(default)]
8050 has_constraint_keyword: bool,
8051 },
8052 Unique {
8053 name: Option<Identifier>,
8054 columns: Vec<Identifier>,
8055 #[serde(default)]
8057 columns_parenthesized: bool,
8058 #[serde(default)]
8059 modifiers: ConstraintModifiers,
8060 #[serde(default)]
8062 has_constraint_keyword: bool,
8063 #[serde(default)]
8065 nulls_not_distinct: bool,
8066 },
8067 ForeignKey {
8068 name: Option<Identifier>,
8069 columns: Vec<Identifier>,
8070 #[serde(default)]
8071 references: Option<ForeignKeyRef>,
8072 #[serde(default)]
8074 on_delete: Option<ReferentialAction>,
8075 #[serde(default)]
8077 on_update: Option<ReferentialAction>,
8078 #[serde(default)]
8079 modifiers: ConstraintModifiers,
8080 },
8081 Check {
8082 name: Option<Identifier>,
8083 expression: Expression,
8084 #[serde(default)]
8085 modifiers: ConstraintModifiers,
8086 },
8087 Assume {
8089 name: Option<Identifier>,
8090 expression: Expression,
8091 },
8092 Default {
8094 name: Option<Identifier>,
8095 expression: Expression,
8096 column: Identifier,
8097 },
8098 Index {
8100 name: Option<Identifier>,
8101 columns: Vec<Identifier>,
8102 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8105 key_parts: Vec<IndexKeyPart>,
8106 #[serde(default)]
8108 kind: Option<String>,
8109 #[serde(default)]
8110 modifiers: ConstraintModifiers,
8111 #[serde(default)]
8113 use_key_keyword: bool,
8114 #[serde(default, skip_serializing_if = "Option::is_none")]
8116 expression: Option<Box<Expression>>,
8117 #[serde(default, skip_serializing_if = "Option::is_none")]
8119 index_type: Option<Box<Expression>>,
8120 #[serde(default, skip_serializing_if = "Option::is_none")]
8122 granularity: Option<Box<Expression>>,
8123 },
8124 Projection {
8126 name: Identifier,
8127 expression: Expression,
8128 },
8129 Like {
8131 source: TableRef,
8132 options: Vec<(LikeOptionAction, String)>,
8134 },
8135 PeriodForSystemTime {
8137 start_col: Identifier,
8138 end_col: Identifier,
8139 },
8140 Exclude {
8143 name: Option<Identifier>,
8144 #[serde(default)]
8146 using: Option<String>,
8147 elements: Vec<ExcludeElement>,
8149 #[serde(default)]
8151 include_columns: Vec<Identifier>,
8152 #[serde(default)]
8154 where_clause: Option<Box<Expression>>,
8155 #[serde(default)]
8157 with_params: Vec<(String, String)>,
8158 #[serde(default)]
8160 using_index_tablespace: Option<String>,
8161 #[serde(default)]
8162 modifiers: ConstraintModifiers,
8163 },
8164 Tags(Tags),
8166 InitiallyDeferred {
8170 deferred: bool,
8172 },
8173}
8174
8175#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8177#[cfg_attr(feature = "bindings", derive(TS))]
8178pub struct ExcludeElement {
8179 pub expression: String,
8181 pub operator: String,
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 LikeOptionAction {
8191 Including,
8192 Excluding,
8193}
8194
8195#[derive(
8197 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8198)]
8199#[cfg_attr(feature = "bindings", derive(TS))]
8200pub enum MatchType {
8201 Full,
8202 Partial,
8203 Simple,
8204}
8205
8206#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8208#[cfg_attr(feature = "bindings", derive(TS))]
8209pub struct ForeignKeyRef {
8210 pub table: TableRef,
8211 pub columns: Vec<Identifier>,
8212 pub on_delete: Option<ReferentialAction>,
8213 pub on_update: Option<ReferentialAction>,
8214 #[serde(default)]
8216 pub on_update_first: bool,
8217 #[serde(default)]
8219 pub match_type: Option<MatchType>,
8220 #[serde(default)]
8222 pub match_after_actions: bool,
8223 #[serde(default)]
8225 pub constraint_name: Option<String>,
8226 #[serde(default)]
8228 pub deferrable: Option<bool>,
8229 #[serde(default)]
8231 pub has_foreign_key_keywords: bool,
8232}
8233
8234#[derive(
8236 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8237)]
8238#[cfg_attr(feature = "bindings", derive(TS))]
8239pub enum ReferentialAction {
8240 Cascade,
8241 SetNull,
8242 SetDefault,
8243 Restrict,
8244 NoAction,
8245}
8246
8247#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8249#[cfg_attr(feature = "bindings", derive(TS))]
8250pub struct DropTable {
8251 pub names: Vec<TableRef>,
8252 pub if_exists: bool,
8253 pub cascade: bool,
8254 #[serde(default)]
8256 pub cascade_constraints: bool,
8257 #[serde(default)]
8259 pub purge: bool,
8260 #[serde(default)]
8262 pub leading_comments: Vec<String>,
8263 #[serde(default, skip_serializing_if = "Option::is_none")]
8266 pub object_id_args: Option<String>,
8267 #[serde(default)]
8269 pub sync: bool,
8270 #[serde(default)]
8272 pub iceberg: bool,
8273 #[serde(default)]
8275 pub restrict: bool,
8276}
8277
8278impl DropTable {
8279 pub fn new(name: impl Into<String>) -> Self {
8280 Self {
8281 names: vec![TableRef::new(name)],
8282 if_exists: false,
8283 cascade: false,
8284 cascade_constraints: false,
8285 purge: false,
8286 leading_comments: Vec::new(),
8287 object_id_args: None,
8288 sync: false,
8289 iceberg: false,
8290 restrict: false,
8291 }
8292 }
8293}
8294
8295#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8297#[cfg_attr(feature = "bindings", derive(TS))]
8298pub struct Undrop {
8299 pub kind: String,
8301 pub name: TableRef,
8303 #[serde(default)]
8305 pub if_exists: bool,
8306 #[serde(default, skip_serializing_if = "Option::is_none")]
8308 pub rename_to: Option<TableRef>,
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 SplitTablePartitionScope {
8316 Table,
8317 AllPartitions,
8318 Partitions { names: Vec<Identifier> },
8319}
8320
8321#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8323#[cfg_attr(feature = "bindings", derive(TS))]
8324#[serde(tag = "type", rename_all = "snake_case")]
8325pub enum SplitTableMode {
8326 Between {
8327 lower: Vec<Expression>,
8328 upper: Vec<Expression>,
8329 regions: u64,
8330 },
8331 By {
8332 points: Vec<Vec<Expression>>,
8333 },
8334}
8335
8336#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8338#[cfg_attr(feature = "bindings", derive(TS))]
8339pub struct SplitTable {
8340 pub table: TableRef,
8341 pub partition_scope: SplitTablePartitionScope,
8342 #[serde(default, skip_serializing_if = "Option::is_none")]
8343 pub index: Option<Identifier>,
8344 pub mode: SplitTableMode,
8345}
8346
8347#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8349#[cfg_attr(feature = "bindings", derive(TS))]
8350pub struct FlashbackTable {
8351 pub table: TableRef,
8352 #[serde(default, skip_serializing_if = "Option::is_none")]
8353 pub rename_to: Option<Identifier>,
8354}
8355
8356#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8358#[cfg_attr(feature = "bindings", derive(TS))]
8359pub struct AlterTable {
8360 pub name: TableRef,
8361 pub actions: Vec<AlterTableAction>,
8362 #[serde(default)]
8364 pub if_exists: bool,
8365 #[serde(default, skip_serializing_if = "Option::is_none")]
8367 pub algorithm: Option<String>,
8368 #[serde(default, skip_serializing_if = "Option::is_none")]
8370 pub lock: Option<String>,
8371 #[serde(default, skip_serializing_if = "Option::is_none")]
8373 pub with_check: Option<String>,
8374 #[serde(default, skip_serializing_if = "Option::is_none")]
8376 pub partition: Option<Vec<(Identifier, Expression)>>,
8377 #[serde(default, skip_serializing_if = "Option::is_none")]
8379 pub on_cluster: Option<OnCluster>,
8380 #[serde(default, skip_serializing_if = "Option::is_none")]
8382 pub table_modifier: Option<String>,
8383}
8384
8385impl AlterTable {
8386 pub fn new(name: impl Into<String>) -> Self {
8387 Self {
8388 name: TableRef::new(name),
8389 actions: Vec::new(),
8390 if_exists: false,
8391 algorithm: None,
8392 lock: None,
8393 with_check: None,
8394 partition: None,
8395 on_cluster: None,
8396 table_modifier: None,
8397 }
8398 }
8399}
8400
8401#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8403#[cfg_attr(feature = "bindings", derive(TS))]
8404pub enum ColumnPosition {
8405 First,
8406 After(Identifier),
8407}
8408
8409#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8411#[cfg_attr(feature = "bindings", derive(TS))]
8412pub enum AlterTableAction {
8413 AddColumn {
8414 column: ColumnDef,
8415 if_not_exists: bool,
8416 position: Option<ColumnPosition>,
8417 },
8418 DropColumn {
8419 name: Identifier,
8420 if_exists: bool,
8421 cascade: bool,
8422 },
8423 RenameColumn {
8424 old_name: Identifier,
8425 new_name: Identifier,
8426 if_exists: bool,
8427 },
8428 AlterColumn {
8429 name: Identifier,
8430 action: AlterColumnAction,
8431 #[serde(default)]
8433 use_modify_keyword: bool,
8434 },
8435 ModifyColumn {
8437 column: ColumnDef,
8438 if_exists: bool,
8439 position: Option<ColumnPosition>,
8440 },
8441 RenameTable(TableRef),
8442 AddConstraint(TableConstraint),
8443 DropConstraint {
8444 name: Identifier,
8445 if_exists: bool,
8446 },
8447 DropForeignKey {
8449 name: Identifier,
8450 },
8451 DropPartition {
8453 partitions: Vec<Vec<(Identifier, Expression)>>,
8455 if_exists: bool,
8456 },
8457 AddPartition {
8459 partition: Expression,
8461 if_not_exists: bool,
8462 location: Option<Expression>,
8463 },
8464 Delete {
8466 where_clause: Expression,
8467 },
8468 SwapWith(TableRef),
8470 SetProperty {
8472 properties: Vec<(String, Expression)>,
8473 },
8474 UnsetProperty {
8476 properties: Vec<String>,
8477 },
8478 ClusterBy {
8480 expressions: Vec<Expression>,
8481 },
8482 SetTag {
8484 expressions: Vec<(String, Expression)>,
8485 },
8486 UnsetTag {
8488 names: Vec<String>,
8489 },
8490 SetOptions {
8492 expressions: Vec<Expression>,
8493 },
8494 AlterIndex {
8496 name: Identifier,
8497 visible: bool,
8498 },
8499 SetAttribute {
8501 attribute: String,
8502 },
8503 SetStageFileFormat {
8505 options: Option<Expression>,
8506 },
8507 SetStageCopyOptions {
8509 options: Option<Expression>,
8510 },
8511 AddColumns {
8513 columns: Vec<ColumnDef>,
8514 cascade: bool,
8515 },
8516 DropColumns {
8518 names: Vec<Identifier>,
8519 },
8520 ChangeColumn {
8523 old_name: Identifier,
8524 new_name: Identifier,
8525 #[serde(default, skip_serializing_if = "Option::is_none")]
8526 data_type: Option<DataType>,
8527 comment: Option<String>,
8528 #[serde(default)]
8529 cascade: bool,
8530 },
8531 AlterSortKey {
8534 this: Option<String>,
8536 expressions: Vec<Expression>,
8538 compound: bool,
8540 },
8541 AlterDistStyle {
8545 style: String,
8547 distkey: Option<Identifier>,
8549 },
8550 SetTableProperties {
8552 properties: Vec<(Expression, Expression)>,
8553 },
8554 SetLocation {
8556 location: String,
8557 },
8558 SetFileFormat {
8560 format: String,
8561 },
8562 ReplacePartition {
8564 partition: Expression,
8565 source: Option<Box<Expression>>,
8566 },
8567 SetTiDBTableOption {
8569 option: TiDBTableOption,
8570 #[serde(default)]
8571 force: bool,
8572 },
8573 RemoveTiDBTtl {
8575 #[serde(default)]
8576 executable_comment: bool,
8577 },
8578 Raw {
8580 sql: String,
8581 },
8582}
8583
8584#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8586#[cfg_attr(feature = "bindings", derive(TS))]
8587pub enum AlterColumnAction {
8588 SetDataType {
8589 data_type: DataType,
8590 using: Option<Expression>,
8592 #[serde(default, skip_serializing_if = "Option::is_none")]
8594 collate: Option<String>,
8595 },
8596 SetDefault(Expression),
8597 DropDefault,
8598 SetNotNull,
8599 DropNotNull,
8600 Comment(String),
8602 SetVisible,
8604 SetInvisible,
8606}
8607
8608#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8610#[cfg_attr(feature = "bindings", derive(TS))]
8611pub struct CreateIndex {
8612 pub name: Identifier,
8613 pub table: TableRef,
8614 pub columns: Vec<IndexColumn>,
8615 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8618 pub key_parts: Vec<IndexKeyPart>,
8619 pub unique: bool,
8620 pub if_not_exists: bool,
8621 pub using: Option<String>,
8622 #[serde(default)]
8624 pub clustered: Option<String>,
8625 #[serde(default)]
8627 pub concurrently: bool,
8628 #[serde(default)]
8630 pub where_clause: Option<Box<Expression>>,
8631 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8633 pub include_columns: Vec<Identifier>,
8634 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8636 pub with_options: Vec<(String, String)>,
8637 #[serde(default)]
8639 pub on_filegroup: Option<String>,
8640}
8641
8642impl CreateIndex {
8643 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
8644 Self {
8645 name: Identifier::new(name),
8646 table: TableRef::new(table),
8647 columns: Vec::new(),
8648 key_parts: Vec::new(),
8649 unique: false,
8650 if_not_exists: false,
8651 using: None,
8652 clustered: None,
8653 concurrently: false,
8654 where_clause: None,
8655 include_columns: Vec::new(),
8656 with_options: Vec::new(),
8657 on_filegroup: None,
8658 }
8659 }
8660}
8661
8662#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8664#[cfg_attr(feature = "bindings", derive(TS))]
8665pub struct IndexColumn {
8666 pub column: Identifier,
8667 pub desc: bool,
8668 #[serde(default)]
8670 pub asc: bool,
8671 pub nulls_first: Option<bool>,
8672 #[serde(default, skip_serializing_if = "Option::is_none")]
8674 pub opclass: Option<String>,
8675}
8676
8677#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8679#[cfg_attr(feature = "bindings", derive(TS))]
8680pub struct IndexKeyPart {
8681 pub expression: Box<Expression>,
8682 #[serde(default, skip_serializing_if = "Option::is_none")]
8684 pub prefix_length: Option<String>,
8685 pub desc: bool,
8686 #[serde(default)]
8688 pub asc: bool,
8689 pub nulls_first: Option<bool>,
8690 #[serde(default, skip_serializing_if = "Option::is_none")]
8692 pub opclass: Option<String>,
8693}
8694
8695#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8697#[cfg_attr(feature = "bindings", derive(TS))]
8698pub struct DropIndex {
8699 pub name: TableRef,
8700 pub table: Option<TableRef>,
8701 pub if_exists: bool,
8702 #[serde(default)]
8704 pub concurrently: bool,
8705}
8706
8707impl DropIndex {
8708 pub fn new(name: impl Into<String>) -> Self {
8709 Self {
8710 name: TableRef::new(name),
8711 table: None,
8712 if_exists: false,
8713 concurrently: false,
8714 }
8715 }
8716}
8717
8718#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8720#[cfg_attr(feature = "bindings", derive(TS))]
8721pub struct ViewColumn {
8722 pub name: Identifier,
8723 pub comment: Option<String>,
8724 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8726 pub options: Vec<Expression>,
8727}
8728
8729impl ViewColumn {
8730 pub fn new(name: impl Into<String>) -> Self {
8731 Self {
8732 name: Identifier::new(name),
8733 comment: None,
8734 options: Vec::new(),
8735 }
8736 }
8737
8738 pub fn with_comment(name: impl Into<String>, comment: impl Into<String>) -> Self {
8739 Self {
8740 name: Identifier::new(name),
8741 comment: Some(comment.into()),
8742 options: Vec::new(),
8743 }
8744 }
8745}
8746
8747#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8749#[cfg_attr(feature = "bindings", derive(TS))]
8750pub struct CreateView {
8751 pub name: TableRef,
8752 pub columns: Vec<ViewColumn>,
8753 pub query: Expression,
8754 pub or_replace: bool,
8755 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
8757 pub or_alter: bool,
8758 pub if_not_exists: bool,
8759 pub materialized: bool,
8760 pub temporary: bool,
8761 #[serde(default)]
8763 pub secure: bool,
8764 #[serde(skip_serializing_if = "Option::is_none")]
8766 pub algorithm: Option<String>,
8767 #[serde(skip_serializing_if = "Option::is_none")]
8769 pub definer: Option<String>,
8770 #[serde(skip_serializing_if = "Option::is_none")]
8772 pub security: Option<FunctionSecurity>,
8773 #[serde(default = "default_true")]
8775 pub security_sql_style: bool,
8776 #[serde(default)]
8778 pub security_after_name: bool,
8779 #[serde(default)]
8781 pub query_parenthesized: bool,
8782 #[serde(skip_serializing_if = "Option::is_none")]
8784 pub locking_mode: Option<String>,
8785 #[serde(skip_serializing_if = "Option::is_none")]
8787 pub locking_access: Option<String>,
8788 #[serde(default)]
8790 pub copy_grants: bool,
8791 #[serde(skip_serializing_if = "Option::is_none", default)]
8793 pub comment: Option<String>,
8794 #[serde(skip_serializing_if = "Option::is_none", default)]
8796 pub row_access_policy: Option<String>,
8797 #[serde(default)]
8799 pub tags: Vec<(String, String)>,
8800 #[serde(default)]
8802 pub options: Vec<Expression>,
8803 #[serde(skip_serializing_if = "Option::is_none", default)]
8805 pub build: Option<String>,
8806 #[serde(skip_serializing_if = "Option::is_none", default)]
8808 pub refresh: Option<Box<RefreshTriggerProperty>>,
8809 #[serde(skip_serializing_if = "Option::is_none", default)]
8812 pub schema: Option<Box<Schema>>,
8813 #[serde(skip_serializing_if = "Option::is_none", default)]
8815 pub unique_key: Option<Box<UniqueKeyProperty>>,
8816 #[serde(default)]
8818 pub no_schema_binding: bool,
8819 #[serde(skip_serializing_if = "Option::is_none", default)]
8821 pub auto_refresh: Option<bool>,
8822 #[serde(skip_serializing_if = "Option::is_none", default)]
8824 pub clickhouse_population: Option<String>,
8825 #[serde(default, skip_serializing_if = "Option::is_none")]
8827 pub on_cluster: Option<OnCluster>,
8828 #[serde(default, skip_serializing_if = "Option::is_none")]
8830 pub to_table: Option<TableRef>,
8831 #[serde(default, skip_serializing_if = "Vec::is_empty")]
8833 pub table_properties: Vec<Expression>,
8834}
8835
8836impl CreateView {
8837 pub fn new(name: impl Into<String>, query: Expression) -> Self {
8838 Self {
8839 name: TableRef::new(name),
8840 columns: Vec::new(),
8841 query,
8842 or_replace: false,
8843 or_alter: false,
8844 if_not_exists: false,
8845 materialized: false,
8846 temporary: false,
8847 secure: false,
8848 algorithm: None,
8849 definer: None,
8850 security: None,
8851 security_sql_style: true,
8852 security_after_name: false,
8853 query_parenthesized: false,
8854 locking_mode: None,
8855 locking_access: None,
8856 copy_grants: false,
8857 comment: None,
8858 row_access_policy: None,
8859 tags: Vec::new(),
8860 options: Vec::new(),
8861 build: None,
8862 refresh: None,
8863 schema: None,
8864 unique_key: None,
8865 no_schema_binding: false,
8866 auto_refresh: None,
8867 clickhouse_population: None,
8868 on_cluster: None,
8869 to_table: None,
8870 table_properties: Vec::new(),
8871 }
8872 }
8873}
8874
8875#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8877#[cfg_attr(feature = "bindings", derive(TS))]
8878pub struct DropView {
8879 pub name: TableRef,
8880 pub if_exists: bool,
8881 pub materialized: bool,
8882}
8883
8884impl DropView {
8885 pub fn new(name: impl Into<String>) -> Self {
8886 Self {
8887 name: TableRef::new(name),
8888 if_exists: false,
8889 materialized: false,
8890 }
8891 }
8892}
8893
8894#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8896#[cfg_attr(feature = "bindings", derive(TS))]
8897pub struct Truncate {
8898 #[serde(default)]
8900 pub target: TruncateTarget,
8901 #[serde(default)]
8903 pub if_exists: bool,
8904 pub table: TableRef,
8905 #[serde(default, skip_serializing_if = "Option::is_none")]
8907 pub on_cluster: Option<OnCluster>,
8908 pub cascade: bool,
8909 #[serde(default)]
8911 pub extra_tables: Vec<TruncateTableEntry>,
8912 #[serde(default)]
8914 pub identity: Option<TruncateIdentity>,
8915 #[serde(default)]
8917 pub restrict: bool,
8918 #[serde(default, skip_serializing_if = "Option::is_none")]
8920 pub partition: Option<Box<Expression>>,
8921}
8922
8923#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8925#[cfg_attr(feature = "bindings", derive(TS))]
8926pub struct TruncateTableEntry {
8927 pub table: TableRef,
8928 #[serde(default)]
8930 pub star: bool,
8931}
8932
8933#[derive(
8935 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8936)]
8937#[cfg_attr(feature = "bindings", derive(TS))]
8938pub enum TruncateTarget {
8939 Table,
8940 Database,
8941}
8942
8943impl Default for TruncateTarget {
8944 fn default() -> Self {
8945 TruncateTarget::Table
8946 }
8947}
8948
8949#[derive(
8951 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8952)]
8953#[cfg_attr(feature = "bindings", derive(TS))]
8954pub enum TruncateIdentity {
8955 Restart,
8956 Continue,
8957}
8958
8959impl Truncate {
8960 pub fn new(table: impl Into<String>) -> Self {
8961 Self {
8962 target: TruncateTarget::Table,
8963 if_exists: false,
8964 table: TableRef::new(table),
8965 on_cluster: None,
8966 cascade: false,
8967 extra_tables: Vec::new(),
8968 identity: None,
8969 restrict: false,
8970 partition: None,
8971 }
8972 }
8973}
8974
8975#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
8977#[cfg_attr(feature = "bindings", derive(TS))]
8978pub struct Use {
8979 pub kind: Option<UseKind>,
8981 pub this: Identifier,
8983}
8984
8985#[derive(
8987 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
8988)]
8989#[cfg_attr(feature = "bindings", derive(TS))]
8990pub enum UseKind {
8991 Database,
8992 Schema,
8993 Role,
8994 Warehouse,
8995 Catalog,
8996 SecondaryRoles,
8998}
8999
9000#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9002#[cfg_attr(feature = "bindings", derive(TS))]
9003pub struct SetStatement {
9004 pub items: Vec<SetItem>,
9006}
9007
9008#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9010#[cfg_attr(feature = "bindings", derive(TS))]
9011pub struct SetItem {
9012 pub name: Expression,
9014 pub value: Expression,
9016 pub kind: Option<String>,
9018 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9020 pub no_equals: bool,
9021}
9022
9023#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9025#[cfg_attr(feature = "bindings", derive(TS))]
9026pub struct Cache {
9027 pub table: Identifier,
9029 pub lazy: bool,
9031 pub options: Vec<(Expression, Expression)>,
9033 pub query: Option<Expression>,
9035}
9036
9037#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9039#[cfg_attr(feature = "bindings", derive(TS))]
9040pub struct Uncache {
9041 pub table: Identifier,
9043 pub if_exists: bool,
9045}
9046
9047#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9049#[cfg_attr(feature = "bindings", derive(TS))]
9050pub struct LoadData {
9051 pub local: bool,
9053 pub inpath: String,
9055 pub overwrite: bool,
9057 pub table: Expression,
9059 pub partition: Vec<(Identifier, Expression)>,
9061 pub input_format: Option<String>,
9063 pub serde: Option<String>,
9065}
9066
9067#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9069#[cfg_attr(feature = "bindings", derive(TS))]
9070pub struct Pragma {
9071 pub schema: Option<Identifier>,
9073 pub name: Identifier,
9075 pub value: Option<Expression>,
9077 pub args: Vec<Expression>,
9079 #[serde(default)]
9081 pub use_assignment_syntax: bool,
9082}
9083
9084#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9087#[cfg_attr(feature = "bindings", derive(TS))]
9088pub struct Privilege {
9089 pub name: String,
9091 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9093 pub columns: Vec<String>,
9094}
9095
9096#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9098#[cfg_attr(feature = "bindings", derive(TS))]
9099pub struct GrantPrincipal {
9100 pub name: Identifier,
9102 pub is_role: bool,
9104 #[serde(default)]
9106 pub is_group: bool,
9107 #[serde(default)]
9109 pub is_share: bool,
9110}
9111
9112#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9114#[cfg_attr(feature = "bindings", derive(TS))]
9115pub struct Grant {
9116 pub privileges: Vec<Privilege>,
9118 pub kind: Option<String>,
9120 pub securable: Identifier,
9122 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9124 pub function_params: Vec<String>,
9125 pub principals: Vec<GrantPrincipal>,
9127 pub grant_option: bool,
9129 #[serde(default, skip_serializing_if = "Option::is_none")]
9131 pub as_principal: Option<Identifier>,
9132}
9133
9134#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9136#[cfg_attr(feature = "bindings", derive(TS))]
9137pub struct Revoke {
9138 pub privileges: Vec<Privilege>,
9140 pub kind: Option<String>,
9142 pub securable: Identifier,
9144 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9146 pub function_params: Vec<String>,
9147 pub principals: Vec<GrantPrincipal>,
9149 pub grant_option: bool,
9151 pub cascade: bool,
9153 #[serde(default)]
9155 pub restrict: bool,
9156}
9157
9158#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9160#[cfg_attr(feature = "bindings", derive(TS))]
9161pub struct Comment {
9162 pub this: Expression,
9164 pub kind: String,
9166 pub expression: Expression,
9168 pub exists: bool,
9170 pub materialized: bool,
9172}
9173
9174#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9180#[cfg_attr(feature = "bindings", derive(TS))]
9181pub struct AlterView {
9182 pub name: TableRef,
9183 pub actions: Vec<AlterViewAction>,
9184 #[serde(default, skip_serializing_if = "Option::is_none")]
9186 pub algorithm: Option<String>,
9187 #[serde(default, skip_serializing_if = "Option::is_none")]
9189 pub definer: Option<String>,
9190 #[serde(default, skip_serializing_if = "Option::is_none")]
9192 pub sql_security: Option<String>,
9193 #[serde(default, skip_serializing_if = "Option::is_none")]
9195 pub with_option: Option<String>,
9196 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9198 pub columns: Vec<ViewColumn>,
9199}
9200
9201#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9203#[cfg_attr(feature = "bindings", derive(TS))]
9204pub enum AlterViewAction {
9205 Rename(TableRef),
9207 OwnerTo(Identifier),
9209 SetSchema(Identifier),
9211 SetAuthorization(String),
9213 AlterColumn {
9215 name: Identifier,
9216 action: AlterColumnAction,
9217 },
9218 AsSelect(Box<Expression>),
9220 SetTblproperties(Vec<(String, String)>),
9222 UnsetTblproperties(Vec<String>),
9224}
9225
9226impl AlterView {
9227 pub fn new(name: impl Into<String>) -> Self {
9228 Self {
9229 name: TableRef::new(name),
9230 actions: Vec::new(),
9231 algorithm: None,
9232 definer: None,
9233 sql_security: None,
9234 with_option: None,
9235 columns: Vec::new(),
9236 }
9237 }
9238}
9239
9240#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9242#[cfg_attr(feature = "bindings", derive(TS))]
9243pub struct AlterIndex {
9244 pub name: Identifier,
9245 pub table: Option<TableRef>,
9246 pub actions: Vec<AlterIndexAction>,
9247}
9248
9249#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9251#[cfg_attr(feature = "bindings", derive(TS))]
9252pub enum AlterIndexAction {
9253 Rename(Identifier),
9255 SetTablespace(Identifier),
9257 Visible(bool),
9259}
9260
9261impl AlterIndex {
9262 pub fn new(name: impl Into<String>) -> Self {
9263 Self {
9264 name: Identifier::new(name),
9265 table: None,
9266 actions: Vec::new(),
9267 }
9268 }
9269}
9270
9271#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9273#[cfg_attr(feature = "bindings", derive(TS))]
9274pub struct CreateSchema {
9275 pub name: Vec<Identifier>,
9277 pub if_not_exists: bool,
9278 pub authorization: Option<Identifier>,
9279 #[serde(default)]
9281 pub clone_from: Option<Vec<Identifier>>,
9282 #[serde(default)]
9284 pub at_clause: Option<Expression>,
9285 #[serde(default)]
9287 pub properties: Vec<Expression>,
9288 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9290 pub leading_comments: Vec<String>,
9291}
9292
9293impl CreateSchema {
9294 pub fn new(name: impl Into<String>) -> Self {
9295 Self {
9296 name: vec![Identifier::new(name)],
9297 if_not_exists: false,
9298 authorization: None,
9299 clone_from: None,
9300 at_clause: None,
9301 properties: Vec::new(),
9302 leading_comments: Vec::new(),
9303 }
9304 }
9305}
9306
9307#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9309#[cfg_attr(feature = "bindings", derive(TS))]
9310pub struct DropSchema {
9311 pub name: Identifier,
9312 pub if_exists: bool,
9313 pub cascade: bool,
9314}
9315
9316impl DropSchema {
9317 pub fn new(name: impl Into<String>) -> Self {
9318 Self {
9319 name: Identifier::new(name),
9320 if_exists: false,
9321 cascade: false,
9322 }
9323 }
9324}
9325
9326#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9328#[cfg_attr(feature = "bindings", derive(TS))]
9329pub struct DropNamespace {
9330 pub name: Identifier,
9331 pub if_exists: bool,
9332 pub cascade: bool,
9333}
9334
9335impl DropNamespace {
9336 pub fn new(name: impl Into<String>) -> Self {
9337 Self {
9338 name: Identifier::new(name),
9339 if_exists: false,
9340 cascade: false,
9341 }
9342 }
9343}
9344
9345#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9347#[cfg_attr(feature = "bindings", derive(TS))]
9348pub struct CreateDatabase {
9349 pub name: Identifier,
9350 pub if_not_exists: bool,
9351 pub options: Vec<DatabaseOption>,
9352 #[serde(default)]
9354 pub clone_from: Option<Identifier>,
9355 #[serde(default)]
9357 pub at_clause: Option<Expression>,
9358}
9359
9360#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9362#[cfg_attr(feature = "bindings", derive(TS))]
9363pub enum DatabaseOption {
9364 CharacterSet(String),
9365 Collate(String),
9366 Owner(Identifier),
9367 Template(Identifier),
9368 Encoding(String),
9369 Location(String),
9370}
9371
9372impl CreateDatabase {
9373 pub fn new(name: impl Into<String>) -> Self {
9374 Self {
9375 name: Identifier::new(name),
9376 if_not_exists: false,
9377 options: Vec::new(),
9378 clone_from: None,
9379 at_clause: None,
9380 }
9381 }
9382}
9383
9384#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9386#[cfg_attr(feature = "bindings", derive(TS))]
9387pub struct DropDatabase {
9388 pub name: Identifier,
9389 pub if_exists: bool,
9390 #[serde(default)]
9392 pub sync: bool,
9393}
9394
9395impl DropDatabase {
9396 pub fn new(name: impl Into<String>) -> Self {
9397 Self {
9398 name: Identifier::new(name),
9399 if_exists: false,
9400 sync: false,
9401 }
9402 }
9403}
9404
9405#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9407#[cfg_attr(feature = "bindings", derive(TS))]
9408pub struct CreateFunction {
9409 pub name: TableRef,
9410 pub parameters: Vec<FunctionParameter>,
9411 pub return_type: Option<DataType>,
9412 pub body: Option<FunctionBody>,
9413 pub or_replace: bool,
9414 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9416 pub or_alter: bool,
9417 pub if_not_exists: bool,
9418 pub temporary: bool,
9419 pub language: Option<String>,
9420 pub deterministic: Option<bool>,
9421 pub returns_null_on_null_input: Option<bool>,
9422 pub security: Option<FunctionSecurity>,
9423 #[serde(default = "default_true")]
9425 pub has_parens: bool,
9426 #[serde(default)]
9428 pub sql_data_access: Option<SqlDataAccess>,
9429 #[serde(default, skip_serializing_if = "Option::is_none")]
9431 pub returns_table_body: Option<String>,
9432 #[serde(default)]
9434 pub language_first: bool,
9435 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9437 pub set_options: Vec<FunctionSetOption>,
9438 #[serde(default)]
9440 pub strict: bool,
9441 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9443 pub options: Vec<Expression>,
9444 #[serde(default)]
9446 pub is_table_function: bool,
9447 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9449 pub property_order: Vec<FunctionPropertyKind>,
9450 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9452 pub using_resources: Vec<FunctionUsingResource>,
9453 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9455 pub environment: Vec<Expression>,
9456 #[serde(default, skip_serializing_if = "Option::is_none")]
9458 pub handler: Option<String>,
9459 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9461 pub handler_uses_eq: bool,
9462 #[serde(default, skip_serializing_if = "Option::is_none")]
9464 pub runtime_version: Option<String>,
9465 #[serde(default, skip_serializing_if = "Option::is_none")]
9467 pub packages: Option<Vec<String>>,
9468 #[serde(default, skip_serializing_if = "Option::is_none")]
9470 pub parameter_style: Option<String>,
9471}
9472
9473#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9475#[cfg_attr(feature = "bindings", derive(TS))]
9476pub struct FunctionSetOption {
9477 pub name: String,
9478 pub value: FunctionSetValue,
9479}
9480
9481#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9483#[cfg_attr(feature = "bindings", derive(TS))]
9484pub enum FunctionSetValue {
9485 Value { value: String, use_to: bool },
9487 FromCurrent,
9489}
9490
9491#[derive(
9493 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9494)]
9495#[cfg_attr(feature = "bindings", derive(TS))]
9496pub enum SqlDataAccess {
9497 NoSql,
9499 ContainsSql,
9501 ReadsSqlData,
9503 ModifiesSqlData,
9505}
9506
9507#[derive(
9509 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9510)]
9511#[cfg_attr(feature = "bindings", derive(TS))]
9512pub enum FunctionPropertyKind {
9513 Set,
9515 As,
9517 Using,
9519 Language,
9521 Determinism,
9523 NullInput,
9525 Security,
9527 SqlDataAccess,
9529 Options,
9531 Environment,
9533 Handler,
9535 RuntimeVersion,
9537 Packages,
9539 ParameterStyle,
9541}
9542
9543#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9545#[cfg_attr(feature = "bindings", derive(TS))]
9546pub struct FunctionUsingResource {
9547 pub kind: String,
9548 pub uri: String,
9549}
9550
9551#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9553#[cfg_attr(feature = "bindings", derive(TS))]
9554pub struct FunctionParameter {
9555 pub name: Option<Identifier>,
9556 pub data_type: DataType,
9557 pub mode: Option<ParameterMode>,
9558 pub default: Option<Expression>,
9559 #[serde(default, skip_serializing_if = "Option::is_none")]
9561 pub mode_text: Option<String>,
9562}
9563
9564#[derive(
9566 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9567)]
9568#[cfg_attr(feature = "bindings", derive(TS))]
9569pub enum ParameterMode {
9570 In,
9571 Out,
9572 InOut,
9573 Variadic,
9574}
9575
9576#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9578#[cfg_attr(feature = "bindings", derive(TS))]
9579pub enum FunctionBody {
9580 Block(String),
9582 StringLiteral(String),
9584 Expression(Expression),
9586 External(String),
9588 Return(Expression),
9590 Statements(Vec<Expression>),
9592 DollarQuoted {
9595 content: String,
9596 tag: Option<String>,
9597 },
9598 RawBlock(String),
9600}
9601
9602#[derive(
9604 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9605)]
9606#[cfg_attr(feature = "bindings", derive(TS))]
9607pub enum FunctionSecurity {
9608 Definer,
9609 Invoker,
9610 None,
9612}
9613
9614impl CreateFunction {
9615 pub fn new(name: impl Into<String>) -> Self {
9616 Self {
9617 name: TableRef::new(name),
9618 parameters: Vec::new(),
9619 return_type: None,
9620 body: None,
9621 or_replace: false,
9622 or_alter: false,
9623 if_not_exists: false,
9624 temporary: false,
9625 language: None,
9626 deterministic: None,
9627 returns_null_on_null_input: None,
9628 security: None,
9629 has_parens: true,
9630 sql_data_access: None,
9631 returns_table_body: None,
9632 language_first: false,
9633 set_options: Vec::new(),
9634 strict: false,
9635 options: Vec::new(),
9636 is_table_function: false,
9637 property_order: Vec::new(),
9638 using_resources: Vec::new(),
9639 environment: Vec::new(),
9640 handler: None,
9641 handler_uses_eq: false,
9642 runtime_version: None,
9643 packages: None,
9644 parameter_style: None,
9645 }
9646 }
9647}
9648
9649#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9651#[cfg_attr(feature = "bindings", derive(TS))]
9652pub struct DropFunction {
9653 pub name: TableRef,
9654 pub parameters: Option<Vec<DataType>>,
9655 pub if_exists: bool,
9656 pub cascade: bool,
9657}
9658
9659impl DropFunction {
9660 pub fn new(name: impl Into<String>) -> Self {
9661 Self {
9662 name: TableRef::new(name),
9663 parameters: None,
9664 if_exists: false,
9665 cascade: false,
9666 }
9667 }
9668}
9669
9670#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9672#[cfg_attr(feature = "bindings", derive(TS))]
9673pub struct CreateProcedure {
9674 pub name: TableRef,
9675 pub parameters: Vec<FunctionParameter>,
9676 pub body: Option<FunctionBody>,
9677 pub or_replace: bool,
9678 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9680 pub or_alter: bool,
9681 pub if_not_exists: bool,
9682 pub language: Option<String>,
9683 pub security: Option<FunctionSecurity>,
9684 #[serde(default)]
9686 pub return_type: Option<DataType>,
9687 #[serde(default)]
9689 pub execute_as: Option<String>,
9690 #[serde(default, skip_serializing_if = "Vec::is_empty")]
9692 pub with_options: Vec<String>,
9693 #[serde(default = "default_true", skip_serializing_if = "is_true")]
9695 pub has_parens: bool,
9696 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9698 pub use_proc_keyword: bool,
9699}
9700
9701impl CreateProcedure {
9702 pub fn new(name: impl Into<String>) -> Self {
9703 Self {
9704 name: TableRef::new(name),
9705 parameters: Vec::new(),
9706 body: None,
9707 or_replace: false,
9708 or_alter: false,
9709 if_not_exists: false,
9710 language: None,
9711 security: None,
9712 return_type: None,
9713 execute_as: None,
9714 with_options: Vec::new(),
9715 has_parens: true,
9716 use_proc_keyword: false,
9717 }
9718 }
9719}
9720
9721#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9723#[cfg_attr(feature = "bindings", derive(TS))]
9724pub struct DropProcedure {
9725 pub name: TableRef,
9726 pub parameters: Option<Vec<DataType>>,
9727 pub if_exists: bool,
9728 pub cascade: bool,
9729}
9730
9731impl DropProcedure {
9732 pub fn new(name: impl Into<String>) -> Self {
9733 Self {
9734 name: TableRef::new(name),
9735 parameters: None,
9736 if_exists: false,
9737 cascade: false,
9738 }
9739 }
9740}
9741
9742#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9744#[cfg_attr(feature = "bindings", derive(TS))]
9745pub enum SeqPropKind {
9746 Start,
9747 Increment,
9748 Minvalue,
9749 Maxvalue,
9750 Cache,
9751 NoCache,
9752 Cycle,
9753 NoCycle,
9754 OwnedBy,
9755 Order,
9756 NoOrder,
9757 Comment,
9758 Sharing,
9760 Keep,
9762 NoKeep,
9764 Scale,
9766 NoScale,
9768 Shard,
9770 NoShard,
9772 Session,
9774 Global,
9776 NoCacheWord,
9778 NoCycleWord,
9780 NoMinvalueWord,
9782 NoMaxvalueWord,
9784}
9785
9786#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9788#[cfg_attr(feature = "bindings", derive(TS))]
9789pub struct CreateSynonym {
9790 pub name: TableRef,
9792 pub target: TableRef,
9794}
9795
9796#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9798#[cfg_attr(feature = "bindings", derive(TS))]
9799pub struct CreateSequence {
9800 pub name: TableRef,
9801 pub if_not_exists: bool,
9802 pub temporary: bool,
9803 #[serde(default)]
9804 pub or_replace: bool,
9805 #[serde(default, skip_serializing_if = "Option::is_none")]
9807 pub as_type: Option<DataType>,
9808 pub increment: Option<i64>,
9809 pub minvalue: Option<SequenceBound>,
9810 pub maxvalue: Option<SequenceBound>,
9811 pub start: Option<i64>,
9812 pub cache: Option<i64>,
9813 pub cycle: bool,
9814 pub owned_by: Option<TableRef>,
9815 #[serde(default)]
9817 pub owned_by_none: bool,
9818 #[serde(default)]
9820 pub order: Option<bool>,
9821 #[serde(default)]
9823 pub comment: Option<String>,
9824 #[serde(default, skip_serializing_if = "Option::is_none")]
9826 pub sharing: Option<String>,
9827 #[serde(default, skip_serializing_if = "Option::is_none")]
9829 pub scale_modifier: Option<String>,
9830 #[serde(default, skip_serializing_if = "Option::is_none")]
9832 pub shard_modifier: Option<String>,
9833 #[serde(default)]
9835 pub property_order: Vec<SeqPropKind>,
9836}
9837
9838#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9840#[cfg_attr(feature = "bindings", derive(TS))]
9841pub enum SequenceBound {
9842 Value(i64),
9843 None,
9844}
9845
9846impl CreateSequence {
9847 pub fn new(name: impl Into<String>) -> Self {
9848 Self {
9849 name: TableRef::new(name),
9850 if_not_exists: false,
9851 temporary: false,
9852 or_replace: false,
9853 as_type: None,
9854 increment: None,
9855 minvalue: None,
9856 maxvalue: None,
9857 start: None,
9858 cache: None,
9859 cycle: false,
9860 owned_by: None,
9861 owned_by_none: false,
9862 order: None,
9863 comment: None,
9864 sharing: None,
9865 scale_modifier: None,
9866 shard_modifier: None,
9867 property_order: Vec::new(),
9868 }
9869 }
9870}
9871
9872#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9874#[cfg_attr(feature = "bindings", derive(TS))]
9875pub struct DropSequence {
9876 pub name: TableRef,
9877 pub if_exists: bool,
9878 pub cascade: bool,
9879}
9880
9881impl DropSequence {
9882 pub fn new(name: impl Into<String>) -> Self {
9883 Self {
9884 name: TableRef::new(name),
9885 if_exists: false,
9886 cascade: false,
9887 }
9888 }
9889}
9890
9891#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9893#[cfg_attr(feature = "bindings", derive(TS))]
9894pub struct AlterSequence {
9895 pub name: TableRef,
9896 pub if_exists: bool,
9897 pub increment: Option<i64>,
9898 pub minvalue: Option<SequenceBound>,
9899 pub maxvalue: Option<SequenceBound>,
9900 pub start: Option<i64>,
9901 pub restart: Option<Option<i64>>,
9902 pub cache: Option<i64>,
9903 pub cycle: Option<bool>,
9904 pub owned_by: Option<Option<TableRef>>,
9905}
9906
9907impl AlterSequence {
9908 pub fn new(name: impl Into<String>) -> Self {
9909 Self {
9910 name: TableRef::new(name),
9911 if_exists: false,
9912 increment: None,
9913 minvalue: None,
9914 maxvalue: None,
9915 start: None,
9916 restart: None,
9917 cache: None,
9918 cycle: None,
9919 owned_by: None,
9920 }
9921 }
9922}
9923
9924#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9926#[cfg_attr(feature = "bindings", derive(TS))]
9927pub struct CreateTrigger {
9928 pub name: Identifier,
9929 pub table: TableRef,
9930 pub timing: TriggerTiming,
9931 pub events: Vec<TriggerEvent>,
9932 #[serde(default, skip_serializing_if = "Option::is_none")]
9933 pub for_each: Option<TriggerForEach>,
9934 pub when: Option<Expression>,
9935 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9937 pub when_paren: bool,
9938 pub body: TriggerBody,
9939 pub or_replace: bool,
9940 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
9942 pub or_alter: bool,
9943 pub constraint: bool,
9944 pub deferrable: Option<bool>,
9945 pub initially_deferred: Option<bool>,
9946 pub referencing: Option<TriggerReferencing>,
9947}
9948
9949#[derive(
9951 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9952)]
9953#[cfg_attr(feature = "bindings", derive(TS))]
9954pub enum TriggerTiming {
9955 Before,
9956 After,
9957 InsteadOf,
9958}
9959
9960#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9962#[cfg_attr(feature = "bindings", derive(TS))]
9963pub enum TriggerEvent {
9964 Insert,
9965 Update(Option<Vec<Identifier>>),
9966 Delete,
9967 Truncate,
9968}
9969
9970#[derive(
9972 polyglot_sql_ast_derive::AstNode, Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize,
9973)]
9974#[cfg_attr(feature = "bindings", derive(TS))]
9975pub enum TriggerForEach {
9976 Row,
9977 Statement,
9978}
9979
9980#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9982#[cfg_attr(feature = "bindings", derive(TS))]
9983pub enum TriggerBody {
9984 Execute {
9986 function: TableRef,
9987 args: Vec<Expression>,
9988 },
9989 Block(String),
9991}
9992
9993#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
9995#[cfg_attr(feature = "bindings", derive(TS))]
9996pub struct TriggerReferencing {
9997 pub old_table: Option<Identifier>,
9998 pub new_table: Option<Identifier>,
9999 pub old_row: Option<Identifier>,
10000 pub new_row: Option<Identifier>,
10001}
10002
10003impl CreateTrigger {
10004 pub fn new(name: impl Into<String>, table: impl Into<String>) -> Self {
10005 Self {
10006 name: Identifier::new(name),
10007 table: TableRef::new(table),
10008 timing: TriggerTiming::Before,
10009 events: Vec::new(),
10010 for_each: Some(TriggerForEach::Row),
10011 when: None,
10012 when_paren: false,
10013 body: TriggerBody::Execute {
10014 function: TableRef::new(""),
10015 args: Vec::new(),
10016 },
10017 or_replace: false,
10018 or_alter: false,
10019 constraint: false,
10020 deferrable: None,
10021 initially_deferred: None,
10022 referencing: None,
10023 }
10024 }
10025}
10026
10027#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10029#[cfg_attr(feature = "bindings", derive(TS))]
10030pub struct DropTrigger {
10031 pub name: Identifier,
10032 pub table: Option<TableRef>,
10033 pub if_exists: bool,
10034 pub cascade: bool,
10035}
10036
10037impl DropTrigger {
10038 pub fn new(name: impl Into<String>) -> Self {
10039 Self {
10040 name: Identifier::new(name),
10041 table: None,
10042 if_exists: false,
10043 cascade: false,
10044 }
10045 }
10046}
10047
10048#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10050#[cfg_attr(feature = "bindings", derive(TS))]
10051pub struct CreateType {
10052 pub name: TableRef,
10053 pub definition: TypeDefinition,
10054 pub if_not_exists: bool,
10055}
10056
10057#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10059#[cfg_attr(feature = "bindings", derive(TS))]
10060pub enum TypeDefinition {
10061 Enum(Vec<String>),
10063 Composite(Vec<TypeAttribute>),
10065 Range {
10067 subtype: DataType,
10068 subtype_diff: Option<String>,
10069 canonical: Option<String>,
10070 },
10071 Base {
10073 input: String,
10074 output: String,
10075 internallength: Option<i32>,
10076 },
10077 Domain {
10079 base_type: DataType,
10080 default: Option<Expression>,
10081 constraints: Vec<DomainConstraint>,
10082 },
10083}
10084
10085#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10087#[cfg_attr(feature = "bindings", derive(TS))]
10088pub struct TypeAttribute {
10089 pub name: Identifier,
10090 pub data_type: DataType,
10091 pub collate: Option<Identifier>,
10092}
10093
10094#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10096#[cfg_attr(feature = "bindings", derive(TS))]
10097pub struct DomainConstraint {
10098 pub name: Option<Identifier>,
10099 pub check: Expression,
10100}
10101
10102impl CreateType {
10103 pub fn new_enum(name: impl Into<String>, values: Vec<String>) -> Self {
10104 Self {
10105 name: TableRef::new(name),
10106 definition: TypeDefinition::Enum(values),
10107 if_not_exists: false,
10108 }
10109 }
10110
10111 pub fn new_composite(name: impl Into<String>, attributes: Vec<TypeAttribute>) -> Self {
10112 Self {
10113 name: TableRef::new(name),
10114 definition: TypeDefinition::Composite(attributes),
10115 if_not_exists: false,
10116 }
10117 }
10118}
10119
10120#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10122#[cfg_attr(feature = "bindings", derive(TS))]
10123pub struct DropType {
10124 pub name: TableRef,
10125 pub if_exists: bool,
10126 pub cascade: bool,
10127}
10128
10129impl DropType {
10130 pub fn new(name: impl Into<String>) -> Self {
10131 Self {
10132 name: TableRef::new(name),
10133 if_exists: false,
10134 cascade: false,
10135 }
10136 }
10137}
10138
10139#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10141#[cfg_attr(feature = "bindings", derive(TS))]
10142pub struct Describe {
10143 pub target: Expression,
10145 pub extended: bool,
10147 pub formatted: bool,
10149 #[serde(default)]
10151 pub kind: Option<String>,
10152 #[serde(default)]
10154 pub properties: Vec<(String, String)>,
10155 #[serde(default, skip_serializing_if = "Option::is_none")]
10157 pub style: Option<String>,
10158 #[serde(default)]
10160 pub partition: Option<Box<Expression>>,
10161 #[serde(default)]
10163 pub leading_comments: Vec<String>,
10164 #[serde(default)]
10166 pub as_json: bool,
10167 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10169 pub params: Vec<String>,
10170}
10171
10172impl Describe {
10173 pub fn new(target: Expression) -> Self {
10174 Self {
10175 target,
10176 extended: false,
10177 formatted: false,
10178 kind: None,
10179 properties: Vec::new(),
10180 style: None,
10181 partition: None,
10182 leading_comments: Vec::new(),
10183 as_json: false,
10184 params: Vec::new(),
10185 }
10186 }
10187}
10188
10189#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10191#[cfg_attr(feature = "bindings", derive(TS))]
10192pub struct Show {
10193 pub this: String,
10195 #[serde(default)]
10197 pub terse: bool,
10198 #[serde(default)]
10200 pub history: bool,
10201 pub like: Option<Expression>,
10203 pub scope_kind: Option<String>,
10205 pub scope: Option<Expression>,
10207 pub starts_with: Option<Expression>,
10209 pub limit: Option<Box<Limit>>,
10211 pub from: Option<Expression>,
10213 #[serde(default, skip_serializing_if = "Option::is_none")]
10215 pub where_clause: Option<Expression>,
10216 #[serde(default, skip_serializing_if = "Option::is_none")]
10218 pub for_target: Option<Expression>,
10219 #[serde(default, skip_serializing_if = "Option::is_none")]
10221 pub db: Option<Expression>,
10222 #[serde(default, skip_serializing_if = "Option::is_none")]
10224 pub target: Option<Expression>,
10225 #[serde(default, skip_serializing_if = "Option::is_none")]
10227 pub mutex: Option<bool>,
10228 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10230 pub privileges: Vec<String>,
10231}
10232
10233impl Show {
10234 pub fn new(this: impl Into<String>) -> Self {
10235 Self {
10236 this: this.into(),
10237 terse: false,
10238 history: false,
10239 like: None,
10240 scope_kind: None,
10241 scope: None,
10242 starts_with: None,
10243 limit: None,
10244 from: None,
10245 where_clause: None,
10246 for_target: None,
10247 db: None,
10248 target: None,
10249 mutex: None,
10250 privileges: Vec::new(),
10251 }
10252 }
10253}
10254
10255#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10260#[cfg_attr(feature = "bindings", derive(TS))]
10261pub struct Paren {
10262 pub this: Expression,
10264 #[serde(default)]
10265 pub trailing_comments: Vec<String>,
10266}
10267
10268#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10270#[cfg_attr(feature = "bindings", derive(TS))]
10271pub struct Annotated {
10272 pub this: Expression,
10273 pub trailing_comments: Vec<String>,
10274}
10275
10276#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10281#[cfg_attr(feature = "bindings", derive(TS))]
10282pub struct Refresh {
10283 pub this: Box<Expression>,
10284 pub kind: String,
10285}
10286
10287#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10289#[cfg_attr(feature = "bindings", derive(TS))]
10290pub struct LockingStatement {
10291 pub this: Box<Expression>,
10292 pub expression: Box<Expression>,
10293}
10294
10295#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10297#[cfg_attr(feature = "bindings", derive(TS))]
10298pub struct SequenceProperties {
10299 #[serde(default)]
10300 pub increment: Option<Box<Expression>>,
10301 #[serde(default)]
10302 pub minvalue: Option<Box<Expression>>,
10303 #[serde(default)]
10304 pub maxvalue: Option<Box<Expression>>,
10305 #[serde(default)]
10306 pub cache: Option<Box<Expression>>,
10307 #[serde(default)]
10308 pub start: Option<Box<Expression>>,
10309 #[serde(default)]
10310 pub owned: Option<Box<Expression>>,
10311 #[serde(default)]
10312 pub options: Vec<Expression>,
10313}
10314
10315#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10317#[cfg_attr(feature = "bindings", derive(TS))]
10318pub struct TruncateTable {
10319 #[serde(default)]
10320 pub expressions: Vec<Expression>,
10321 #[serde(default)]
10322 pub is_database: Option<Box<Expression>>,
10323 #[serde(default)]
10324 pub exists: bool,
10325 #[serde(default)]
10326 pub only: Option<Box<Expression>>,
10327 #[serde(default)]
10328 pub cluster: Option<Box<Expression>>,
10329 #[serde(default)]
10330 pub identity: Option<Box<Expression>>,
10331 #[serde(default)]
10332 pub option: Option<Box<Expression>>,
10333 #[serde(default)]
10334 pub partition: Option<Box<Expression>>,
10335}
10336
10337#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10339#[cfg_attr(feature = "bindings", derive(TS))]
10340pub struct Clone {
10341 pub this: Box<Expression>,
10342 #[serde(default)]
10343 pub shallow: Option<Box<Expression>>,
10344 #[serde(default)]
10345 pub copy: Option<Box<Expression>>,
10346}
10347
10348#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10350#[cfg_attr(feature = "bindings", derive(TS))]
10351pub struct Attach {
10352 pub this: Box<Expression>,
10353 #[serde(default)]
10354 pub exists: bool,
10355 #[serde(default)]
10356 pub expressions: Vec<Expression>,
10357}
10358
10359#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10361#[cfg_attr(feature = "bindings", derive(TS))]
10362pub struct Detach {
10363 pub this: Box<Expression>,
10364 #[serde(default)]
10365 pub exists: bool,
10366}
10367
10368#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10370#[cfg_attr(feature = "bindings", derive(TS))]
10371pub struct Install {
10372 pub this: Box<Expression>,
10373 #[serde(default)]
10374 pub from_: Option<Box<Expression>>,
10375 #[serde(default)]
10376 pub force: Option<Box<Expression>>,
10377}
10378
10379#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10381#[cfg_attr(feature = "bindings", derive(TS))]
10382pub struct Summarize {
10383 pub this: Box<Expression>,
10384 #[serde(default)]
10385 pub table: Option<Box<Expression>>,
10386}
10387
10388#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10390#[cfg_attr(feature = "bindings", derive(TS))]
10391pub struct Declare {
10392 #[serde(default)]
10393 pub expressions: Vec<Expression>,
10394 #[serde(default)]
10395 pub replace: bool,
10396}
10397
10398#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10400#[cfg_attr(feature = "bindings", derive(TS))]
10401pub struct DeclareItem {
10402 pub this: Box<Expression>,
10403 #[serde(default)]
10404 pub kind: Option<String>,
10405 #[serde(default)]
10406 pub default: Option<Box<Expression>>,
10407 #[serde(default)]
10408 pub has_as: bool,
10409 #[serde(default, skip_serializing_if = "Vec::is_empty")]
10411 pub additional_names: Vec<Expression>,
10412}
10413
10414#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10416#[cfg_attr(feature = "bindings", derive(TS))]
10417pub struct Set {
10418 #[serde(default)]
10419 pub expressions: Vec<Expression>,
10420 #[serde(default)]
10421 pub unset: Option<Box<Expression>>,
10422 #[serde(default)]
10423 pub tag: Option<Box<Expression>>,
10424}
10425
10426#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10428#[cfg_attr(feature = "bindings", derive(TS))]
10429pub struct Heredoc {
10430 pub this: Box<Expression>,
10431 #[serde(default)]
10432 pub tag: Option<Box<Expression>>,
10433}
10434
10435#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10437#[cfg_attr(feature = "bindings", derive(TS))]
10438pub struct QueryBand {
10439 pub this: Box<Expression>,
10440 #[serde(default)]
10441 pub scope: Option<Box<Expression>>,
10442 #[serde(default)]
10443 pub update: Option<Box<Expression>>,
10444}
10445
10446#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10448#[cfg_attr(feature = "bindings", derive(TS))]
10449pub struct UserDefinedFunction {
10450 pub this: Box<Expression>,
10451 #[serde(default)]
10452 pub expressions: Vec<Expression>,
10453 #[serde(default)]
10454 pub wrapped: Option<Box<Expression>>,
10455}
10456
10457#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10459#[cfg_attr(feature = "bindings", derive(TS))]
10460pub struct RecursiveWithSearch {
10461 pub kind: String,
10462 pub this: Box<Expression>,
10463 pub expression: Box<Expression>,
10464 #[serde(default)]
10465 pub using: Option<Box<Expression>>,
10466}
10467
10468#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10470#[cfg_attr(feature = "bindings", derive(TS))]
10471pub struct ProjectionDef {
10472 pub this: Box<Expression>,
10473 pub expression: Box<Expression>,
10474}
10475
10476#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10478#[cfg_attr(feature = "bindings", derive(TS))]
10479pub struct TableAlias {
10480 #[serde(default)]
10481 pub this: Option<Box<Expression>>,
10482 #[serde(default)]
10483 pub columns: Vec<Expression>,
10484}
10485
10486#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10488#[cfg_attr(feature = "bindings", derive(TS))]
10489pub struct ByteString {
10490 pub this: Box<Expression>,
10491 #[serde(default)]
10492 pub is_bytes: Option<Box<Expression>>,
10493}
10494
10495#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10498#[cfg_attr(feature = "bindings", derive(TS))]
10499pub struct HexStringExpr {
10500 pub this: Box<Expression>,
10501 #[serde(default)]
10502 pub is_integer: Option<bool>,
10503}
10504
10505#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10507#[cfg_attr(feature = "bindings", derive(TS))]
10508pub struct UnicodeString {
10509 pub this: Box<Expression>,
10510 #[serde(default)]
10511 pub escape: Option<Box<Expression>>,
10512}
10513
10514#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10516#[cfg_attr(feature = "bindings", derive(TS))]
10517pub struct AlterColumn {
10518 pub this: Box<Expression>,
10519 #[serde(default)]
10520 pub dtype: Option<Box<Expression>>,
10521 #[serde(default)]
10522 pub collate: Option<Box<Expression>>,
10523 #[serde(default)]
10524 pub using: Option<Box<Expression>>,
10525 #[serde(default)]
10526 pub default: Option<Box<Expression>>,
10527 #[serde(default)]
10528 pub drop: Option<Box<Expression>>,
10529 #[serde(default)]
10530 pub comment: Option<Box<Expression>>,
10531 #[serde(default)]
10532 pub allow_null: Option<Box<Expression>>,
10533 #[serde(default)]
10534 pub visible: Option<Box<Expression>>,
10535 #[serde(default)]
10536 pub rename_to: Option<Box<Expression>>,
10537}
10538
10539#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10541#[cfg_attr(feature = "bindings", derive(TS))]
10542pub struct AlterSortKey {
10543 #[serde(default)]
10544 pub this: Option<Box<Expression>>,
10545 #[serde(default)]
10546 pub expressions: Vec<Expression>,
10547 #[serde(default)]
10548 pub compound: Option<Box<Expression>>,
10549}
10550
10551#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10553#[cfg_attr(feature = "bindings", derive(TS))]
10554pub struct AlterSet {
10555 #[serde(default)]
10556 pub expressions: Vec<Expression>,
10557 #[serde(default)]
10558 pub option: Option<Box<Expression>>,
10559 #[serde(default)]
10560 pub tablespace: Option<Box<Expression>>,
10561 #[serde(default)]
10562 pub access_method: Option<Box<Expression>>,
10563 #[serde(default)]
10564 pub file_format: Option<Box<Expression>>,
10565 #[serde(default)]
10566 pub copy_options: Option<Box<Expression>>,
10567 #[serde(default)]
10568 pub tag: Option<Box<Expression>>,
10569 #[serde(default)]
10570 pub location: Option<Box<Expression>>,
10571 #[serde(default)]
10572 pub serde: Option<Box<Expression>>,
10573}
10574
10575#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10577#[cfg_attr(feature = "bindings", derive(TS))]
10578pub struct RenameColumn {
10579 pub this: Box<Expression>,
10580 #[serde(default)]
10581 pub to: Option<Box<Expression>>,
10582 #[serde(default)]
10583 pub exists: bool,
10584}
10585
10586#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10588#[cfg_attr(feature = "bindings", derive(TS))]
10589pub struct Comprehension {
10590 pub this: Box<Expression>,
10591 pub expression: Box<Expression>,
10592 #[serde(default)]
10593 pub position: Option<Box<Expression>>,
10594 #[serde(default)]
10595 pub iterator: Option<Box<Expression>>,
10596 #[serde(default)]
10597 pub condition: Option<Box<Expression>>,
10598}
10599
10600#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10602#[cfg_attr(feature = "bindings", derive(TS))]
10603pub struct MergeTreeTTLAction {
10604 pub this: Box<Expression>,
10605 #[serde(default)]
10606 pub delete: Option<Box<Expression>>,
10607 #[serde(default)]
10608 pub recompress: Option<Box<Expression>>,
10609 #[serde(default)]
10610 pub to_disk: Option<Box<Expression>>,
10611 #[serde(default)]
10612 pub to_volume: Option<Box<Expression>>,
10613}
10614
10615#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10617#[cfg_attr(feature = "bindings", derive(TS))]
10618pub struct MergeTreeTTL {
10619 #[serde(default)]
10620 pub expressions: Vec<Expression>,
10621 #[serde(default)]
10622 pub where_: Option<Box<Expression>>,
10623 #[serde(default)]
10624 pub group: Option<Box<Expression>>,
10625 #[serde(default)]
10626 pub aggregates: Option<Box<Expression>>,
10627}
10628
10629#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10631#[cfg_attr(feature = "bindings", derive(TS))]
10632pub struct IndexConstraintOption {
10633 #[serde(default)]
10634 pub key_block_size: Option<Box<Expression>>,
10635 #[serde(default)]
10636 pub using: Option<Box<Expression>>,
10637 #[serde(default)]
10638 pub parser: Option<Box<Expression>>,
10639 #[serde(default)]
10640 pub comment: Option<Box<Expression>>,
10641 #[serde(default)]
10642 pub visible: Option<Box<Expression>>,
10643 #[serde(default)]
10644 pub engine_attr: Option<Box<Expression>>,
10645 #[serde(default)]
10646 pub secondary_engine_attr: Option<Box<Expression>>,
10647}
10648
10649#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10651#[cfg_attr(feature = "bindings", derive(TS))]
10652pub struct PeriodForSystemTimeConstraint {
10653 pub this: Box<Expression>,
10654 pub expression: Box<Expression>,
10655}
10656
10657#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10659#[cfg_attr(feature = "bindings", derive(TS))]
10660pub struct CaseSpecificColumnConstraint {
10661 #[serde(default)]
10662 pub not_: Option<Box<Expression>>,
10663}
10664
10665#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10667#[cfg_attr(feature = "bindings", derive(TS))]
10668pub struct CharacterSetColumnConstraint {
10669 pub this: Box<Expression>,
10670}
10671
10672#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10674#[cfg_attr(feature = "bindings", derive(TS))]
10675pub struct CheckColumnConstraint {
10676 pub this: Box<Expression>,
10677 #[serde(default)]
10678 pub enforced: Option<Box<Expression>>,
10679}
10680
10681#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10683#[cfg_attr(feature = "bindings", derive(TS))]
10684pub struct AssumeColumnConstraint {
10685 pub this: Box<Expression>,
10686}
10687
10688#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10690#[cfg_attr(feature = "bindings", derive(TS))]
10691pub struct CompressColumnConstraint {
10692 #[serde(default)]
10693 pub this: Option<Box<Expression>>,
10694}
10695
10696#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10698#[cfg_attr(feature = "bindings", derive(TS))]
10699pub struct DateFormatColumnConstraint {
10700 pub this: Box<Expression>,
10701}
10702
10703#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10705#[cfg_attr(feature = "bindings", derive(TS))]
10706pub struct EphemeralColumnConstraint {
10707 #[serde(default)]
10708 pub this: Option<Box<Expression>>,
10709}
10710
10711#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10713#[cfg_attr(feature = "bindings", derive(TS))]
10714pub struct WithOperator {
10715 pub this: Box<Expression>,
10716 pub op: String,
10717}
10718
10719#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10721#[cfg_attr(feature = "bindings", derive(TS))]
10722pub struct GeneratedAsIdentityColumnConstraint {
10723 #[serde(default)]
10724 pub this: Option<Box<Expression>>,
10725 #[serde(default)]
10726 pub expression: Option<Box<Expression>>,
10727 #[serde(default)]
10728 pub on_null: Option<Box<Expression>>,
10729 #[serde(default)]
10730 pub start: Option<Box<Expression>>,
10731 #[serde(default)]
10732 pub increment: Option<Box<Expression>>,
10733 #[serde(default)]
10734 pub minvalue: Option<Box<Expression>>,
10735 #[serde(default)]
10736 pub maxvalue: Option<Box<Expression>>,
10737 #[serde(default)]
10738 pub cycle: Option<Box<Expression>>,
10739 #[serde(default)]
10740 pub order: Option<Box<Expression>>,
10741}
10742
10743#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10746#[cfg_attr(feature = "bindings", derive(TS))]
10747pub struct AutoIncrementColumnConstraint;
10748
10749#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10751#[cfg_attr(feature = "bindings", derive(TS))]
10752pub struct CommentColumnConstraint;
10753
10754#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10756#[cfg_attr(feature = "bindings", derive(TS))]
10757pub struct GeneratedAsRowColumnConstraint {
10758 #[serde(default)]
10759 pub start: Option<Box<Expression>>,
10760 #[serde(default)]
10761 pub hidden: Option<Box<Expression>>,
10762}
10763
10764#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10766#[cfg_attr(feature = "bindings", derive(TS))]
10767pub struct IndexColumnConstraint {
10768 #[serde(default)]
10769 pub this: Option<Box<Expression>>,
10770 #[serde(default)]
10771 pub expressions: Vec<Expression>,
10772 #[serde(default)]
10773 pub kind: Option<String>,
10774 #[serde(default)]
10775 pub index_type: Option<Box<Expression>>,
10776 #[serde(default)]
10777 pub options: Vec<Expression>,
10778 #[serde(default)]
10779 pub expression: Option<Box<Expression>>,
10780 #[serde(default)]
10781 pub granularity: Option<Box<Expression>>,
10782}
10783
10784#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10786#[cfg_attr(feature = "bindings", derive(TS))]
10787pub struct MaskingPolicyColumnConstraint {
10788 pub this: Box<Expression>,
10789 #[serde(default)]
10790 pub expressions: Vec<Expression>,
10791}
10792
10793#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10795#[cfg_attr(feature = "bindings", derive(TS))]
10796pub struct NotNullColumnConstraint {
10797 #[serde(default)]
10798 pub allow_null: Option<Box<Expression>>,
10799}
10800
10801#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10803#[cfg_attr(feature = "bindings", derive(TS))]
10804pub struct DefaultColumnConstraint {
10805 pub this: Box<Expression>,
10806 #[serde(default, skip_serializing_if = "Option::is_none")]
10808 pub for_column: Option<Identifier>,
10809}
10810
10811#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10813#[cfg_attr(feature = "bindings", derive(TS))]
10814pub struct PrimaryKeyColumnConstraint {
10815 #[serde(default)]
10816 pub desc: Option<Box<Expression>>,
10817 #[serde(default)]
10818 pub options: Vec<Expression>,
10819}
10820
10821#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10823#[cfg_attr(feature = "bindings", derive(TS))]
10824pub struct UniqueColumnConstraint {
10825 #[serde(default)]
10826 pub this: Option<Box<Expression>>,
10827 #[serde(default)]
10828 pub index_type: Option<Box<Expression>>,
10829 #[serde(default)]
10830 pub on_conflict: Option<Box<Expression>>,
10831 #[serde(default)]
10832 pub nulls: Option<Box<Expression>>,
10833 #[serde(default)]
10834 pub options: Vec<Expression>,
10835}
10836
10837#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10839#[cfg_attr(feature = "bindings", derive(TS))]
10840pub struct WatermarkColumnConstraint {
10841 pub this: Box<Expression>,
10842 pub expression: Box<Expression>,
10843}
10844
10845#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10847#[cfg_attr(feature = "bindings", derive(TS))]
10848pub struct ComputedColumnConstraint {
10849 pub this: Box<Expression>,
10850 #[serde(default)]
10851 pub persisted: Option<Box<Expression>>,
10852 #[serde(default)]
10853 pub not_null: Option<Box<Expression>>,
10854 #[serde(default)]
10855 pub data_type: 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 InOutColumnConstraint {
10862 #[serde(default)]
10863 pub input_: Option<Box<Expression>>,
10864 #[serde(default)]
10865 pub output: Option<Box<Expression>>,
10866}
10867
10868#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10870#[cfg_attr(feature = "bindings", derive(TS))]
10871pub struct PathColumnConstraint {
10872 pub this: Box<Expression>,
10873}
10874
10875#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10877#[cfg_attr(feature = "bindings", derive(TS))]
10878pub struct Constraint {
10879 pub this: Box<Expression>,
10880 #[serde(default)]
10881 pub expressions: Vec<Expression>,
10882}
10883
10884#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10886#[cfg_attr(feature = "bindings", derive(TS))]
10887pub struct Export {
10888 pub this: Box<Expression>,
10889 #[serde(default)]
10890 pub connection: Option<Box<Expression>>,
10891 #[serde(default)]
10892 pub options: Vec<Expression>,
10893}
10894
10895#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10897#[cfg_attr(feature = "bindings", derive(TS))]
10898pub struct Filter {
10899 pub this: Box<Expression>,
10900 pub expression: Box<Expression>,
10901}
10902
10903#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10905#[cfg_attr(feature = "bindings", derive(TS))]
10906pub struct Changes {
10907 #[serde(default)]
10908 pub information: Option<Box<Expression>>,
10909 #[serde(default)]
10910 pub at_before: Option<Box<Expression>>,
10911 #[serde(default)]
10912 pub end: Option<Box<Expression>>,
10913}
10914
10915#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10917#[cfg_attr(feature = "bindings", derive(TS))]
10918pub struct Directory {
10919 pub this: Box<Expression>,
10920 #[serde(default)]
10921 pub local: Option<Box<Expression>>,
10922 #[serde(default)]
10923 pub row_format: Option<Box<Expression>>,
10924}
10925
10926#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10928#[cfg_attr(feature = "bindings", derive(TS))]
10929pub struct ForeignKey {
10930 #[serde(default)]
10931 pub expressions: Vec<Expression>,
10932 #[serde(default)]
10933 pub reference: Option<Box<Expression>>,
10934 #[serde(default)]
10935 pub delete: Option<Box<Expression>>,
10936 #[serde(default)]
10937 pub update: Option<Box<Expression>>,
10938 #[serde(default)]
10939 pub options: Vec<Expression>,
10940}
10941
10942#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10944#[cfg_attr(feature = "bindings", derive(TS))]
10945pub struct ColumnPrefix {
10946 pub this: Box<Expression>,
10947 pub expression: Box<Expression>,
10948}
10949
10950#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10952#[cfg_attr(feature = "bindings", derive(TS))]
10953pub struct PrimaryKey {
10954 #[serde(default)]
10955 pub this: Option<Box<Expression>>,
10956 #[serde(default)]
10957 pub expressions: Vec<Expression>,
10958 #[serde(default)]
10959 pub options: Vec<Expression>,
10960 #[serde(default)]
10961 pub include: Option<Box<Expression>>,
10962}
10963
10964#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10966#[cfg_attr(feature = "bindings", derive(TS))]
10967pub struct IntoClause {
10968 #[serde(default)]
10969 pub this: Option<Box<Expression>>,
10970 #[serde(default)]
10971 pub temporary: bool,
10972 #[serde(default)]
10973 pub unlogged: Option<Box<Expression>>,
10974 #[serde(default)]
10975 pub bulk_collect: Option<Box<Expression>>,
10976 #[serde(default)]
10977 pub expressions: Vec<Expression>,
10978}
10979
10980#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10982#[cfg_attr(feature = "bindings", derive(TS))]
10983pub struct JoinHint {
10984 pub this: Box<Expression>,
10985 #[serde(default)]
10986 pub expressions: Vec<Expression>,
10987}
10988
10989#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10991#[cfg_attr(feature = "bindings", derive(TS))]
10992pub struct Opclass {
10993 pub this: Box<Expression>,
10994 pub expression: Box<Expression>,
10995}
10996
10997#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
10999#[cfg_attr(feature = "bindings", derive(TS))]
11000pub struct Index {
11001 #[serde(default)]
11002 pub this: Option<Box<Expression>>,
11003 #[serde(default)]
11004 pub table: Option<Box<Expression>>,
11005 #[serde(default)]
11006 pub unique: bool,
11007 #[serde(default)]
11008 pub primary: Option<Box<Expression>>,
11009 #[serde(default)]
11010 pub amp: Option<Box<Expression>>,
11011 #[serde(default)]
11012 pub params: Vec<Expression>,
11013}
11014
11015#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11017#[cfg_attr(feature = "bindings", derive(TS))]
11018pub struct IndexParameters {
11019 #[serde(default)]
11020 pub using: Option<Box<Expression>>,
11021 #[serde(default)]
11022 pub include: Option<Box<Expression>>,
11023 #[serde(default)]
11024 pub columns: Vec<Expression>,
11025 #[serde(default)]
11026 pub with_storage: Option<Box<Expression>>,
11027 #[serde(default)]
11028 pub partition_by: Option<Box<Expression>>,
11029 #[serde(default)]
11030 pub tablespace: Option<Box<Expression>>,
11031 #[serde(default)]
11032 pub where_: Option<Box<Expression>>,
11033 #[serde(default)]
11034 pub on: Option<Box<Expression>>,
11035}
11036
11037#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11039#[cfg_attr(feature = "bindings", derive(TS))]
11040pub struct ConditionalInsert {
11041 pub this: Box<Expression>,
11042 #[serde(default)]
11043 pub expression: Option<Box<Expression>>,
11044 #[serde(default)]
11045 pub else_: Option<Box<Expression>>,
11046}
11047
11048#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11050#[cfg_attr(feature = "bindings", derive(TS))]
11051pub struct MultitableInserts {
11052 #[serde(default)]
11053 pub expressions: Vec<Expression>,
11054 pub kind: String,
11055 #[serde(default)]
11056 pub source: Option<Box<Expression>>,
11057 #[serde(default)]
11059 pub leading_comments: Vec<String>,
11060 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
11062 pub overwrite: bool,
11063}
11064
11065#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11067#[cfg_attr(feature = "bindings", derive(TS))]
11068pub struct OnConflict {
11069 #[serde(default)]
11070 pub duplicate: Option<Box<Expression>>,
11071 #[serde(default)]
11072 pub expressions: Vec<Expression>,
11073 #[serde(default)]
11074 pub action: Option<Box<Expression>>,
11075 #[serde(default)]
11076 pub conflict_keys: Option<Box<Expression>>,
11077 #[serde(default)]
11078 pub index_predicate: Option<Box<Expression>>,
11079 #[serde(default)]
11080 pub constraint: Option<Box<Expression>>,
11081 #[serde(default)]
11082 pub where_: Option<Box<Expression>>,
11083}
11084
11085#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11087#[cfg_attr(feature = "bindings", derive(TS))]
11088pub struct OnCondition {
11089 #[serde(default)]
11090 pub error: Option<Box<Expression>>,
11091 #[serde(default)]
11092 pub empty: Option<Box<Expression>>,
11093 #[serde(default)]
11094 pub null: 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 Returning {
11101 #[serde(default)]
11102 pub expressions: Vec<Expression>,
11103 #[serde(default)]
11104 pub into: Option<Box<Expression>>,
11105}
11106
11107#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11109#[cfg_attr(feature = "bindings", derive(TS))]
11110pub struct Introducer {
11111 pub this: Box<Expression>,
11112 pub expression: Box<Expression>,
11113}
11114
11115#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11117#[cfg_attr(feature = "bindings", derive(TS))]
11118pub struct PartitionRange {
11119 pub this: Box<Expression>,
11120 #[serde(default)]
11121 pub expression: Option<Box<Expression>>,
11122 #[serde(default)]
11123 pub expressions: Vec<Expression>,
11124}
11125
11126#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11128#[cfg_attr(feature = "bindings", derive(TS))]
11129pub struct Group {
11130 #[serde(default)]
11131 pub expressions: Vec<Expression>,
11132 #[serde(default)]
11133 pub grouping_sets: Option<Box<Expression>>,
11134 #[serde(default)]
11135 pub cube: Option<Box<Expression>>,
11136 #[serde(default)]
11137 pub rollup: Option<Box<Expression>>,
11138 #[serde(default)]
11139 pub totals: Option<Box<Expression>>,
11140 #[serde(default)]
11142 pub all: Option<bool>,
11143}
11144
11145#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11147#[cfg_attr(feature = "bindings", derive(TS))]
11148pub struct Cube {
11149 #[serde(default)]
11150 pub expressions: Vec<Expression>,
11151}
11152
11153#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11155#[cfg_attr(feature = "bindings", derive(TS))]
11156pub struct Rollup {
11157 #[serde(default)]
11158 pub expressions: Vec<Expression>,
11159}
11160
11161#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11163#[cfg_attr(feature = "bindings", derive(TS))]
11164pub struct GroupingSets {
11165 #[serde(default)]
11166 pub expressions: Vec<Expression>,
11167}
11168
11169#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11171#[cfg_attr(feature = "bindings", derive(TS))]
11172pub struct LimitOptions {
11173 #[serde(default)]
11174 pub percent: Option<Box<Expression>>,
11175 #[serde(default)]
11176 pub rows: Option<Box<Expression>>,
11177 #[serde(default)]
11178 pub with_ties: Option<Box<Expression>>,
11179}
11180
11181#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11183#[cfg_attr(feature = "bindings", derive(TS))]
11184pub struct Lateral {
11185 pub this: Box<Expression>,
11186 #[serde(default)]
11187 pub view: Option<Box<Expression>>,
11188 #[serde(default)]
11189 pub outer: Option<Box<Expression>>,
11190 #[serde(default)]
11191 pub alias: Option<String>,
11192 #[serde(default, skip_serializing_if = "std::ops::Not::not")]
11194 pub alias_quoted: bool,
11195 #[serde(default)]
11196 pub cross_apply: Option<Box<Expression>>,
11197 #[serde(default)]
11198 pub ordinality: Option<Box<Expression>>,
11199 #[serde(default, skip_serializing_if = "Vec::is_empty")]
11201 pub column_aliases: Vec<String>,
11202}
11203
11204#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11206#[cfg_attr(feature = "bindings", derive(TS))]
11207pub struct TableFromRows {
11208 pub this: Box<Expression>,
11209 #[serde(default)]
11210 pub alias: Option<String>,
11211 #[serde(default)]
11212 pub joins: Vec<Expression>,
11213 #[serde(default)]
11214 pub pivots: Option<Box<Expression>>,
11215 #[serde(default)]
11216 pub sample: Option<Box<Expression>>,
11217}
11218
11219#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11222#[cfg_attr(feature = "bindings", derive(TS))]
11223pub struct RowsFrom {
11224 pub expressions: Vec<Expression>,
11226 #[serde(default)]
11228 pub ordinality: bool,
11229 #[serde(default)]
11231 pub alias: Option<Box<Expression>>,
11232}
11233
11234#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11236#[cfg_attr(feature = "bindings", derive(TS))]
11237pub struct WithFill {
11238 #[serde(default)]
11239 pub from_: Option<Box<Expression>>,
11240 #[serde(default)]
11241 pub to: Option<Box<Expression>>,
11242 #[serde(default)]
11243 pub step: Option<Box<Expression>>,
11244 #[serde(default)]
11245 pub staleness: Option<Box<Expression>>,
11246 #[serde(default)]
11247 pub interpolate: Option<Box<Expression>>,
11248}
11249
11250#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11252#[cfg_attr(feature = "bindings", derive(TS))]
11253pub struct Property {
11254 pub this: Box<Expression>,
11255 #[serde(default)]
11256 pub value: Option<Box<Expression>>,
11257}
11258
11259#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11261#[cfg_attr(feature = "bindings", derive(TS))]
11262pub struct GrantPrivilege {
11263 pub this: Box<Expression>,
11264 #[serde(default)]
11265 pub expressions: Vec<Expression>,
11266}
11267
11268#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11270#[cfg_attr(feature = "bindings", derive(TS))]
11271pub struct AllowedValuesProperty {
11272 #[serde(default)]
11273 pub expressions: Vec<Expression>,
11274}
11275
11276#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11278#[cfg_attr(feature = "bindings", derive(TS))]
11279pub struct AlgorithmProperty {
11280 pub this: Box<Expression>,
11281}
11282
11283#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11285#[cfg_attr(feature = "bindings", derive(TS))]
11286pub struct AutoIncrementProperty {
11287 pub this: Box<Expression>,
11288}
11289
11290#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11292#[cfg_attr(feature = "bindings", derive(TS))]
11293pub struct AutoRefreshProperty {
11294 pub this: Box<Expression>,
11295}
11296
11297#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11299#[cfg_attr(feature = "bindings", derive(TS))]
11300pub struct BackupProperty {
11301 pub this: Box<Expression>,
11302}
11303
11304#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11306#[cfg_attr(feature = "bindings", derive(TS))]
11307pub struct BuildProperty {
11308 pub this: Box<Expression>,
11309}
11310
11311#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11313#[cfg_attr(feature = "bindings", derive(TS))]
11314pub struct BlockCompressionProperty {
11315 #[serde(default)]
11316 pub autotemp: Option<Box<Expression>>,
11317 #[serde(default)]
11318 pub always: Option<Box<Expression>>,
11319 #[serde(default)]
11320 pub default: Option<Box<Expression>>,
11321 #[serde(default)]
11322 pub manual: Option<Box<Expression>>,
11323 #[serde(default)]
11324 pub never: Option<Box<Expression>>,
11325}
11326
11327#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11329#[cfg_attr(feature = "bindings", derive(TS))]
11330pub struct CharacterSetProperty {
11331 pub this: 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 ChecksumProperty {
11340 #[serde(default)]
11341 pub on: Option<Box<Expression>>,
11342 #[serde(default)]
11343 pub default: Option<Box<Expression>>,
11344}
11345
11346#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11348#[cfg_attr(feature = "bindings", derive(TS))]
11349pub struct CollateProperty {
11350 pub this: Box<Expression>,
11351 #[serde(default)]
11352 pub default: Option<Box<Expression>>,
11353}
11354
11355#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11357#[cfg_attr(feature = "bindings", derive(TS))]
11358pub struct DataBlocksizeProperty {
11359 #[serde(default)]
11360 pub size: Option<i64>,
11361 #[serde(default)]
11362 pub units: Option<Box<Expression>>,
11363 #[serde(default)]
11364 pub minimum: Option<Box<Expression>>,
11365 #[serde(default)]
11366 pub maximum: Option<Box<Expression>>,
11367 #[serde(default)]
11368 pub default: Option<Box<Expression>>,
11369}
11370
11371#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11373#[cfg_attr(feature = "bindings", derive(TS))]
11374pub struct DataDeletionProperty {
11375 #[ast(skip)]
11377 pub on: Box<Expression>,
11378 #[serde(default)]
11379 pub filter_column: Option<Box<Expression>>,
11380 #[serde(default)]
11381 pub retention_period: Option<Box<Expression>>,
11382}
11383
11384#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11386#[cfg_attr(feature = "bindings", derive(TS))]
11387pub struct DefinerProperty {
11388 pub this: Box<Expression>,
11389}
11390
11391#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11393#[cfg_attr(feature = "bindings", derive(TS))]
11394pub struct DistKeyProperty {
11395 pub this: Box<Expression>,
11396}
11397
11398#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11400#[cfg_attr(feature = "bindings", derive(TS))]
11401pub struct DistributedByProperty {
11402 #[serde(default)]
11403 pub expressions: Vec<Expression>,
11404 pub kind: String,
11405 #[serde(default)]
11406 pub buckets: Option<Box<Expression>>,
11407 #[serde(default)]
11408 pub order: Option<Box<Expression>>,
11409}
11410
11411#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11413#[cfg_attr(feature = "bindings", derive(TS))]
11414pub struct DistStyleProperty {
11415 pub this: Box<Expression>,
11416}
11417
11418#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11420#[cfg_attr(feature = "bindings", derive(TS))]
11421pub struct DuplicateKeyProperty {
11422 #[serde(default)]
11423 pub expressions: Vec<Expression>,
11424}
11425
11426#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11428#[cfg_attr(feature = "bindings", derive(TS))]
11429pub struct EngineProperty {
11430 pub this: Box<Expression>,
11431}
11432
11433#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11435#[cfg_attr(feature = "bindings", derive(TS))]
11436pub struct ToTableProperty {
11437 pub this: Box<Expression>,
11438}
11439
11440#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11442#[cfg_attr(feature = "bindings", derive(TS))]
11443pub struct ExecuteAsProperty {
11444 pub this: Box<Expression>,
11445}
11446
11447#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11449#[cfg_attr(feature = "bindings", derive(TS))]
11450pub struct ExternalProperty {
11451 #[serde(default)]
11452 pub this: 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 FallbackProperty {
11459 #[serde(default)]
11460 pub no: Option<Box<Expression>>,
11461 #[serde(default)]
11462 pub protection: Option<Box<Expression>>,
11463}
11464
11465#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11467#[cfg_attr(feature = "bindings", derive(TS))]
11468pub struct FileFormatProperty {
11469 #[serde(default)]
11470 pub this: Option<Box<Expression>>,
11471 #[serde(default)]
11472 pub expressions: Vec<Expression>,
11473 #[serde(default)]
11474 pub hive_format: Option<Box<Expression>>,
11475}
11476
11477#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11479#[cfg_attr(feature = "bindings", derive(TS))]
11480pub struct CredentialsProperty {
11481 #[serde(default)]
11482 pub expressions: Vec<Expression>,
11483}
11484
11485#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11487#[cfg_attr(feature = "bindings", derive(TS))]
11488pub struct FreespaceProperty {
11489 pub this: Box<Expression>,
11490 #[serde(default)]
11491 pub percent: Option<Box<Expression>>,
11492}
11493
11494#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11496#[cfg_attr(feature = "bindings", derive(TS))]
11497pub struct InheritsProperty {
11498 #[serde(default)]
11499 pub expressions: Vec<Expression>,
11500}
11501
11502#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11504#[cfg_attr(feature = "bindings", derive(TS))]
11505pub struct InputModelProperty {
11506 pub this: Box<Expression>,
11507}
11508
11509#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11511#[cfg_attr(feature = "bindings", derive(TS))]
11512pub struct OutputModelProperty {
11513 pub this: Box<Expression>,
11514}
11515
11516#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11518#[cfg_attr(feature = "bindings", derive(TS))]
11519pub struct IsolatedLoadingProperty {
11520 #[serde(default)]
11521 pub no: Option<Box<Expression>>,
11522 #[serde(default)]
11523 pub concurrent: Option<Box<Expression>>,
11524 #[serde(default)]
11525 pub target: Option<Box<Expression>>,
11526}
11527
11528#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11530#[cfg_attr(feature = "bindings", derive(TS))]
11531pub struct JournalProperty {
11532 #[serde(default)]
11533 pub no: Option<Box<Expression>>,
11534 #[serde(default)]
11535 pub dual: Option<Box<Expression>>,
11536 #[serde(default)]
11537 pub before: Option<Box<Expression>>,
11538 #[serde(default)]
11539 pub local: Option<Box<Expression>>,
11540 #[serde(default)]
11541 pub after: Option<Box<Expression>>,
11542}
11543
11544#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11546#[cfg_attr(feature = "bindings", derive(TS))]
11547pub struct LanguageProperty {
11548 pub this: Box<Expression>,
11549}
11550
11551#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11553#[cfg_attr(feature = "bindings", derive(TS))]
11554pub struct EnviromentProperty {
11555 #[serde(default)]
11556 pub expressions: Vec<Expression>,
11557}
11558
11559#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11561#[cfg_attr(feature = "bindings", derive(TS))]
11562pub struct ClusteredByProperty {
11563 #[serde(default)]
11564 pub expressions: Vec<Expression>,
11565 #[serde(default)]
11566 pub sorted_by: Option<Box<Expression>>,
11567 #[serde(default)]
11568 pub buckets: 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 DictProperty {
11575 pub this: Box<Expression>,
11576 pub kind: String,
11577 #[serde(default)]
11578 pub settings: Option<Box<Expression>>,
11579}
11580
11581#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11583#[cfg_attr(feature = "bindings", derive(TS))]
11584pub struct DictRange {
11585 pub this: Box<Expression>,
11586 #[serde(default)]
11587 pub min: Option<Box<Expression>>,
11588 #[serde(default)]
11589 pub max: Option<Box<Expression>>,
11590}
11591
11592#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11594#[cfg_attr(feature = "bindings", derive(TS))]
11595pub struct OnCluster {
11596 pub this: Box<Expression>,
11597}
11598
11599#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11601#[cfg_attr(feature = "bindings", derive(TS))]
11602pub struct LikeProperty {
11603 pub this: Box<Expression>,
11604 #[serde(default)]
11605 pub expressions: Vec<Expression>,
11606}
11607
11608#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11610#[cfg_attr(feature = "bindings", derive(TS))]
11611pub struct LocationProperty {
11612 pub this: Box<Expression>,
11613}
11614
11615#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11617#[cfg_attr(feature = "bindings", derive(TS))]
11618pub struct LockProperty {
11619 pub this: Box<Expression>,
11620}
11621
11622#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11624#[cfg_attr(feature = "bindings", derive(TS))]
11625pub struct LockingProperty {
11626 #[serde(default)]
11627 pub this: Option<Box<Expression>>,
11628 pub kind: String,
11629 #[serde(default)]
11630 pub for_or_in: Option<Box<Expression>>,
11631 #[serde(default)]
11632 pub lock_type: Option<Box<Expression>>,
11633 #[serde(default)]
11634 pub override_: Option<Box<Expression>>,
11635}
11636
11637#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11639#[cfg_attr(feature = "bindings", derive(TS))]
11640pub struct LogProperty {
11641 #[serde(default)]
11642 pub no: Option<Box<Expression>>,
11643}
11644
11645#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11647#[cfg_attr(feature = "bindings", derive(TS))]
11648pub struct MaterializedProperty {
11649 #[serde(default)]
11650 pub this: Option<Box<Expression>>,
11651}
11652
11653#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11655#[cfg_attr(feature = "bindings", derive(TS))]
11656pub struct MergeBlockRatioProperty {
11657 #[serde(default)]
11658 pub this: Option<Box<Expression>>,
11659 #[serde(default)]
11660 pub no: Option<Box<Expression>>,
11661 #[serde(default)]
11662 pub default: Option<Box<Expression>>,
11663 #[serde(default)]
11664 pub percent: Option<Box<Expression>>,
11665}
11666
11667#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11669#[cfg_attr(feature = "bindings", derive(TS))]
11670pub struct OnProperty {
11671 pub this: Box<Expression>,
11672}
11673
11674#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11676#[cfg_attr(feature = "bindings", derive(TS))]
11677pub struct OnCommitProperty {
11678 #[serde(default)]
11679 pub delete: Option<Box<Expression>>,
11680}
11681
11682#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11684#[cfg_attr(feature = "bindings", derive(TS))]
11685pub struct PartitionedByProperty {
11686 pub this: Box<Expression>,
11687}
11688
11689#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11691#[cfg_attr(feature = "bindings", derive(TS))]
11692pub struct PartitionByProperty {
11693 #[serde(default)]
11694 pub expressions: Vec<Expression>,
11695}
11696
11697#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11699#[cfg_attr(feature = "bindings", derive(TS))]
11700pub struct PartitionedByBucket {
11701 pub this: Box<Expression>,
11702 pub expression: Box<Expression>,
11703}
11704
11705#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11707#[cfg_attr(feature = "bindings", derive(TS))]
11708pub struct ClusterByColumnsProperty {
11709 #[serde(default)]
11710 pub columns: Vec<Identifier>,
11711}
11712
11713#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11715#[cfg_attr(feature = "bindings", derive(TS))]
11716pub struct PartitionByTruncate {
11717 pub this: Box<Expression>,
11718 pub expression: 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 PartitionByRangeProperty {
11725 #[serde(default)]
11726 pub partition_expressions: Option<Box<Expression>>,
11727 #[serde(default)]
11728 pub create_expressions: Option<Box<Expression>>,
11729}
11730
11731#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11733#[cfg_attr(feature = "bindings", derive(TS))]
11734pub struct PartitionByRangePropertyDynamic {
11735 #[serde(default)]
11736 pub this: Option<Box<Expression>>,
11737 #[serde(default)]
11738 pub start: Option<Box<Expression>>,
11739 #[serde(default)]
11741 pub use_start_end: bool,
11742 #[serde(default)]
11743 pub end: Option<Box<Expression>>,
11744 #[serde(default)]
11745 pub every: 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 PartitionByListProperty {
11752 #[serde(default)]
11753 pub partition_expressions: Option<Box<Expression>>,
11754 #[serde(default)]
11755 pub create_expressions: Option<Box<Expression>>,
11756}
11757
11758#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11760#[cfg_attr(feature = "bindings", derive(TS))]
11761pub struct PartitionList {
11762 pub this: Box<Expression>,
11763 #[serde(default)]
11764 pub expressions: Vec<Expression>,
11765}
11766
11767#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11769#[cfg_attr(feature = "bindings", derive(TS))]
11770pub struct Partition {
11771 pub expressions: Vec<Expression>,
11772 #[serde(default)]
11773 pub subpartition: bool,
11774}
11775
11776#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11779#[cfg_attr(feature = "bindings", derive(TS))]
11780pub struct RefreshTriggerProperty {
11781 pub method: String,
11783 #[serde(default)]
11785 pub kind: Option<String>,
11786 #[serde(default)]
11788 pub every: Option<Box<Expression>>,
11789 #[serde(default)]
11791 pub unit: Option<String>,
11792 #[serde(default)]
11794 pub starts: Option<Box<Expression>>,
11795}
11796
11797#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11799#[cfg_attr(feature = "bindings", derive(TS))]
11800pub struct UniqueKeyProperty {
11801 #[serde(default)]
11802 pub expressions: Vec<Expression>,
11803}
11804
11805#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11807#[cfg_attr(feature = "bindings", derive(TS))]
11808pub struct RollupProperty {
11809 pub expressions: Vec<RollupIndex>,
11810}
11811
11812#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11814#[cfg_attr(feature = "bindings", derive(TS))]
11815pub struct RollupIndex {
11816 pub name: Identifier,
11817 pub expressions: Vec<Identifier>,
11818}
11819
11820#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11822#[cfg_attr(feature = "bindings", derive(TS))]
11823pub struct PartitionBoundSpec {
11824 #[serde(default)]
11825 pub this: Option<Box<Expression>>,
11826 #[serde(default)]
11827 pub expression: Option<Box<Expression>>,
11828 #[serde(default)]
11829 pub from_expressions: Option<Box<Expression>>,
11830 #[serde(default)]
11831 pub to_expressions: Option<Box<Expression>>,
11832}
11833
11834#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11836#[cfg_attr(feature = "bindings", derive(TS))]
11837pub struct PartitionedOfProperty {
11838 pub this: Box<Expression>,
11839 pub expression: Box<Expression>,
11840}
11841
11842#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11844#[cfg_attr(feature = "bindings", derive(TS))]
11845pub struct RemoteWithConnectionModelProperty {
11846 pub this: Box<Expression>,
11847}
11848
11849#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11851#[cfg_attr(feature = "bindings", derive(TS))]
11852pub struct ReturnsProperty {
11853 #[serde(default)]
11854 pub this: Option<Box<Expression>>,
11855 #[serde(default)]
11856 pub is_table: Option<Box<Expression>>,
11857 #[serde(default)]
11858 pub table: Option<Box<Expression>>,
11859 #[serde(default)]
11860 pub null: Option<Box<Expression>>,
11861}
11862
11863#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11865#[cfg_attr(feature = "bindings", derive(TS))]
11866pub struct RowFormatProperty {
11867 pub this: Box<Expression>,
11868}
11869
11870#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11872#[cfg_attr(feature = "bindings", derive(TS))]
11873pub struct RowFormatDelimitedProperty {
11874 #[serde(default)]
11875 pub fields: Option<Box<Expression>>,
11876 #[serde(default)]
11877 pub escaped: Option<Box<Expression>>,
11878 #[serde(default)]
11879 pub collection_items: Option<Box<Expression>>,
11880 #[serde(default)]
11881 pub map_keys: Option<Box<Expression>>,
11882 #[serde(default)]
11883 pub lines: Option<Box<Expression>>,
11884 #[serde(default)]
11885 pub null: Option<Box<Expression>>,
11886 #[serde(default)]
11887 pub serde: Option<Box<Expression>>,
11888}
11889
11890#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11892#[cfg_attr(feature = "bindings", derive(TS))]
11893pub struct RowFormatSerdeProperty {
11894 pub this: Box<Expression>,
11895 #[serde(default)]
11896 pub serde_properties: Option<Box<Expression>>,
11897}
11898
11899#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11901#[cfg_attr(feature = "bindings", derive(TS))]
11902pub struct QueryTransform {
11903 #[serde(default)]
11904 pub expressions: Vec<Expression>,
11905 #[serde(default)]
11906 pub command_script: Option<Box<Expression>>,
11907 #[serde(default)]
11908 pub schema: Option<Box<Expression>>,
11909 #[serde(default)]
11910 pub row_format_before: Option<Box<Expression>>,
11911 #[serde(default)]
11912 pub record_writer: Option<Box<Expression>>,
11913 #[serde(default)]
11914 pub row_format_after: Option<Box<Expression>>,
11915 #[serde(default)]
11916 pub record_reader: Option<Box<Expression>>,
11917}
11918
11919#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11921#[cfg_attr(feature = "bindings", derive(TS))]
11922pub struct SampleProperty {
11923 pub this: Box<Expression>,
11924}
11925
11926#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11928#[cfg_attr(feature = "bindings", derive(TS))]
11929pub struct SecurityProperty {
11930 pub this: Box<Expression>,
11931}
11932
11933#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11935#[cfg_attr(feature = "bindings", derive(TS))]
11936pub struct SchemaCommentProperty {
11937 pub this: Box<Expression>,
11938}
11939
11940#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11942#[cfg_attr(feature = "bindings", derive(TS))]
11943pub struct SemanticView {
11944 pub this: Box<Expression>,
11945 #[serde(default)]
11946 pub metrics: Option<Box<Expression>>,
11947 #[serde(default)]
11948 pub dimensions: Option<Box<Expression>>,
11949 #[serde(default)]
11950 pub facts: Option<Box<Expression>>,
11951 #[serde(default)]
11952 pub where_: 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 SerdeProperties {
11959 #[serde(default)]
11960 pub expressions: Vec<Expression>,
11961 #[serde(default)]
11962 pub with_: Option<Box<Expression>>,
11963}
11964
11965#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11967#[cfg_attr(feature = "bindings", derive(TS))]
11968pub struct SetProperty {
11969 #[serde(default)]
11970 pub multi: Option<Box<Expression>>,
11971}
11972
11973#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11975#[cfg_attr(feature = "bindings", derive(TS))]
11976pub struct SharingProperty {
11977 #[serde(default)]
11978 pub this: Option<Box<Expression>>,
11979}
11980
11981#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11983#[cfg_attr(feature = "bindings", derive(TS))]
11984pub struct SetConfigProperty {
11985 pub this: Box<Expression>,
11986}
11987
11988#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11990#[cfg_attr(feature = "bindings", derive(TS))]
11991pub struct SettingsProperty {
11992 #[serde(default)]
11993 pub expressions: Vec<Expression>,
11994}
11995
11996#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
11998#[cfg_attr(feature = "bindings", derive(TS))]
11999pub struct SortKeyProperty {
12000 pub this: Box<Expression>,
12001 #[serde(default)]
12002 pub compound: Option<Box<Expression>>,
12003}
12004
12005#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12007#[cfg_attr(feature = "bindings", derive(TS))]
12008pub struct SqlReadWriteProperty {
12009 pub this: Box<Expression>,
12010}
12011
12012#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12014#[cfg_attr(feature = "bindings", derive(TS))]
12015pub struct SqlSecurityProperty {
12016 pub this: Box<Expression>,
12017}
12018
12019#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12021#[cfg_attr(feature = "bindings", derive(TS))]
12022pub struct StabilityProperty {
12023 pub this: Box<Expression>,
12024}
12025
12026#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12028#[cfg_attr(feature = "bindings", derive(TS))]
12029pub struct StorageHandlerProperty {
12030 pub this: Box<Expression>,
12031}
12032
12033#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12035#[cfg_attr(feature = "bindings", derive(TS))]
12036pub struct TemporaryProperty {
12037 #[serde(default)]
12038 pub this: Option<Box<Expression>>,
12039}
12040
12041#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12043#[cfg_attr(feature = "bindings", derive(TS))]
12044pub struct Tags {
12045 #[serde(default)]
12046 pub expressions: Vec<Expression>,
12047}
12048
12049#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12051#[cfg_attr(feature = "bindings", derive(TS))]
12052pub struct TransformModelProperty {
12053 #[serde(default)]
12054 pub expressions: Vec<Expression>,
12055}
12056
12057#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12059#[cfg_attr(feature = "bindings", derive(TS))]
12060pub struct TransientProperty {
12061 #[serde(default)]
12062 pub this: Option<Box<Expression>>,
12063}
12064
12065#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12067#[cfg_attr(feature = "bindings", derive(TS))]
12068pub struct UsingTemplateProperty {
12069 pub this: Box<Expression>,
12070}
12071
12072#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12074#[cfg_attr(feature = "bindings", derive(TS))]
12075pub struct ViewAttributeProperty {
12076 pub this: Box<Expression>,
12077}
12078
12079#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12081#[cfg_attr(feature = "bindings", derive(TS))]
12082pub struct VolatileProperty {
12083 #[serde(default)]
12084 pub this: 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 WithDataProperty {
12091 #[serde(default)]
12092 pub no: Option<Box<Expression>>,
12093 #[serde(default)]
12094 pub statistics: Option<Box<Expression>>,
12095}
12096
12097#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12099#[cfg_attr(feature = "bindings", derive(TS))]
12100pub struct WithJournalTableProperty {
12101 pub this: Box<Expression>,
12102}
12103
12104#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12106#[cfg_attr(feature = "bindings", derive(TS))]
12107pub struct WithSchemaBindingProperty {
12108 pub this: Box<Expression>,
12109}
12110
12111#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12113#[cfg_attr(feature = "bindings", derive(TS))]
12114pub struct WithSystemVersioningProperty {
12115 #[serde(default)]
12116 pub on: Option<Box<Expression>>,
12117 #[serde(default)]
12118 pub this: Option<Box<Expression>>,
12119 #[serde(default)]
12120 pub data_consistency: Option<Box<Expression>>,
12121 #[serde(default)]
12122 pub retention_period: Option<Box<Expression>>,
12123 #[serde(default)]
12124 pub with_: Option<Box<Expression>>,
12125}
12126
12127#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12129#[cfg_attr(feature = "bindings", derive(TS))]
12130pub struct WithProcedureOptions {
12131 #[serde(default)]
12132 pub expressions: Vec<Expression>,
12133}
12134
12135#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12137#[cfg_attr(feature = "bindings", derive(TS))]
12138pub struct EncodeProperty {
12139 pub this: Box<Expression>,
12140 #[serde(default)]
12141 pub properties: Vec<Expression>,
12142 #[serde(default)]
12143 pub key: Option<Box<Expression>>,
12144}
12145
12146#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12148#[cfg_attr(feature = "bindings", derive(TS))]
12149pub struct IncludeProperty {
12150 pub this: Box<Expression>,
12151 #[serde(default)]
12152 pub alias: Option<String>,
12153 #[serde(default)]
12154 pub column_def: Option<Box<Expression>>,
12155}
12156
12157#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12159#[cfg_attr(feature = "bindings", derive(TS))]
12160pub struct Properties {
12161 #[serde(default)]
12162 pub expressions: Vec<Expression>,
12163}
12164
12165#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12167#[cfg_attr(feature = "bindings", derive(TS))]
12168pub struct OptionEntry {
12169 pub key: Identifier,
12170 pub value: Expression,
12171}
12172
12173#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12175#[cfg_attr(feature = "bindings", derive(TS))]
12176pub struct OptionsProperty {
12177 #[serde(default)]
12178 pub entries: Vec<OptionEntry>,
12179}
12180
12181#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12183#[cfg_attr(feature = "bindings", derive(TS))]
12184pub struct InputOutputFormat {
12185 #[serde(default)]
12186 pub input_format: Option<Box<Expression>>,
12187 #[serde(default)]
12188 pub output_format: Option<Box<Expression>>,
12189}
12190
12191#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12193#[cfg_attr(feature = "bindings", derive(TS))]
12194pub struct Reference {
12195 pub this: Box<Expression>,
12196 #[serde(default)]
12197 pub expressions: Vec<Expression>,
12198 #[serde(default)]
12199 pub options: Vec<Expression>,
12200}
12201
12202#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12204#[cfg_attr(feature = "bindings", derive(TS))]
12205pub struct QueryOption {
12206 pub this: Box<Expression>,
12207 #[serde(default)]
12208 pub expression: Option<Box<Expression>>,
12209}
12210
12211#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12213#[cfg_attr(feature = "bindings", derive(TS))]
12214pub struct WithTableHint {
12215 #[serde(default)]
12216 pub expressions: Vec<Expression>,
12217}
12218
12219#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12221#[cfg_attr(feature = "bindings", derive(TS))]
12222pub struct IndexTableHint {
12223 pub this: Box<Expression>,
12224 #[serde(default)]
12225 pub expressions: Vec<Expression>,
12226 #[serde(default)]
12227 pub target: Option<Box<Expression>>,
12228}
12229
12230#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12232#[cfg_attr(feature = "bindings", derive(TS))]
12233pub struct Get {
12234 pub this: Box<Expression>,
12235 #[serde(default)]
12236 pub target: Option<Box<Expression>>,
12237 #[serde(default)]
12238 pub properties: Vec<Expression>,
12239}
12240
12241#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12243#[cfg_attr(feature = "bindings", derive(TS))]
12244pub struct SetOperation {
12245 #[serde(default)]
12246 pub with_: Option<Box<Expression>>,
12247 pub this: Box<Expression>,
12248 pub expression: Box<Expression>,
12249 #[serde(default)]
12250 pub distinct: bool,
12251 #[serde(default)]
12252 pub by_name: Option<Box<Expression>>,
12253 #[serde(default)]
12254 pub side: Option<Box<Expression>>,
12255 #[serde(default)]
12256 pub kind: Option<String>,
12257 #[serde(default)]
12258 pub on: Option<Box<Expression>>,
12259}
12260
12261#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12263#[cfg_attr(feature = "bindings", derive(TS))]
12264pub struct Var {
12265 pub this: String,
12266}
12267
12268#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12270#[cfg_attr(feature = "bindings", derive(TS))]
12271pub struct Variadic {
12272 pub this: 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 Version {
12279 pub this: Box<Expression>,
12280 pub kind: String,
12281 #[serde(default)]
12282 pub expression: Option<Box<Expression>>,
12283}
12284
12285#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12287#[cfg_attr(feature = "bindings", derive(TS))]
12288pub struct Schema {
12289 #[serde(default)]
12290 pub this: Option<Box<Expression>>,
12291 #[serde(default)]
12292 pub expressions: Vec<Expression>,
12293}
12294
12295#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12297#[cfg_attr(feature = "bindings", derive(TS))]
12298pub struct Lock {
12299 #[serde(default)]
12300 pub update: Option<Box<Expression>>,
12301 #[serde(default)]
12302 pub expressions: Vec<Expression>,
12303 #[serde(default)]
12304 pub wait: Option<Box<Expression>>,
12305 #[serde(default)]
12306 pub key: Option<Box<Expression>>,
12307}
12308
12309#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12312#[cfg_attr(feature = "bindings", derive(TS))]
12313pub struct TableSample {
12314 #[serde(default, skip_serializing_if = "Option::is_none")]
12316 pub this: Option<Box<Expression>>,
12317 #[serde(default, skip_serializing_if = "Option::is_none")]
12319 pub sample: Option<Box<Sample>>,
12320 #[serde(default)]
12321 pub expressions: Vec<Expression>,
12322 #[serde(default)]
12323 pub method: Option<String>,
12324 #[serde(default)]
12325 pub bucket_numerator: Option<Box<Expression>>,
12326 #[serde(default)]
12327 pub bucket_denominator: Option<Box<Expression>>,
12328 #[serde(default)]
12329 pub bucket_field: Option<Box<Expression>>,
12330 #[serde(default)]
12331 pub percent: Option<Box<Expression>>,
12332 #[serde(default)]
12333 pub rows: Option<Box<Expression>>,
12334 #[serde(default)]
12335 pub size: Option<i64>,
12336 #[serde(default)]
12337 pub seed: Option<Box<Expression>>,
12338}
12339
12340#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12342#[cfg_attr(feature = "bindings", derive(TS))]
12343pub struct Tag {
12344 #[serde(default)]
12345 pub this: Option<Box<Expression>>,
12346 #[serde(default)]
12347 pub prefix: Option<Box<Expression>>,
12348 #[serde(default)]
12349 pub postfix: Option<Box<Expression>>,
12350}
12351
12352#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12354#[cfg_attr(feature = "bindings", derive(TS))]
12355pub struct UnpivotColumns {
12356 pub this: Box<Expression>,
12357 #[serde(default)]
12358 pub expressions: Vec<Expression>,
12359}
12360
12361#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12363#[cfg_attr(feature = "bindings", derive(TS))]
12364pub struct SessionParameter {
12365 pub this: Box<Expression>,
12366 #[serde(default)]
12367 pub kind: Option<String>,
12368}
12369
12370#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12372#[cfg_attr(feature = "bindings", derive(TS))]
12373pub struct PseudoType {
12374 pub this: Box<Expression>,
12375}
12376
12377#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12379#[cfg_attr(feature = "bindings", derive(TS))]
12380pub struct ObjectIdentifier {
12381 pub this: Box<Expression>,
12382}
12383
12384#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12386#[cfg_attr(feature = "bindings", derive(TS))]
12387pub struct Transaction {
12388 #[serde(default)]
12389 pub this: Option<Box<Expression>>,
12390 #[serde(default)]
12391 pub modes: Option<Box<Expression>>,
12392 #[serde(default)]
12393 pub mark: Option<Box<Expression>>,
12394}
12395
12396#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12398#[cfg_attr(feature = "bindings", derive(TS))]
12399pub struct Commit {
12400 #[serde(default)]
12401 pub chain: Option<Box<Expression>>,
12402 #[serde(default)]
12403 pub this: Option<Box<Expression>>,
12404 #[serde(default)]
12405 pub durability: 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 Rollback {
12412 #[serde(default)]
12413 pub savepoint: Option<Box<Expression>>,
12414 #[serde(default)]
12415 pub this: 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 AlterSession {
12422 #[serde(default)]
12423 pub expressions: Vec<Expression>,
12424 #[serde(default)]
12425 pub unset: Option<Box<Expression>>,
12426}
12427
12428#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12430#[cfg_attr(feature = "bindings", derive(TS))]
12431pub struct Analyze {
12432 #[serde(default)]
12433 pub kind: Option<String>,
12434 #[serde(default)]
12435 pub this: Option<Box<Expression>>,
12436 #[serde(default)]
12437 pub options: Vec<Expression>,
12438 #[serde(default)]
12439 pub mode: Option<Box<Expression>>,
12440 #[serde(default)]
12441 pub partition: Option<Box<Expression>>,
12442 #[serde(default)]
12443 pub expression: Option<Box<Expression>>,
12444 #[serde(default)]
12445 pub properties: Vec<Expression>,
12446 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12448 pub columns: Vec<String>,
12449}
12450
12451#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12453#[cfg_attr(feature = "bindings", derive(TS))]
12454pub struct AnalyzeStatistics {
12455 pub kind: String,
12456 #[serde(default)]
12457 pub option: Option<Box<Expression>>,
12458 #[serde(default)]
12459 pub this: Option<Box<Expression>>,
12460 #[serde(default)]
12461 pub expressions: Vec<Expression>,
12462}
12463
12464#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12466#[cfg_attr(feature = "bindings", derive(TS))]
12467pub struct AnalyzeHistogram {
12468 pub this: Box<Expression>,
12469 #[serde(default)]
12470 pub expressions: Vec<Expression>,
12471 #[serde(default)]
12472 pub expression: Option<Box<Expression>>,
12473 #[serde(default)]
12474 pub update_options: Option<Box<Expression>>,
12475}
12476
12477#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12479#[cfg_attr(feature = "bindings", derive(TS))]
12480pub struct AnalyzeSample {
12481 pub kind: String,
12482 #[serde(default)]
12483 pub sample: Option<Box<Expression>>,
12484}
12485
12486#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12488#[cfg_attr(feature = "bindings", derive(TS))]
12489pub struct AnalyzeListChainedRows {
12490 #[serde(default)]
12491 pub expression: Option<Box<Expression>>,
12492}
12493
12494#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12496#[cfg_attr(feature = "bindings", derive(TS))]
12497pub struct AnalyzeDelete {
12498 #[serde(default)]
12499 pub kind: Option<String>,
12500}
12501
12502#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12504#[cfg_attr(feature = "bindings", derive(TS))]
12505pub struct AnalyzeWith {
12506 #[serde(default)]
12507 pub expressions: Vec<Expression>,
12508}
12509
12510#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12512#[cfg_attr(feature = "bindings", derive(TS))]
12513pub struct AnalyzeValidate {
12514 pub kind: String,
12515 #[serde(default)]
12516 pub this: Option<Box<Expression>>,
12517 #[serde(default)]
12518 pub expression: Option<Box<Expression>>,
12519}
12520
12521#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12523#[cfg_attr(feature = "bindings", derive(TS))]
12524pub struct AddPartition {
12525 pub this: Box<Expression>,
12526 #[serde(default)]
12527 pub exists: bool,
12528 #[serde(default)]
12529 pub location: Option<Box<Expression>>,
12530}
12531
12532#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12534#[cfg_attr(feature = "bindings", derive(TS))]
12535pub struct AttachOption {
12536 pub this: Box<Expression>,
12537 #[serde(default)]
12538 pub expression: Option<Box<Expression>>,
12539}
12540
12541#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12543#[cfg_attr(feature = "bindings", derive(TS))]
12544pub struct DropPartition {
12545 #[serde(default)]
12546 pub expressions: Vec<Expression>,
12547 #[serde(default)]
12548 pub exists: bool,
12549}
12550
12551#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12553#[cfg_attr(feature = "bindings", derive(TS))]
12554pub struct ReplacePartition {
12555 pub expression: Box<Expression>,
12556 #[serde(default)]
12557 pub source: 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 DPipe {
12564 pub this: Box<Expression>,
12565 pub expression: Box<Expression>,
12566 #[serde(default)]
12567 pub safe: Option<Box<Expression>>,
12568}
12569
12570#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12572#[cfg_attr(feature = "bindings", derive(TS))]
12573pub struct Operator {
12574 pub this: Box<Expression>,
12575 #[serde(default)]
12576 pub operator: Option<Box<Expression>>,
12577 pub expression: Box<Expression>,
12578 #[serde(default, skip_serializing_if = "Vec::is_empty")]
12580 pub comments: Vec<String>,
12581}
12582
12583#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12585#[cfg_attr(feature = "bindings", derive(TS))]
12586pub struct PivotAny {
12587 #[serde(default)]
12588 pub this: Option<Box<Expression>>,
12589}
12590
12591#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12593#[cfg_attr(feature = "bindings", derive(TS))]
12594pub struct Aliases {
12595 pub this: Box<Expression>,
12596 #[serde(default)]
12597 pub expressions: Vec<Expression>,
12598}
12599
12600#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12602#[cfg_attr(feature = "bindings", derive(TS))]
12603pub struct AtIndex {
12604 pub this: Box<Expression>,
12605 pub expression: Box<Expression>,
12606}
12607
12608#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12610#[cfg_attr(feature = "bindings", derive(TS))]
12611pub struct FromTimeZone {
12612 pub this: Box<Expression>,
12613 #[serde(default)]
12614 pub zone: Option<Box<Expression>>,
12615}
12616
12617#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12619#[cfg_attr(feature = "bindings", derive(TS))]
12620pub struct FormatPhrase {
12621 pub this: Box<Expression>,
12622 pub format: String,
12623}
12624
12625#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12627#[cfg_attr(feature = "bindings", derive(TS))]
12628pub struct ForIn {
12629 pub this: Box<Expression>,
12630 pub expression: Box<Expression>,
12631}
12632
12633#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12635#[cfg_attr(feature = "bindings", derive(TS))]
12636pub struct TimeUnit {
12637 #[serde(default)]
12638 pub unit: Option<String>,
12639}
12640
12641#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12643#[cfg_attr(feature = "bindings", derive(TS))]
12644pub struct IntervalOp {
12645 #[serde(default)]
12646 pub unit: Option<String>,
12647 pub expression: 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 HavingMax {
12654 pub this: Box<Expression>,
12655 pub expression: Box<Expression>,
12656 #[serde(default)]
12657 pub max: Option<Box<Expression>>,
12658}
12659
12660#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12662#[cfg_attr(feature = "bindings", derive(TS))]
12663pub struct CosineDistance {
12664 pub this: Box<Expression>,
12665 pub expression: Box<Expression>,
12666}
12667
12668#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12670#[cfg_attr(feature = "bindings", derive(TS))]
12671pub struct DotProduct {
12672 pub this: Box<Expression>,
12673 pub expression: Box<Expression>,
12674}
12675
12676#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12678#[cfg_attr(feature = "bindings", derive(TS))]
12679pub struct EuclideanDistance {
12680 pub this: Box<Expression>,
12681 pub expression: Box<Expression>,
12682}
12683
12684#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12686#[cfg_attr(feature = "bindings", derive(TS))]
12687pub struct ManhattanDistance {
12688 pub this: Box<Expression>,
12689 pub expression: Box<Expression>,
12690}
12691
12692#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12694#[cfg_attr(feature = "bindings", derive(TS))]
12695pub struct JarowinklerSimilarity {
12696 pub this: Box<Expression>,
12697 pub expression: Box<Expression>,
12698}
12699
12700#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12702#[cfg_attr(feature = "bindings", derive(TS))]
12703pub struct Booland {
12704 pub this: Box<Expression>,
12705 pub expression: Box<Expression>,
12706}
12707
12708#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12710#[cfg_attr(feature = "bindings", derive(TS))]
12711pub struct Boolor {
12712 pub this: Box<Expression>,
12713 pub expression: Box<Expression>,
12714}
12715
12716#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12718#[cfg_attr(feature = "bindings", derive(TS))]
12719pub struct ParameterizedAgg {
12720 pub this: Box<Expression>,
12721 #[serde(default)]
12722 pub expressions: Vec<Expression>,
12723 #[serde(default)]
12724 pub params: Vec<Expression>,
12725}
12726
12727#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12729#[cfg_attr(feature = "bindings", derive(TS))]
12730pub struct ArgMax {
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 ArgMin {
12741 pub this: Box<Expression>,
12742 pub expression: Box<Expression>,
12743 #[serde(default)]
12744 pub count: Option<Box<Expression>>,
12745}
12746
12747#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12749#[cfg_attr(feature = "bindings", derive(TS))]
12750pub struct ApproxTopK {
12751 pub this: Box<Expression>,
12752 #[serde(default)]
12753 pub expression: Option<Box<Expression>>,
12754 #[serde(default)]
12755 pub counters: Option<Box<Expression>>,
12756}
12757
12758#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12760#[cfg_attr(feature = "bindings", derive(TS))]
12761pub struct ApproxTopKAccumulate {
12762 pub this: Box<Expression>,
12763 #[serde(default)]
12764 pub expression: Option<Box<Expression>>,
12765}
12766
12767#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12769#[cfg_attr(feature = "bindings", derive(TS))]
12770pub struct ApproxTopKCombine {
12771 pub this: Box<Expression>,
12772 #[serde(default)]
12773 pub expression: Option<Box<Expression>>,
12774}
12775
12776#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12778#[cfg_attr(feature = "bindings", derive(TS))]
12779pub struct ApproxTopKEstimate {
12780 pub this: Box<Expression>,
12781 #[serde(default)]
12782 pub expression: 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 ApproxTopSum {
12789 pub this: Box<Expression>,
12790 pub expression: Box<Expression>,
12791 #[serde(default)]
12792 pub count: Option<Box<Expression>>,
12793}
12794
12795#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12797#[cfg_attr(feature = "bindings", derive(TS))]
12798pub struct ApproxQuantiles {
12799 pub this: Box<Expression>,
12800 #[serde(default)]
12801 pub expression: Option<Box<Expression>>,
12802}
12803
12804#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12806#[cfg_attr(feature = "bindings", derive(TS))]
12807pub struct Minhash {
12808 pub this: Box<Expression>,
12809 #[serde(default)]
12810 pub expressions: Vec<Expression>,
12811}
12812
12813#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12815#[cfg_attr(feature = "bindings", derive(TS))]
12816pub struct FarmFingerprint {
12817 #[serde(default)]
12818 pub expressions: Vec<Expression>,
12819}
12820
12821#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12823#[cfg_attr(feature = "bindings", derive(TS))]
12824pub struct Float64 {
12825 pub this: Box<Expression>,
12826 #[serde(default)]
12827 pub expression: Option<Box<Expression>>,
12828}
12829
12830#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12832#[cfg_attr(feature = "bindings", derive(TS))]
12833pub struct Transform {
12834 pub this: Box<Expression>,
12835 pub expression: Box<Expression>,
12836}
12837
12838#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12840#[cfg_attr(feature = "bindings", derive(TS))]
12841pub struct Translate {
12842 pub this: Box<Expression>,
12843 #[serde(default)]
12844 pub from_: Option<Box<Expression>>,
12845 #[serde(default)]
12846 pub to: Option<Box<Expression>>,
12847}
12848
12849#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12851#[cfg_attr(feature = "bindings", derive(TS))]
12852pub struct Grouping {
12853 #[serde(default)]
12854 pub expressions: Vec<Expression>,
12855}
12856
12857#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12859#[cfg_attr(feature = "bindings", derive(TS))]
12860pub struct GroupingId {
12861 #[serde(default)]
12862 pub expressions: Vec<Expression>,
12863}
12864
12865#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12867#[cfg_attr(feature = "bindings", derive(TS))]
12868pub struct Anonymous {
12869 pub this: Box<Expression>,
12870 #[serde(default)]
12871 pub expressions: Vec<Expression>,
12872}
12873
12874#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12876#[cfg_attr(feature = "bindings", derive(TS))]
12877pub struct AnonymousAggFunc {
12878 pub this: Box<Expression>,
12879 #[serde(default)]
12880 pub expressions: Vec<Expression>,
12881}
12882
12883#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12885#[cfg_attr(feature = "bindings", derive(TS))]
12886pub struct CombinedAggFunc {
12887 pub this: Box<Expression>,
12888 #[serde(default)]
12889 pub expressions: Vec<Expression>,
12890}
12891
12892#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12894#[cfg_attr(feature = "bindings", derive(TS))]
12895pub struct CombinedParameterizedAgg {
12896 pub this: Box<Expression>,
12897 #[serde(default)]
12898 pub expressions: Vec<Expression>,
12899 #[serde(default)]
12900 pub params: Vec<Expression>,
12901}
12902
12903#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12905#[cfg_attr(feature = "bindings", derive(TS))]
12906pub struct HashAgg {
12907 pub this: Box<Expression>,
12908 #[serde(default)]
12909 pub expressions: Vec<Expression>,
12910}
12911
12912#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12914#[cfg_attr(feature = "bindings", derive(TS))]
12915pub struct Hll {
12916 pub this: Box<Expression>,
12917 #[serde(default)]
12918 pub expressions: Vec<Expression>,
12919}
12920
12921#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12923#[cfg_attr(feature = "bindings", derive(TS))]
12924pub struct Apply {
12925 pub this: Box<Expression>,
12926 pub expression: Box<Expression>,
12927}
12928
12929#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12931#[cfg_attr(feature = "bindings", derive(TS))]
12932pub struct ToBoolean {
12933 pub this: Box<Expression>,
12934 #[serde(default)]
12935 pub safe: Option<Box<Expression>>,
12936}
12937
12938#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12940#[cfg_attr(feature = "bindings", derive(TS))]
12941pub struct List {
12942 #[serde(default)]
12943 pub expressions: Vec<Expression>,
12944}
12945
12946#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12951#[cfg_attr(feature = "bindings", derive(TS))]
12952pub struct ToMap {
12953 pub this: Box<Expression>,
12955}
12956
12957#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12959#[cfg_attr(feature = "bindings", derive(TS))]
12960pub struct Pad {
12961 pub this: Box<Expression>,
12962 pub expression: Box<Expression>,
12963 #[serde(default)]
12964 pub fill_pattern: Option<Box<Expression>>,
12965 #[serde(default)]
12966 pub is_left: Option<Box<Expression>>,
12967}
12968
12969#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12971#[cfg_attr(feature = "bindings", derive(TS))]
12972pub struct ToChar {
12973 pub this: Box<Expression>,
12974 #[serde(default)]
12975 pub format: Option<String>,
12976 #[serde(default)]
12977 pub nlsparam: Option<Box<Expression>>,
12978 #[serde(default)]
12979 pub is_numeric: Option<Box<Expression>>,
12980}
12981
12982#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12984#[cfg_attr(feature = "bindings", derive(TS))]
12985pub struct StringFunc {
12986 pub this: Box<Expression>,
12987 #[serde(default)]
12988 pub zone: Option<Box<Expression>>,
12989}
12990
12991#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
12993#[cfg_attr(feature = "bindings", derive(TS))]
12994pub struct ToNumber {
12995 pub this: Box<Expression>,
12996 #[serde(default)]
12997 pub format: Option<Box<Expression>>,
12998 #[serde(default)]
12999 pub nlsparam: Option<Box<Expression>>,
13000 #[serde(default)]
13001 pub precision: Option<Box<Expression>>,
13002 #[serde(default)]
13003 pub scale: Option<Box<Expression>>,
13004 #[serde(default)]
13005 pub safe: Option<Box<Expression>>,
13006 #[serde(default)]
13007 pub safe_name: Option<Box<Expression>>,
13008}
13009
13010#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13012#[cfg_attr(feature = "bindings", derive(TS))]
13013pub struct ToDouble {
13014 pub this: Box<Expression>,
13015 #[serde(default)]
13016 pub format: Option<String>,
13017 #[serde(default)]
13018 pub safe: Option<Box<Expression>>,
13019}
13020
13021#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13023#[cfg_attr(feature = "bindings", derive(TS))]
13024pub struct ToDecfloat {
13025 pub this: Box<Expression>,
13026 #[serde(default)]
13027 pub format: Option<String>,
13028}
13029
13030#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13032#[cfg_attr(feature = "bindings", derive(TS))]
13033pub struct TryToDecfloat {
13034 pub this: Box<Expression>,
13035 #[serde(default)]
13036 pub format: Option<String>,
13037}
13038
13039#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13041#[cfg_attr(feature = "bindings", derive(TS))]
13042pub struct ToFile {
13043 pub this: Box<Expression>,
13044 #[serde(default)]
13045 pub path: Option<Box<Expression>>,
13046 #[serde(default)]
13047 pub safe: Option<Box<Expression>>,
13048}
13049
13050#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13052#[cfg_attr(feature = "bindings", derive(TS))]
13053pub struct Columns {
13054 pub this: Box<Expression>,
13055 #[serde(default)]
13056 pub unpack: Option<Box<Expression>>,
13057}
13058
13059#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13061#[cfg_attr(feature = "bindings", derive(TS))]
13062pub struct ConvertToCharset {
13063 pub this: Box<Expression>,
13064 #[serde(default)]
13065 pub dest: Option<Box<Expression>>,
13066 #[serde(default)]
13067 pub source: Option<Box<Expression>>,
13068}
13069
13070#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13072#[cfg_attr(feature = "bindings", derive(TS))]
13073pub struct ConvertTimezone {
13074 #[serde(default)]
13075 pub source_tz: Option<Box<Expression>>,
13076 #[serde(default)]
13077 pub target_tz: Option<Box<Expression>>,
13078 #[serde(default)]
13079 pub timestamp: Option<Box<Expression>>,
13080 #[serde(default)]
13081 pub options: Vec<Expression>,
13082}
13083
13084#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13086#[cfg_attr(feature = "bindings", derive(TS))]
13087pub struct GenerateSeries {
13088 #[serde(default)]
13089 pub start: Option<Box<Expression>>,
13090 #[serde(default)]
13091 pub end: Option<Box<Expression>>,
13092 #[serde(default)]
13093 pub step: Option<Box<Expression>>,
13094 #[serde(default)]
13095 pub is_end_exclusive: Option<Box<Expression>>,
13096}
13097
13098#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13100#[cfg_attr(feature = "bindings", derive(TS))]
13101pub struct AIAgg {
13102 pub this: Box<Expression>,
13103 pub expression: Box<Expression>,
13104}
13105
13106#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13108#[cfg_attr(feature = "bindings", derive(TS))]
13109pub struct AIClassify {
13110 pub this: Box<Expression>,
13111 #[serde(default)]
13112 pub categories: Option<Box<Expression>>,
13113 #[serde(default)]
13114 pub config: Option<Box<Expression>>,
13115}
13116
13117#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13119#[cfg_attr(feature = "bindings", derive(TS))]
13120pub struct ArrayAll {
13121 pub this: Box<Expression>,
13122 pub expression: Box<Expression>,
13123}
13124
13125#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13127#[cfg_attr(feature = "bindings", derive(TS))]
13128pub struct ArrayAny {
13129 pub this: Box<Expression>,
13130 pub expression: Box<Expression>,
13131}
13132
13133#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13135#[cfg_attr(feature = "bindings", derive(TS))]
13136pub struct ArrayConstructCompact {
13137 #[serde(default)]
13138 pub expressions: Vec<Expression>,
13139}
13140
13141#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13143#[cfg_attr(feature = "bindings", derive(TS))]
13144pub struct StPoint {
13145 pub this: Box<Expression>,
13146 pub expression: Box<Expression>,
13147 #[serde(default)]
13148 pub null: 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 StDistance {
13155 pub this: Box<Expression>,
13156 pub expression: Box<Expression>,
13157 #[serde(default)]
13158 pub use_spheroid: Option<Box<Expression>>,
13159}
13160
13161#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13163#[cfg_attr(feature = "bindings", derive(TS))]
13164pub struct StringToArray {
13165 pub this: Box<Expression>,
13166 #[serde(default)]
13167 pub expression: Option<Box<Expression>>,
13168 #[serde(default)]
13169 pub null: Option<Box<Expression>>,
13170}
13171
13172#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13174#[cfg_attr(feature = "bindings", derive(TS))]
13175pub struct ArraySum {
13176 pub this: Box<Expression>,
13177 #[serde(default)]
13178 pub expression: Option<Box<Expression>>,
13179}
13180
13181#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13183#[cfg_attr(feature = "bindings", derive(TS))]
13184pub struct ObjectAgg {
13185 pub this: Box<Expression>,
13186 pub expression: Box<Expression>,
13187}
13188
13189#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13191#[cfg_attr(feature = "bindings", derive(TS))]
13192pub struct CastToStrType {
13193 pub this: Box<Expression>,
13194 #[serde(default)]
13195 pub to: Option<Box<Expression>>,
13196}
13197
13198#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13200#[cfg_attr(feature = "bindings", derive(TS))]
13201pub struct CheckJson {
13202 pub this: Box<Expression>,
13203}
13204
13205#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13207#[cfg_attr(feature = "bindings", derive(TS))]
13208pub struct CheckXml {
13209 pub this: Box<Expression>,
13210 #[serde(default)]
13211 pub disable_auto_convert: 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 TranslateCharacters {
13218 pub this: Box<Expression>,
13219 pub expression: Box<Expression>,
13220 #[serde(default)]
13221 pub with_error: Option<Box<Expression>>,
13222}
13223
13224#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13226#[cfg_attr(feature = "bindings", derive(TS))]
13227pub struct CurrentSchemas {
13228 #[serde(default)]
13229 pub this: Option<Box<Expression>>,
13230}
13231
13232#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13234#[cfg_attr(feature = "bindings", derive(TS))]
13235pub struct CurrentDatetime {
13236 #[serde(default)]
13237 pub this: Option<Box<Expression>>,
13238}
13239
13240#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13242#[cfg_attr(feature = "bindings", derive(TS))]
13243pub struct Localtime {
13244 #[serde(default)]
13245 pub this: Option<Box<Expression>>,
13246}
13247
13248#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13250#[cfg_attr(feature = "bindings", derive(TS))]
13251pub struct Localtimestamp {
13252 #[serde(default)]
13253 pub this: Option<Box<Expression>>,
13254}
13255
13256#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13258#[cfg_attr(feature = "bindings", derive(TS))]
13259pub struct Systimestamp {
13260 #[serde(default)]
13261 pub this: Option<Box<Expression>>,
13262}
13263
13264#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13266#[cfg_attr(feature = "bindings", derive(TS))]
13267pub struct CurrentSchema {
13268 #[serde(default)]
13269 pub this: Option<Box<Expression>>,
13270}
13271
13272#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13274#[cfg_attr(feature = "bindings", derive(TS))]
13275pub struct CurrentUser {
13276 #[serde(default)]
13277 pub this: Option<Box<Expression>>,
13278}
13279
13280#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13282#[cfg_attr(feature = "bindings", derive(TS))]
13283pub struct SessionUser;
13284
13285#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13287#[cfg_attr(feature = "bindings", derive(TS))]
13288pub struct JSONPathRoot;
13289
13290#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13292#[cfg_attr(feature = "bindings", derive(TS))]
13293pub struct UtcTime {
13294 #[serde(default)]
13295 pub this: Option<Box<Expression>>,
13296}
13297
13298#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13300#[cfg_attr(feature = "bindings", derive(TS))]
13301pub struct UtcTimestamp {
13302 #[serde(default)]
13303 pub this: Option<Box<Expression>>,
13304}
13305
13306#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13308#[cfg_attr(feature = "bindings", derive(TS))]
13309pub struct TimestampFunc {
13310 #[serde(default)]
13311 pub this: Option<Box<Expression>>,
13312 #[serde(default)]
13313 pub zone: Option<Box<Expression>>,
13314 #[serde(default)]
13315 pub with_tz: Option<bool>,
13316 #[serde(default)]
13317 pub safe: Option<bool>,
13318}
13319
13320#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13322#[cfg_attr(feature = "bindings", derive(TS))]
13323pub struct DateBin {
13324 pub this: Box<Expression>,
13325 pub expression: Box<Expression>,
13326 #[serde(default)]
13327 pub unit: Option<String>,
13328 #[serde(default)]
13329 pub zone: Option<Box<Expression>>,
13330 #[serde(default)]
13331 pub origin: Option<Box<Expression>>,
13332}
13333
13334#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13336#[cfg_attr(feature = "bindings", derive(TS))]
13337pub struct Datetime {
13338 pub this: Box<Expression>,
13339 #[serde(default)]
13340 pub expression: Option<Box<Expression>>,
13341}
13342
13343#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13345#[cfg_attr(feature = "bindings", derive(TS))]
13346pub struct DatetimeAdd {
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 DatetimeSub {
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 DatetimeDiff {
13367 pub this: Box<Expression>,
13368 pub expression: Box<Expression>,
13369 #[serde(default)]
13370 pub unit: Option<String>,
13371}
13372
13373#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13375#[cfg_attr(feature = "bindings", derive(TS))]
13376pub struct DatetimeTrunc {
13377 pub this: Box<Expression>,
13378 pub unit: String,
13379 #[serde(default)]
13380 pub zone: Option<Box<Expression>>,
13381}
13382
13383#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13385#[cfg_attr(feature = "bindings", derive(TS))]
13386pub struct Dayname {
13387 pub this: Box<Expression>,
13388 #[serde(default)]
13389 pub abbreviated: Option<Box<Expression>>,
13390}
13391
13392#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13394#[cfg_attr(feature = "bindings", derive(TS))]
13395pub struct MakeInterval {
13396 #[serde(default)]
13397 pub year: Option<Box<Expression>>,
13398 #[serde(default)]
13399 pub month: Option<Box<Expression>>,
13400 #[serde(default)]
13401 pub week: Option<Box<Expression>>,
13402 #[serde(default)]
13403 pub day: Option<Box<Expression>>,
13404 #[serde(default)]
13405 pub hour: Option<Box<Expression>>,
13406 #[serde(default)]
13407 pub minute: Option<Box<Expression>>,
13408 #[serde(default)]
13409 pub second: Option<Box<Expression>>,
13410}
13411
13412#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13414#[cfg_attr(feature = "bindings", derive(TS))]
13415pub struct PreviousDay {
13416 pub this: Box<Expression>,
13417 pub expression: Box<Expression>,
13418}
13419
13420#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13422#[cfg_attr(feature = "bindings", derive(TS))]
13423pub struct Elt {
13424 pub this: Box<Expression>,
13425 #[serde(default)]
13426 pub expressions: Vec<Expression>,
13427}
13428
13429#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13431#[cfg_attr(feature = "bindings", derive(TS))]
13432pub struct TimestampAdd {
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 TimestampSub {
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 TimestampDiff {
13453 pub this: Box<Expression>,
13454 pub expression: Box<Expression>,
13455 #[serde(default)]
13456 pub unit: Option<String>,
13457}
13458
13459#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13461#[cfg_attr(feature = "bindings", derive(TS))]
13462pub struct TimeSlice {
13463 pub this: Box<Expression>,
13464 pub expression: Box<Expression>,
13465 pub unit: String,
13466 #[serde(default)]
13467 pub kind: 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 TimeAdd {
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 TimeSub {
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 TimeDiff {
13494 pub this: Box<Expression>,
13495 pub expression: Box<Expression>,
13496 #[serde(default)]
13497 pub unit: Option<String>,
13498}
13499
13500#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13502#[cfg_attr(feature = "bindings", derive(TS))]
13503pub struct TimeTrunc {
13504 pub this: Box<Expression>,
13505 pub unit: String,
13506 #[serde(default)]
13507 pub zone: Option<Box<Expression>>,
13508}
13509
13510#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13512#[cfg_attr(feature = "bindings", derive(TS))]
13513pub struct DateFromParts {
13514 #[serde(default)]
13515 pub year: Option<Box<Expression>>,
13516 #[serde(default)]
13517 pub month: Option<Box<Expression>>,
13518 #[serde(default)]
13519 pub day: Option<Box<Expression>>,
13520 #[serde(default)]
13521 pub allow_overflow: Option<Box<Expression>>,
13522}
13523
13524#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13526#[cfg_attr(feature = "bindings", derive(TS))]
13527pub struct TimeFromParts {
13528 #[serde(default)]
13529 pub hour: Option<Box<Expression>>,
13530 #[serde(default)]
13531 pub min: Option<Box<Expression>>,
13532 #[serde(default)]
13533 pub sec: Option<Box<Expression>>,
13534 #[serde(default)]
13535 pub nano: Option<Box<Expression>>,
13536 #[serde(default)]
13537 pub fractions: Option<Box<Expression>>,
13538 #[serde(default)]
13539 pub precision: Option<i64>,
13540}
13541
13542#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13544#[cfg_attr(feature = "bindings", derive(TS))]
13545pub struct DecodeCase {
13546 #[serde(default)]
13547 pub expressions: Vec<Expression>,
13548}
13549
13550#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13552#[cfg_attr(feature = "bindings", derive(TS))]
13553pub struct Decrypt {
13554 pub this: Box<Expression>,
13555 #[serde(default)]
13556 pub passphrase: Option<Box<Expression>>,
13557 #[serde(default)]
13558 pub aad: Option<Box<Expression>>,
13559 #[serde(default)]
13560 pub encryption_method: Option<Box<Expression>>,
13561 #[serde(default)]
13562 pub safe: Option<Box<Expression>>,
13563}
13564
13565#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13567#[cfg_attr(feature = "bindings", derive(TS))]
13568pub struct DecryptRaw {
13569 pub this: Box<Expression>,
13570 #[serde(default)]
13571 pub key: Option<Box<Expression>>,
13572 #[serde(default)]
13573 pub iv: Option<Box<Expression>>,
13574 #[serde(default)]
13575 pub aad: Option<Box<Expression>>,
13576 #[serde(default)]
13577 pub encryption_method: Option<Box<Expression>>,
13578 #[serde(default)]
13579 pub aead: Option<Box<Expression>>,
13580 #[serde(default)]
13581 pub safe: Option<Box<Expression>>,
13582}
13583
13584#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13586#[cfg_attr(feature = "bindings", derive(TS))]
13587pub struct Encode {
13588 pub this: Box<Expression>,
13589 #[serde(default)]
13590 pub charset: Option<Box<Expression>>,
13591}
13592
13593#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13595#[cfg_attr(feature = "bindings", derive(TS))]
13596pub struct Encrypt {
13597 pub this: Box<Expression>,
13598 #[serde(default)]
13599 pub passphrase: Option<Box<Expression>>,
13600 #[serde(default)]
13601 pub aad: Option<Box<Expression>>,
13602 #[serde(default)]
13603 pub encryption_method: Option<Box<Expression>>,
13604}
13605
13606#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13608#[cfg_attr(feature = "bindings", derive(TS))]
13609pub struct EncryptRaw {
13610 pub this: Box<Expression>,
13611 #[serde(default)]
13612 pub key: Option<Box<Expression>>,
13613 #[serde(default)]
13614 pub iv: Option<Box<Expression>>,
13615 #[serde(default)]
13616 pub aad: Option<Box<Expression>>,
13617 #[serde(default)]
13618 pub encryption_method: Option<Box<Expression>>,
13619}
13620
13621#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13623#[cfg_attr(feature = "bindings", derive(TS))]
13624pub struct EqualNull {
13625 pub this: Box<Expression>,
13626 pub expression: Box<Expression>,
13627}
13628
13629#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13631#[cfg_attr(feature = "bindings", derive(TS))]
13632pub struct ToBinary {
13633 pub this: Box<Expression>,
13634 #[serde(default)]
13635 pub format: Option<String>,
13636 #[serde(default)]
13637 pub safe: Option<Box<Expression>>,
13638}
13639
13640#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13642#[cfg_attr(feature = "bindings", derive(TS))]
13643pub struct Base64DecodeBinary {
13644 pub this: Box<Expression>,
13645 #[serde(default)]
13646 pub alphabet: Option<Box<Expression>>,
13647}
13648
13649#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13651#[cfg_attr(feature = "bindings", derive(TS))]
13652pub struct Base64DecodeString {
13653 pub this: Box<Expression>,
13654 #[serde(default)]
13655 pub alphabet: Option<Box<Expression>>,
13656}
13657
13658#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13660#[cfg_attr(feature = "bindings", derive(TS))]
13661pub struct Base64Encode {
13662 pub this: Box<Expression>,
13663 #[serde(default)]
13664 pub max_line_length: Option<Box<Expression>>,
13665 #[serde(default)]
13666 pub alphabet: Option<Box<Expression>>,
13667}
13668
13669#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13671#[cfg_attr(feature = "bindings", derive(TS))]
13672pub struct TryBase64DecodeBinary {
13673 pub this: Box<Expression>,
13674 #[serde(default)]
13675 pub alphabet: Option<Box<Expression>>,
13676}
13677
13678#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13680#[cfg_attr(feature = "bindings", derive(TS))]
13681pub struct TryBase64DecodeString {
13682 pub this: Box<Expression>,
13683 #[serde(default)]
13684 pub alphabet: Option<Box<Expression>>,
13685}
13686
13687#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13689#[cfg_attr(feature = "bindings", derive(TS))]
13690pub struct GapFill {
13691 pub this: Box<Expression>,
13692 #[serde(default)]
13693 pub ts_column: Option<Box<Expression>>,
13694 #[serde(default)]
13695 pub bucket_width: Option<Box<Expression>>,
13696 #[serde(default)]
13697 pub partitioning_columns: Option<Box<Expression>>,
13698 #[serde(default)]
13699 pub value_columns: Option<Box<Expression>>,
13700 #[serde(default)]
13701 pub origin: Option<Box<Expression>>,
13702 #[serde(default)]
13703 pub ignore_nulls: Option<Box<Expression>>,
13704}
13705
13706#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13708#[cfg_attr(feature = "bindings", derive(TS))]
13709pub struct GenerateDateArray {
13710 #[serde(default)]
13711 pub start: Option<Box<Expression>>,
13712 #[serde(default)]
13713 pub end: Option<Box<Expression>>,
13714 #[serde(default)]
13715 pub step: Option<Box<Expression>>,
13716}
13717
13718#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13720#[cfg_attr(feature = "bindings", derive(TS))]
13721pub struct GenerateTimestampArray {
13722 #[serde(default)]
13723 pub start: Option<Box<Expression>>,
13724 #[serde(default)]
13725 pub end: Option<Box<Expression>>,
13726 #[serde(default)]
13727 pub step: Option<Box<Expression>>,
13728}
13729
13730#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13732#[cfg_attr(feature = "bindings", derive(TS))]
13733pub struct GetExtract {
13734 pub this: Box<Expression>,
13735 pub expression: 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 Getbit {
13742 pub this: Box<Expression>,
13743 pub expression: Box<Expression>,
13744 #[serde(default)]
13745 pub zero_is_msb: 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 OverflowTruncateBehavior {
13752 #[serde(default)]
13753 pub this: Option<Box<Expression>>,
13754 #[serde(default)]
13755 pub with_count: Option<Box<Expression>>,
13756}
13757
13758#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13760#[cfg_attr(feature = "bindings", derive(TS))]
13761pub struct HexEncode {
13762 pub this: Box<Expression>,
13763 #[serde(default)]
13764 pub case: Option<Box<Expression>>,
13765}
13766
13767#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13769#[cfg_attr(feature = "bindings", derive(TS))]
13770pub struct Compress {
13771 pub this: Box<Expression>,
13772 #[serde(default)]
13773 pub method: Option<String>,
13774}
13775
13776#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13778#[cfg_attr(feature = "bindings", derive(TS))]
13779pub struct DecompressBinary {
13780 pub this: Box<Expression>,
13781 pub method: String,
13782}
13783
13784#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13786#[cfg_attr(feature = "bindings", derive(TS))]
13787pub struct DecompressString {
13788 pub this: Box<Expression>,
13789 pub method: String,
13790}
13791
13792#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13794#[cfg_attr(feature = "bindings", derive(TS))]
13795pub struct Xor {
13796 #[serde(default)]
13797 pub this: Option<Box<Expression>>,
13798 #[serde(default)]
13799 pub expression: Option<Box<Expression>>,
13800 #[serde(default)]
13801 pub expressions: Vec<Expression>,
13802}
13803
13804#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13806#[cfg_attr(feature = "bindings", derive(TS))]
13807pub struct Nullif {
13808 pub this: Box<Expression>,
13809 pub expression: Box<Expression>,
13810}
13811
13812#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13814#[cfg_attr(feature = "bindings", derive(TS))]
13815pub struct JSON {
13816 #[serde(default)]
13817 pub this: Option<Box<Expression>>,
13818 #[serde(default)]
13819 pub with_: Option<Box<Expression>>,
13820 #[serde(default)]
13821 pub unique: bool,
13822}
13823
13824#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13826#[cfg_attr(feature = "bindings", derive(TS))]
13827pub struct JSONPath {
13828 #[serde(default)]
13829 pub expressions: Vec<Expression>,
13830 #[serde(default)]
13831 pub escape: Option<Box<Expression>>,
13832}
13833
13834#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13836#[cfg_attr(feature = "bindings", derive(TS))]
13837pub struct JSONPathFilter {
13838 pub this: Box<Expression>,
13839}
13840
13841#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13843#[cfg_attr(feature = "bindings", derive(TS))]
13844pub struct JSONPathKey {
13845 pub this: Box<Expression>,
13846}
13847
13848#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13850#[cfg_attr(feature = "bindings", derive(TS))]
13851pub struct JSONPathRecursive {
13852 #[serde(default)]
13853 pub this: Option<Box<Expression>>,
13854}
13855
13856#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13858#[cfg_attr(feature = "bindings", derive(TS))]
13859pub struct JSONPathScript {
13860 pub this: Box<Expression>,
13861}
13862
13863#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13865#[cfg_attr(feature = "bindings", derive(TS))]
13866pub struct JSONPathSlice {
13867 #[serde(default)]
13868 pub start: Option<Box<Expression>>,
13869 #[serde(default)]
13870 pub end: Option<Box<Expression>>,
13871 #[serde(default)]
13872 pub step: Option<Box<Expression>>,
13873}
13874
13875#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13877#[cfg_attr(feature = "bindings", derive(TS))]
13878pub struct JSONPathSelector {
13879 pub this: Box<Expression>,
13880}
13881
13882#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13884#[cfg_attr(feature = "bindings", derive(TS))]
13885pub struct JSONPathSubscript {
13886 pub this: Box<Expression>,
13887}
13888
13889#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13891#[cfg_attr(feature = "bindings", derive(TS))]
13892pub struct JSONPathUnion {
13893 #[serde(default)]
13894 pub expressions: Vec<Expression>,
13895}
13896
13897#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13899#[cfg_attr(feature = "bindings", derive(TS))]
13900pub struct Format {
13901 pub this: Box<Expression>,
13902 #[serde(default)]
13903 pub expressions: Vec<Expression>,
13904}
13905
13906#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13908#[cfg_attr(feature = "bindings", derive(TS))]
13909pub struct JSONKeys {
13910 pub this: Box<Expression>,
13911 #[serde(default)]
13912 pub expression: Option<Box<Expression>>,
13913 #[serde(default)]
13914 pub expressions: Vec<Expression>,
13915}
13916
13917#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13919#[cfg_attr(feature = "bindings", derive(TS))]
13920pub struct JSONKeyValue {
13921 pub this: Box<Expression>,
13922 pub expression: Box<Expression>,
13923}
13924
13925#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13927#[cfg_attr(feature = "bindings", derive(TS))]
13928pub struct JSONKeysAtDepth {
13929 pub this: Box<Expression>,
13930 #[serde(default)]
13931 pub expression: Option<Box<Expression>>,
13932 #[serde(default)]
13933 pub mode: Option<Box<Expression>>,
13934}
13935
13936#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13938#[cfg_attr(feature = "bindings", derive(TS))]
13939pub struct JSONObject {
13940 #[serde(default)]
13941 pub expressions: Vec<Expression>,
13942 #[serde(default)]
13943 pub null_handling: Option<Box<Expression>>,
13944 #[serde(default)]
13945 pub unique_keys: Option<Box<Expression>>,
13946 #[serde(default)]
13947 pub return_type: Option<Box<Expression>>,
13948 #[serde(default)]
13949 pub encoding: Option<Box<Expression>>,
13950}
13951
13952#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13954#[cfg_attr(feature = "bindings", derive(TS))]
13955pub struct JSONObjectAgg {
13956 #[serde(default)]
13957 pub expressions: Vec<Expression>,
13958 #[serde(default)]
13959 pub null_handling: Option<Box<Expression>>,
13960 #[serde(default)]
13961 pub unique_keys: Option<Box<Expression>>,
13962 #[serde(default)]
13963 pub return_type: Option<Box<Expression>>,
13964 #[serde(default)]
13965 pub encoding: Option<Box<Expression>>,
13966}
13967
13968#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13970#[cfg_attr(feature = "bindings", derive(TS))]
13971pub struct JSONBObjectAgg {
13972 pub this: Box<Expression>,
13973 pub expression: Box<Expression>,
13974}
13975
13976#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13978#[cfg_attr(feature = "bindings", derive(TS))]
13979pub struct JSONArray {
13980 #[serde(default)]
13981 pub expressions: Vec<Expression>,
13982 #[serde(default)]
13983 pub null_handling: Option<Box<Expression>>,
13984 #[serde(default)]
13985 pub return_type: Option<Box<Expression>>,
13986 #[serde(default)]
13987 pub strict: Option<Box<Expression>>,
13988}
13989
13990#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
13992#[cfg_attr(feature = "bindings", derive(TS))]
13993pub struct JSONArrayAgg {
13994 pub this: Box<Expression>,
13995 #[serde(default)]
13996 pub order: Option<Box<Expression>>,
13997 #[serde(default)]
13998 pub null_handling: Option<Box<Expression>>,
13999 #[serde(default)]
14000 pub return_type: Option<Box<Expression>>,
14001 #[serde(default)]
14002 pub strict: Option<Box<Expression>>,
14003}
14004
14005#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14007#[cfg_attr(feature = "bindings", derive(TS))]
14008pub struct JSONExists {
14009 pub this: Box<Expression>,
14010 #[serde(default)]
14011 pub path: Option<Box<Expression>>,
14012 #[serde(default)]
14013 pub passing: Option<Box<Expression>>,
14014 #[serde(default)]
14015 pub on_condition: Option<Box<Expression>>,
14016 #[serde(default)]
14017 pub from_dcolonqmark: Option<Box<Expression>>,
14018}
14019
14020#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14022#[cfg_attr(feature = "bindings", derive(TS))]
14023pub struct JSONColumnDef {
14024 #[serde(default)]
14025 pub this: Option<Box<Expression>>,
14026 #[serde(default)]
14027 pub kind: Option<String>,
14028 #[serde(default)]
14029 pub format_json: bool,
14030 #[serde(default)]
14031 pub path: Option<Box<Expression>>,
14032 #[serde(default)]
14033 pub nested_schema: Option<Box<Expression>>,
14034 #[serde(default)]
14035 pub ordinality: Option<Box<Expression>>,
14036}
14037
14038#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14040#[cfg_attr(feature = "bindings", derive(TS))]
14041pub struct JSONSchema {
14042 #[serde(default)]
14043 pub expressions: Vec<Expression>,
14044}
14045
14046#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14048#[cfg_attr(feature = "bindings", derive(TS))]
14049pub struct JSONSet {
14050 pub this: Box<Expression>,
14051 #[serde(default)]
14052 pub expressions: Vec<Expression>,
14053}
14054
14055#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14057#[cfg_attr(feature = "bindings", derive(TS))]
14058pub struct JSONStripNulls {
14059 pub this: Box<Expression>,
14060 #[serde(default)]
14061 pub expression: Option<Box<Expression>>,
14062 #[serde(default)]
14063 pub include_arrays: Option<Box<Expression>>,
14064 #[serde(default)]
14065 pub remove_empty: Option<Box<Expression>>,
14066}
14067
14068#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14070#[cfg_attr(feature = "bindings", derive(TS))]
14071pub struct JSONValue {
14072 pub this: Box<Expression>,
14073 #[serde(default)]
14074 pub path: Option<Box<Expression>>,
14075 #[serde(default)]
14076 pub returning: Option<Box<Expression>>,
14077 #[serde(default)]
14078 pub on_condition: Option<Box<Expression>>,
14079}
14080
14081#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14083#[cfg_attr(feature = "bindings", derive(TS))]
14084pub struct JSONValueArray {
14085 pub this: Box<Expression>,
14086 #[serde(default)]
14087 pub expression: Option<Box<Expression>>,
14088}
14089
14090#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14092#[cfg_attr(feature = "bindings", derive(TS))]
14093pub struct JSONRemove {
14094 pub this: Box<Expression>,
14095 #[serde(default)]
14096 pub expressions: Vec<Expression>,
14097}
14098
14099#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14101#[cfg_attr(feature = "bindings", derive(TS))]
14102pub struct JSONTable {
14103 pub this: Box<Expression>,
14104 #[serde(default)]
14105 pub schema: Option<Box<Expression>>,
14106 #[serde(default)]
14107 pub path: Option<Box<Expression>>,
14108 #[serde(default)]
14109 pub error_handling: Option<Box<Expression>>,
14110 #[serde(default)]
14111 pub empty_handling: Option<Box<Expression>>,
14112}
14113
14114#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14116#[cfg_attr(feature = "bindings", derive(TS))]
14117pub struct JSONType {
14118 pub this: Box<Expression>,
14119 #[serde(default)]
14120 pub expression: Option<Box<Expression>>,
14121}
14122
14123#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14125#[cfg_attr(feature = "bindings", derive(TS))]
14126pub struct ObjectInsert {
14127 pub this: Box<Expression>,
14128 #[serde(default)]
14129 pub key: Option<Box<Expression>>,
14130 #[serde(default)]
14131 pub value: Option<Box<Expression>>,
14132 #[serde(default)]
14133 pub update_flag: Option<Box<Expression>>,
14134}
14135
14136#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14138#[cfg_attr(feature = "bindings", derive(TS))]
14139pub struct OpenJSONColumnDef {
14140 pub this: Box<Expression>,
14141 pub kind: String,
14142 #[serde(default)]
14143 pub path: Option<Box<Expression>>,
14144 #[serde(default)]
14145 pub as_json: Option<Box<Expression>>,
14146 #[serde(default, skip_serializing_if = "Option::is_none")]
14148 pub data_type: Option<DataType>,
14149}
14150
14151#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14153#[cfg_attr(feature = "bindings", derive(TS))]
14154pub struct OpenJSON {
14155 pub this: Box<Expression>,
14156 #[serde(default)]
14157 pub path: Option<Box<Expression>>,
14158 #[serde(default)]
14159 pub expressions: Vec<Expression>,
14160}
14161
14162#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14164#[cfg_attr(feature = "bindings", derive(TS))]
14165pub struct JSONBExists {
14166 pub this: Box<Expression>,
14167 #[serde(default)]
14168 pub path: Option<Box<Expression>>,
14169}
14170
14171#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14173#[cfg_attr(feature = "bindings", derive(TS))]
14174pub struct JSONCast {
14175 pub this: Box<Expression>,
14176 pub to: DataType,
14177}
14178
14179#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14181#[cfg_attr(feature = "bindings", derive(TS))]
14182pub struct JSONExtract {
14183 pub this: Box<Expression>,
14184 pub expression: Box<Expression>,
14185 #[serde(default)]
14186 pub only_json_types: Option<Box<Expression>>,
14187 #[serde(default)]
14188 pub expressions: Vec<Expression>,
14189 #[serde(default)]
14190 pub variant_extract: Option<Box<Expression>>,
14191 #[serde(default)]
14192 pub json_query: Option<Box<Expression>>,
14193 #[serde(default)]
14194 pub option: Option<Box<Expression>>,
14195 #[serde(default)]
14196 pub quote: Option<Box<Expression>>,
14197 #[serde(default)]
14198 pub on_condition: Option<Box<Expression>>,
14199 #[serde(default)]
14200 pub requires_json: 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 JSONExtractQuote {
14207 #[serde(default)]
14208 pub option: Option<Box<Expression>>,
14209 #[serde(default)]
14210 pub scalar: Option<Box<Expression>>,
14211}
14212
14213#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14215#[cfg_attr(feature = "bindings", derive(TS))]
14216pub struct JSONExtractArray {
14217 pub this: Box<Expression>,
14218 #[serde(default)]
14219 pub expression: Option<Box<Expression>>,
14220}
14221
14222#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14224#[cfg_attr(feature = "bindings", derive(TS))]
14225pub struct JSONExtractScalar {
14226 pub this: Box<Expression>,
14227 pub expression: Box<Expression>,
14228 #[serde(default)]
14229 pub only_json_types: Option<Box<Expression>>,
14230 #[serde(default)]
14231 pub expressions: Vec<Expression>,
14232 #[serde(default)]
14233 pub json_type: Option<Box<Expression>>,
14234 #[serde(default)]
14235 pub scalar_only: 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 JSONBExtractScalar {
14242 pub this: Box<Expression>,
14243 pub expression: Box<Expression>,
14244 #[serde(default)]
14245 pub json_type: Option<Box<Expression>>,
14246}
14247
14248#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14250#[cfg_attr(feature = "bindings", derive(TS))]
14251pub struct JSONFormat {
14252 #[serde(default)]
14253 pub this: Option<Box<Expression>>,
14254 #[serde(default)]
14255 pub options: Vec<Expression>,
14256 #[serde(default)]
14257 pub is_json: Option<Box<Expression>>,
14258 #[serde(default)]
14259 pub to_json: Option<Box<Expression>>,
14260}
14261
14262#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14264#[cfg_attr(feature = "bindings", derive(TS))]
14265pub struct JSONArrayAppend {
14266 pub this: Box<Expression>,
14267 #[serde(default)]
14268 pub expressions: Vec<Expression>,
14269}
14270
14271#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14273#[cfg_attr(feature = "bindings", derive(TS))]
14274pub struct JSONArrayContains {
14275 pub this: Box<Expression>,
14276 pub expression: Box<Expression>,
14277 #[serde(default)]
14278 pub json_type: Option<Box<Expression>>,
14279}
14280
14281#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14283#[cfg_attr(feature = "bindings", derive(TS))]
14284pub struct JSONArrayInsert {
14285 pub this: Box<Expression>,
14286 #[serde(default)]
14287 pub expressions: Vec<Expression>,
14288}
14289
14290#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14292#[cfg_attr(feature = "bindings", derive(TS))]
14293pub struct ParseJSON {
14294 pub this: Box<Expression>,
14295 #[serde(default)]
14296 pub expression: Option<Box<Expression>>,
14297 #[serde(default)]
14298 pub safe: Option<Box<Expression>>,
14299}
14300
14301#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14303#[cfg_attr(feature = "bindings", derive(TS))]
14304pub struct ParseUrl {
14305 pub this: Box<Expression>,
14306 #[serde(default)]
14307 pub part_to_extract: Option<Box<Expression>>,
14308 #[serde(default)]
14309 pub key: Option<Box<Expression>>,
14310 #[serde(default)]
14311 pub permissive: Option<Box<Expression>>,
14312}
14313
14314#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14316#[cfg_attr(feature = "bindings", derive(TS))]
14317pub struct ParseIp {
14318 pub this: Box<Expression>,
14319 #[serde(default)]
14320 pub type_: Option<Box<Expression>>,
14321 #[serde(default)]
14322 pub permissive: Option<Box<Expression>>,
14323}
14324
14325#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14327#[cfg_attr(feature = "bindings", derive(TS))]
14328pub struct ParseTime {
14329 pub this: Box<Expression>,
14330 pub format: String,
14331}
14332
14333#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14335#[cfg_attr(feature = "bindings", derive(TS))]
14336pub struct ParseDatetime {
14337 pub this: Box<Expression>,
14338 #[serde(default)]
14339 pub format: Option<String>,
14340 #[serde(default)]
14341 pub zone: Option<Box<Expression>>,
14342}
14343
14344#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14346#[cfg_attr(feature = "bindings", derive(TS))]
14347pub struct Map {
14348 #[serde(default)]
14349 pub keys: Vec<Expression>,
14350 #[serde(default)]
14351 pub values: Vec<Expression>,
14352}
14353
14354#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14356#[cfg_attr(feature = "bindings", derive(TS))]
14357pub struct MapCat {
14358 pub this: Box<Expression>,
14359 pub expression: Box<Expression>,
14360}
14361
14362#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14364#[cfg_attr(feature = "bindings", derive(TS))]
14365pub struct MapDelete {
14366 pub this: Box<Expression>,
14367 #[serde(default)]
14368 pub expressions: Vec<Expression>,
14369}
14370
14371#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14373#[cfg_attr(feature = "bindings", derive(TS))]
14374pub struct MapInsert {
14375 pub this: Box<Expression>,
14376 #[serde(default)]
14377 pub key: Option<Box<Expression>>,
14378 #[serde(default)]
14379 pub value: Option<Box<Expression>>,
14380 #[serde(default)]
14381 pub update_flag: Option<Box<Expression>>,
14382}
14383
14384#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14386#[cfg_attr(feature = "bindings", derive(TS))]
14387pub struct MapPick {
14388 pub this: Box<Expression>,
14389 #[serde(default)]
14390 pub expressions: Vec<Expression>,
14391}
14392
14393#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14395#[cfg_attr(feature = "bindings", derive(TS))]
14396pub struct ScopeResolution {
14397 #[serde(default)]
14398 pub this: Option<Box<Expression>>,
14399 pub expression: Box<Expression>,
14400}
14401
14402#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14404#[cfg_attr(feature = "bindings", derive(TS))]
14405pub struct Slice {
14406 #[serde(default)]
14407 pub this: Option<Box<Expression>>,
14408 #[serde(default)]
14409 pub expression: Option<Box<Expression>>,
14410 #[serde(default)]
14411 pub step: Option<Box<Expression>>,
14412}
14413
14414#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14416#[cfg_attr(feature = "bindings", derive(TS))]
14417pub struct VarMap {
14418 #[serde(default)]
14419 pub keys: Vec<Expression>,
14420 #[serde(default)]
14421 pub values: Vec<Expression>,
14422}
14423
14424#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14426#[cfg_attr(feature = "bindings", derive(TS))]
14427pub struct MatchAgainst {
14428 pub this: Box<Expression>,
14429 #[serde(default)]
14430 pub expressions: Vec<Expression>,
14431 #[serde(default)]
14432 pub modifier: Option<Box<Expression>>,
14433}
14434
14435#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14437#[cfg_attr(feature = "bindings", derive(TS))]
14438pub struct MD5Digest {
14439 pub this: Box<Expression>,
14440 #[serde(default)]
14441 pub expressions: Vec<Expression>,
14442}
14443
14444#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14446#[cfg_attr(feature = "bindings", derive(TS))]
14447pub struct Monthname {
14448 pub this: Box<Expression>,
14449 #[serde(default)]
14450 pub abbreviated: Option<Box<Expression>>,
14451}
14452
14453#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14455#[cfg_attr(feature = "bindings", derive(TS))]
14456pub struct Ntile {
14457 #[serde(default)]
14458 pub this: Option<Box<Expression>>,
14459}
14460
14461#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14463#[cfg_attr(feature = "bindings", derive(TS))]
14464pub struct Normalize {
14465 pub this: Box<Expression>,
14466 #[serde(default)]
14467 pub form: Option<Box<Expression>>,
14468 #[serde(default)]
14469 pub is_casefold: Option<Box<Expression>>,
14470}
14471
14472#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14474#[cfg_attr(feature = "bindings", derive(TS))]
14475pub struct Normal {
14476 pub this: Box<Expression>,
14477 #[serde(default)]
14478 pub stddev: Option<Box<Expression>>,
14479 #[serde(default)]
14480 pub gen: 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 Predict {
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 MLTranslate {
14497 pub this: Box<Expression>,
14498 pub expression: Box<Expression>,
14499 #[serde(default)]
14500 pub params_struct: Option<Box<Expression>>,
14501}
14502
14503#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14505#[cfg_attr(feature = "bindings", derive(TS))]
14506pub struct FeaturesAtTime {
14507 pub this: Box<Expression>,
14508 #[serde(default)]
14509 pub time: Option<Box<Expression>>,
14510 #[serde(default)]
14511 pub num_rows: Option<Box<Expression>>,
14512 #[serde(default)]
14513 pub ignore_feature_nulls: Option<Box<Expression>>,
14514}
14515
14516#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14518#[cfg_attr(feature = "bindings", derive(TS))]
14519pub struct GenerateEmbedding {
14520 pub this: Box<Expression>,
14521 pub expression: Box<Expression>,
14522 #[serde(default)]
14523 pub params_struct: Option<Box<Expression>>,
14524 #[serde(default)]
14525 pub is_text: Option<Box<Expression>>,
14526}
14527
14528#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14530#[cfg_attr(feature = "bindings", derive(TS))]
14531pub struct MLForecast {
14532 pub this: Box<Expression>,
14533 #[serde(default)]
14534 pub expression: Option<Box<Expression>>,
14535 #[serde(default)]
14536 pub params_struct: Option<Box<Expression>>,
14537}
14538
14539#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14541#[cfg_attr(feature = "bindings", derive(TS))]
14542pub struct ModelAttribute {
14543 pub this: Box<Expression>,
14544 pub expression: Box<Expression>,
14545}
14546
14547#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14549#[cfg_attr(feature = "bindings", derive(TS))]
14550pub struct VectorSearch {
14551 pub this: Box<Expression>,
14552 #[serde(default)]
14553 pub column_to_search: Option<Box<Expression>>,
14554 #[serde(default)]
14555 pub query_table: Option<Box<Expression>>,
14556 #[serde(default)]
14557 pub query_column_to_search: Option<Box<Expression>>,
14558 #[serde(default)]
14559 pub top_k: Option<Box<Expression>>,
14560 #[serde(default)]
14561 pub distance_type: Option<Box<Expression>>,
14562 #[serde(default)]
14563 pub options: Vec<Expression>,
14564}
14565
14566#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14568#[cfg_attr(feature = "bindings", derive(TS))]
14569pub struct Quantile {
14570 pub this: Box<Expression>,
14571 #[serde(default)]
14572 pub quantile: Option<Box<Expression>>,
14573}
14574
14575#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14577#[cfg_attr(feature = "bindings", derive(TS))]
14578pub struct ApproxQuantile {
14579 pub this: Box<Expression>,
14580 #[serde(default)]
14581 pub quantile: Option<Box<Expression>>,
14582 #[serde(default)]
14583 pub accuracy: Option<Box<Expression>>,
14584 #[serde(default)]
14585 pub weight: Option<Box<Expression>>,
14586 #[serde(default)]
14587 pub error_tolerance: Option<Box<Expression>>,
14588}
14589
14590#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14592#[cfg_attr(feature = "bindings", derive(TS))]
14593pub struct ApproxPercentileEstimate {
14594 pub this: Box<Expression>,
14595 #[serde(default)]
14596 pub percentile: Option<Box<Expression>>,
14597}
14598
14599#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14601#[cfg_attr(feature = "bindings", derive(TS))]
14602pub struct Randn {
14603 #[serde(default)]
14604 pub this: Option<Box<Expression>>,
14605}
14606
14607#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14609#[cfg_attr(feature = "bindings", derive(TS))]
14610pub struct Randstr {
14611 pub this: Box<Expression>,
14612 #[serde(default)]
14613 pub generator: Option<Box<Expression>>,
14614}
14615
14616#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14618#[cfg_attr(feature = "bindings", derive(TS))]
14619pub struct RangeN {
14620 pub this: Box<Expression>,
14621 #[serde(default)]
14622 pub expressions: Vec<Expression>,
14623 #[serde(default)]
14624 pub each: Option<Box<Expression>>,
14625}
14626
14627#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14629#[cfg_attr(feature = "bindings", derive(TS))]
14630pub struct RangeBucket {
14631 pub this: Box<Expression>,
14632 pub expression: Box<Expression>,
14633}
14634
14635#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14637#[cfg_attr(feature = "bindings", derive(TS))]
14638pub struct ReadCSV {
14639 pub this: Box<Expression>,
14640 #[serde(default)]
14641 pub expressions: Vec<Expression>,
14642}
14643
14644#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14646#[cfg_attr(feature = "bindings", derive(TS))]
14647pub struct ReadParquet {
14648 #[serde(default)]
14649 pub expressions: Vec<Expression>,
14650}
14651
14652#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14654#[cfg_attr(feature = "bindings", derive(TS))]
14655pub struct Reduce {
14656 pub this: Box<Expression>,
14657 #[serde(default)]
14658 pub initial: Option<Box<Expression>>,
14659 #[serde(default)]
14660 pub merge: Option<Box<Expression>>,
14661 #[serde(default)]
14662 pub finish: Option<Box<Expression>>,
14663}
14664
14665#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14667#[cfg_attr(feature = "bindings", derive(TS))]
14668pub struct RegexpExtractAll {
14669 pub this: Box<Expression>,
14670 pub expression: Box<Expression>,
14671 #[serde(default)]
14672 pub group: Option<Box<Expression>>,
14673 #[serde(default)]
14674 pub parameters: Option<Box<Expression>>,
14675 #[serde(default)]
14676 pub position: Option<Box<Expression>>,
14677 #[serde(default)]
14678 pub occurrence: 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 RegexpILike {
14685 pub this: Box<Expression>,
14686 pub expression: Box<Expression>,
14687 #[serde(default)]
14688 pub flag: Option<Box<Expression>>,
14689}
14690
14691#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14693#[cfg_attr(feature = "bindings", derive(TS))]
14694pub struct RegexpFullMatch {
14695 pub this: Box<Expression>,
14696 pub expression: Box<Expression>,
14697 #[serde(default)]
14698 pub options: Vec<Expression>,
14699}
14700
14701#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14703#[cfg_attr(feature = "bindings", derive(TS))]
14704pub struct RegexpInstr {
14705 pub this: Box<Expression>,
14706 pub expression: Box<Expression>,
14707 #[serde(default)]
14708 pub position: Option<Box<Expression>>,
14709 #[serde(default)]
14710 pub occurrence: Option<Box<Expression>>,
14711 #[serde(default)]
14712 pub option: Option<Box<Expression>>,
14713 #[serde(default)]
14714 pub parameters: Option<Box<Expression>>,
14715 #[serde(default)]
14716 pub group: 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 RegexpSplit {
14723 pub this: Box<Expression>,
14724 pub expression: Box<Expression>,
14725 #[serde(default)]
14726 pub limit: Option<Box<Expression>>,
14727}
14728
14729#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14731#[cfg_attr(feature = "bindings", derive(TS))]
14732pub struct RegexpCount {
14733 pub this: Box<Expression>,
14734 pub expression: Box<Expression>,
14735 #[serde(default)]
14736 pub position: Option<Box<Expression>>,
14737 #[serde(default)]
14738 pub parameters: Option<Box<Expression>>,
14739}
14740
14741#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14743#[cfg_attr(feature = "bindings", derive(TS))]
14744pub struct RegrValx {
14745 pub this: Box<Expression>,
14746 pub expression: Box<Expression>,
14747}
14748
14749#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14751#[cfg_attr(feature = "bindings", derive(TS))]
14752pub struct RegrValy {
14753 pub this: Box<Expression>,
14754 pub expression: Box<Expression>,
14755}
14756
14757#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14759#[cfg_attr(feature = "bindings", derive(TS))]
14760pub struct RegrAvgy {
14761 pub this: Box<Expression>,
14762 pub expression: Box<Expression>,
14763}
14764
14765#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14767#[cfg_attr(feature = "bindings", derive(TS))]
14768pub struct RegrAvgx {
14769 pub this: Box<Expression>,
14770 pub expression: Box<Expression>,
14771}
14772
14773#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14775#[cfg_attr(feature = "bindings", derive(TS))]
14776pub struct RegrCount {
14777 pub this: Box<Expression>,
14778 pub expression: Box<Expression>,
14779}
14780
14781#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14783#[cfg_attr(feature = "bindings", derive(TS))]
14784pub struct RegrIntercept {
14785 pub this: Box<Expression>,
14786 pub expression: Box<Expression>,
14787}
14788
14789#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14791#[cfg_attr(feature = "bindings", derive(TS))]
14792pub struct RegrR2 {
14793 pub this: Box<Expression>,
14794 pub expression: Box<Expression>,
14795}
14796
14797#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14799#[cfg_attr(feature = "bindings", derive(TS))]
14800pub struct RegrSxx {
14801 pub this: Box<Expression>,
14802 pub expression: Box<Expression>,
14803}
14804
14805#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14807#[cfg_attr(feature = "bindings", derive(TS))]
14808pub struct RegrSxy {
14809 pub this: Box<Expression>,
14810 pub expression: Box<Expression>,
14811}
14812
14813#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14815#[cfg_attr(feature = "bindings", derive(TS))]
14816pub struct RegrSyy {
14817 pub this: Box<Expression>,
14818 pub expression: Box<Expression>,
14819}
14820
14821#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14823#[cfg_attr(feature = "bindings", derive(TS))]
14824pub struct RegrSlope {
14825 pub this: Box<Expression>,
14826 pub expression: Box<Expression>,
14827}
14828
14829#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14831#[cfg_attr(feature = "bindings", derive(TS))]
14832pub struct SafeAdd {
14833 pub this: Box<Expression>,
14834 pub expression: Box<Expression>,
14835}
14836
14837#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14839#[cfg_attr(feature = "bindings", derive(TS))]
14840pub struct SafeDivide {
14841 pub this: Box<Expression>,
14842 pub expression: Box<Expression>,
14843}
14844
14845#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14847#[cfg_attr(feature = "bindings", derive(TS))]
14848pub struct SafeMultiply {
14849 pub this: Box<Expression>,
14850 pub expression: Box<Expression>,
14851}
14852
14853#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14855#[cfg_attr(feature = "bindings", derive(TS))]
14856pub struct SafeSubtract {
14857 pub this: Box<Expression>,
14858 pub expression: Box<Expression>,
14859}
14860
14861#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14863#[cfg_attr(feature = "bindings", derive(TS))]
14864pub struct SHA2 {
14865 pub this: Box<Expression>,
14866 #[serde(default)]
14867 pub length: Option<i64>,
14868}
14869
14870#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14872#[cfg_attr(feature = "bindings", derive(TS))]
14873pub struct SHA2Digest {
14874 pub this: Box<Expression>,
14875 #[serde(default)]
14876 pub length: Option<i64>,
14877}
14878
14879#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14881#[cfg_attr(feature = "bindings", derive(TS))]
14882pub struct SortArray {
14883 pub this: Box<Expression>,
14884 #[serde(default)]
14885 pub asc: Option<Box<Expression>>,
14886 #[serde(default)]
14887 pub nulls_first: Option<Box<Expression>>,
14888}
14889
14890#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14892#[cfg_attr(feature = "bindings", derive(TS))]
14893pub struct SplitPart {
14894 pub this: Box<Expression>,
14895 #[serde(default)]
14896 pub delimiter: Option<Box<Expression>>,
14897 #[serde(default)]
14898 pub part_index: Option<Box<Expression>>,
14899}
14900
14901#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14903#[cfg_attr(feature = "bindings", derive(TS))]
14904pub struct SubstringIndex {
14905 pub this: Box<Expression>,
14906 #[serde(default)]
14907 pub delimiter: Option<Box<Expression>>,
14908 #[serde(default)]
14909 pub count: Option<Box<Expression>>,
14910}
14911
14912#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14914#[cfg_attr(feature = "bindings", derive(TS))]
14915pub struct StandardHash {
14916 pub this: Box<Expression>,
14917 #[serde(default)]
14918 pub expression: Option<Box<Expression>>,
14919}
14920
14921#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14923#[cfg_attr(feature = "bindings", derive(TS))]
14924pub struct StrPosition {
14925 pub this: Box<Expression>,
14926 #[serde(default)]
14927 pub substr: Option<Box<Expression>>,
14928 #[serde(default)]
14929 pub position: Option<Box<Expression>>,
14930 #[serde(default)]
14931 pub occurrence: Option<Box<Expression>>,
14932}
14933
14934#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14936#[cfg_attr(feature = "bindings", derive(TS))]
14937pub struct Search {
14938 pub this: Box<Expression>,
14939 pub expression: Box<Expression>,
14940 #[serde(default)]
14941 pub json_scope: Option<Box<Expression>>,
14942 #[serde(default)]
14943 pub analyzer: Option<Box<Expression>>,
14944 #[serde(default)]
14945 pub analyzer_options: Option<Box<Expression>>,
14946 #[serde(default)]
14947 pub search_mode: Option<Box<Expression>>,
14948}
14949
14950#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14952#[cfg_attr(feature = "bindings", derive(TS))]
14953pub struct SearchIp {
14954 pub this: Box<Expression>,
14955 pub expression: Box<Expression>,
14956}
14957
14958#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14960#[cfg_attr(feature = "bindings", derive(TS))]
14961pub struct StrToDate {
14962 pub this: Box<Expression>,
14963 #[serde(default)]
14964 pub format: Option<String>,
14965 #[serde(default)]
14966 pub safe: Option<Box<Expression>>,
14967}
14968
14969#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14971#[cfg_attr(feature = "bindings", derive(TS))]
14972pub struct StrToTime {
14973 pub this: Box<Expression>,
14974 pub format: String,
14975 #[serde(default)]
14976 pub zone: Option<Box<Expression>>,
14977 #[serde(default)]
14978 pub safe: Option<Box<Expression>>,
14979 #[serde(default)]
14980 pub target_type: Option<Box<Expression>>,
14981}
14982
14983#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14985#[cfg_attr(feature = "bindings", derive(TS))]
14986pub struct StrToUnix {
14987 #[serde(default)]
14988 pub this: Option<Box<Expression>>,
14989 #[serde(default)]
14990 pub format: Option<String>,
14991}
14992
14993#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
14995#[cfg_attr(feature = "bindings", derive(TS))]
14996pub struct StrToMap {
14997 pub this: Box<Expression>,
14998 #[serde(default)]
14999 pub pair_delim: Option<Box<Expression>>,
15000 #[serde(default)]
15001 pub key_value_delim: Option<Box<Expression>>,
15002 #[serde(default)]
15003 pub duplicate_resolution_callback: 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 NumberToStr {
15010 pub this: Box<Expression>,
15011 pub format: String,
15012 #[serde(default)]
15013 pub culture: Option<Box<Expression>>,
15014}
15015
15016#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15018#[cfg_attr(feature = "bindings", derive(TS))]
15019pub struct FromBase {
15020 pub this: Box<Expression>,
15021 pub expression: Box<Expression>,
15022}
15023
15024#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15026#[cfg_attr(feature = "bindings", derive(TS))]
15027pub struct Stuff {
15028 pub this: Box<Expression>,
15029 #[serde(default)]
15030 pub start: Option<Box<Expression>>,
15031 #[serde(default)]
15032 pub length: Option<i64>,
15033 pub expression: Box<Expression>,
15034}
15035
15036#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15038#[cfg_attr(feature = "bindings", derive(TS))]
15039pub struct TimeToStr {
15040 pub this: Box<Expression>,
15041 pub format: String,
15042 #[serde(default)]
15043 pub culture: Option<Box<Expression>>,
15044 #[serde(default)]
15045 pub zone: Option<Box<Expression>>,
15046}
15047
15048#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15050#[cfg_attr(feature = "bindings", derive(TS))]
15051pub struct TimeStrToTime {
15052 pub this: Box<Expression>,
15053 #[serde(default)]
15054 pub zone: Option<Box<Expression>>,
15055}
15056
15057#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15059#[cfg_attr(feature = "bindings", derive(TS))]
15060pub struct TsOrDsAdd {
15061 pub this: Box<Expression>,
15062 pub expression: Box<Expression>,
15063 #[serde(default)]
15064 pub unit: Option<String>,
15065 #[serde(default)]
15066 pub return_type: Option<Box<Expression>>,
15067}
15068
15069#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15071#[cfg_attr(feature = "bindings", derive(TS))]
15072pub struct TsOrDsDiff {
15073 pub this: Box<Expression>,
15074 pub expression: Box<Expression>,
15075 #[serde(default)]
15076 pub unit: Option<String>,
15077}
15078
15079#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15081#[cfg_attr(feature = "bindings", derive(TS))]
15082pub struct TsOrDsToDate {
15083 pub this: Box<Expression>,
15084 #[serde(default)]
15085 pub format: Option<String>,
15086 #[serde(default)]
15087 pub safe: Option<Box<Expression>>,
15088}
15089
15090#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15092#[cfg_attr(feature = "bindings", derive(TS))]
15093pub struct TsOrDsToTime {
15094 pub this: Box<Expression>,
15095 #[serde(default)]
15096 pub format: Option<String>,
15097 #[serde(default)]
15098 pub safe: Option<Box<Expression>>,
15099}
15100
15101#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15103#[cfg_attr(feature = "bindings", derive(TS))]
15104pub struct Unhex {
15105 pub this: Box<Expression>,
15106 #[serde(default)]
15107 pub expression: Option<Box<Expression>>,
15108}
15109
15110#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15112#[cfg_attr(feature = "bindings", derive(TS))]
15113pub struct Uniform {
15114 pub this: Box<Expression>,
15115 pub expression: Box<Expression>,
15116 #[serde(default)]
15117 pub gen: Option<Box<Expression>>,
15118 #[serde(default)]
15119 pub seed: Option<Box<Expression>>,
15120}
15121
15122#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15124#[cfg_attr(feature = "bindings", derive(TS))]
15125pub struct UnixToStr {
15126 pub this: Box<Expression>,
15127 #[serde(default)]
15128 pub format: Option<String>,
15129}
15130
15131#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15133#[cfg_attr(feature = "bindings", derive(TS))]
15134pub struct UnixToTime {
15135 pub this: Box<Expression>,
15136 #[serde(default)]
15137 pub scale: Option<i64>,
15138 #[serde(default)]
15139 pub zone: Option<Box<Expression>>,
15140 #[serde(default)]
15141 pub hours: Option<Box<Expression>>,
15142 #[serde(default)]
15143 pub minutes: Option<Box<Expression>>,
15144 #[serde(default)]
15145 pub format: Option<String>,
15146 #[serde(default)]
15147 pub target_type: Option<Box<Expression>>,
15148}
15149
15150#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15152#[cfg_attr(feature = "bindings", derive(TS))]
15153pub struct Uuid {
15154 #[serde(default)]
15155 pub this: Option<Box<Expression>>,
15156 #[serde(default)]
15157 pub name: Option<String>,
15158 #[serde(default)]
15159 pub is_string: Option<Box<Expression>>,
15160}
15161
15162#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15164#[cfg_attr(feature = "bindings", derive(TS))]
15165pub struct TimestampFromParts {
15166 #[serde(default)]
15167 pub zone: Option<Box<Expression>>,
15168 #[serde(default)]
15169 pub milli: Option<Box<Expression>>,
15170 #[serde(default)]
15171 pub this: Option<Box<Expression>>,
15172 #[serde(default)]
15173 pub expression: Option<Box<Expression>>,
15174}
15175
15176#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15178#[cfg_attr(feature = "bindings", derive(TS))]
15179pub struct TimestampTzFromParts {
15180 #[serde(default)]
15181 pub zone: 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 Corr {
15188 pub this: Box<Expression>,
15189 pub expression: Box<Expression>,
15190 #[serde(default)]
15191 pub null_on_zero_variance: Option<Box<Expression>>,
15192}
15193
15194#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15196#[cfg_attr(feature = "bindings", derive(TS))]
15197pub struct WidthBucket {
15198 pub this: Box<Expression>,
15199 #[serde(default)]
15200 pub min_value: Option<Box<Expression>>,
15201 #[serde(default)]
15202 pub max_value: Option<Box<Expression>>,
15203 #[serde(default)]
15204 pub num_buckets: Option<Box<Expression>>,
15205 #[serde(default)]
15206 pub threshold: Option<Box<Expression>>,
15207}
15208
15209#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15211#[cfg_attr(feature = "bindings", derive(TS))]
15212pub struct CovarSamp {
15213 pub this: Box<Expression>,
15214 pub expression: Box<Expression>,
15215}
15216
15217#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15219#[cfg_attr(feature = "bindings", derive(TS))]
15220pub struct CovarPop {
15221 pub this: Box<Expression>,
15222 pub expression: Box<Expression>,
15223}
15224
15225#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15227#[cfg_attr(feature = "bindings", derive(TS))]
15228pub struct Week {
15229 pub this: Box<Expression>,
15230 #[serde(default)]
15231 pub mode: Option<Box<Expression>>,
15232}
15233
15234#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15236#[cfg_attr(feature = "bindings", derive(TS))]
15237pub struct XMLElement {
15238 pub this: Box<Expression>,
15239 #[serde(default)]
15240 pub expressions: Vec<Expression>,
15241 #[serde(default)]
15242 pub evalname: 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 XMLGet {
15249 pub this: Box<Expression>,
15250 pub expression: Box<Expression>,
15251 #[serde(default)]
15252 pub instance: Option<Box<Expression>>,
15253}
15254
15255#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15257#[cfg_attr(feature = "bindings", derive(TS))]
15258pub struct XMLTable {
15259 pub this: Box<Expression>,
15260 #[serde(default)]
15261 pub namespaces: Option<Box<Expression>>,
15262 #[serde(default)]
15263 pub passing: Option<Box<Expression>>,
15264 #[serde(default)]
15265 pub columns: Vec<Expression>,
15266 #[serde(default)]
15267 pub by_ref: Option<Box<Expression>>,
15268}
15269
15270#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15272#[cfg_attr(feature = "bindings", derive(TS))]
15273pub struct XMLKeyValueOption {
15274 pub this: Box<Expression>,
15275 #[serde(default)]
15276 pub expression: Option<Box<Expression>>,
15277}
15278
15279#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15281#[cfg_attr(feature = "bindings", derive(TS))]
15282pub struct Zipf {
15283 pub this: Box<Expression>,
15284 #[serde(default)]
15285 pub elementcount: Option<Box<Expression>>,
15286 #[serde(default)]
15287 pub gen: Option<Box<Expression>>,
15288}
15289
15290#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15292#[cfg_attr(feature = "bindings", derive(TS))]
15293pub struct Merge {
15294 pub this: Box<Expression>,
15295 pub using: Box<Expression>,
15296 #[serde(default)]
15297 pub on: Option<Box<Expression>>,
15298 #[serde(default)]
15299 pub using_cond: Option<Box<Expression>>,
15300 #[serde(default)]
15301 pub whens: Option<Box<Expression>>,
15302 #[serde(default)]
15303 pub with_: Option<Box<Expression>>,
15304 #[serde(default)]
15305 pub returning: Option<Box<Expression>>,
15306}
15307
15308#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15310#[cfg_attr(feature = "bindings", derive(TS))]
15311pub struct When {
15312 #[serde(default)]
15313 pub matched: Option<Box<Expression>>,
15314 #[serde(default)]
15315 pub source: Option<Box<Expression>>,
15316 #[serde(default)]
15317 pub condition: Option<Box<Expression>>,
15318 pub then: Box<Expression>,
15319}
15320
15321#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15323#[cfg_attr(feature = "bindings", derive(TS))]
15324pub struct Whens {
15325 #[serde(default)]
15326 pub expressions: Vec<Expression>,
15327}
15328
15329#[derive(polyglot_sql_ast_derive::AstNode, Debug, Clone, PartialEq, Serialize, Deserialize)]
15331#[cfg_attr(feature = "bindings", derive(TS))]
15332pub struct NextValueFor {
15333 pub this: Box<Expression>,
15334 #[serde(default)]
15335 pub order: Option<Box<Expression>>,
15336}
15337
15338#[cfg(test)]
15339mod tests {
15340 use super::*;
15341
15342 #[test]
15343 #[cfg(feature = "bindings")]
15344 fn export_typescript_types() {
15345 Expression::export_all(&ts_rs::Config::default())
15348 .expect("Failed to export Expression types");
15349
15350 let mut variant_names = String::from(
15351 "// This file was generated from the Rust Expression enum. Do not edit it manually.\n\n",
15352 );
15353 variant_names.push_str("export const EXPRESSION_VARIANT_NAMES = [\n");
15354 for name in Expression::SERIALIZED_VARIANT_NAMES {
15355 use std::fmt::Write;
15356 writeln!(variant_names, " {name:?},").expect("writing to a String cannot fail");
15357 }
15358 variant_names.push_str("] as const;\n");
15359
15360 let output_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
15361 .join("bindings/ExpressionVariantNames.ts");
15362 std::fs::write(output_path, variant_names)
15363 .expect("Failed to export serialized Expression variant names");
15364 }
15365
15366 #[test]
15367 fn test_simple_select_builder() {
15368 let select = Select::new()
15369 .column(Expression::star())
15370 .from(Expression::Table(Box::new(TableRef::new("users"))));
15371
15372 assert_eq!(select.expressions.len(), 1);
15373 assert!(select.from.is_some());
15374 }
15375
15376 #[test]
15377 fn test_expression_alias() {
15378 let expr = Expression::column("id").alias("user_id");
15379
15380 match expr {
15381 Expression::Alias(a) => {
15382 assert_eq!(a.alias.name, "user_id");
15383 }
15384 _ => panic!("Expected Alias"),
15385 }
15386 }
15387
15388 #[test]
15389 fn test_literal_creation() {
15390 let num = Expression::number(42);
15391 let str = Expression::string("hello");
15392
15393 match num {
15394 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::Number(_)) => {
15395 let Literal::Number(n) = lit.as_ref() else {
15396 unreachable!()
15397 };
15398 assert_eq!(n, "42")
15399 }
15400 _ => panic!("Expected Number"),
15401 }
15402
15403 match str {
15404 Expression::Literal(lit) if matches!(lit.as_ref(), Literal::String(_)) => {
15405 let Literal::String(s) = lit.as_ref() else {
15406 unreachable!()
15407 };
15408 assert_eq!(s, "hello")
15409 }
15410 _ => panic!("Expected String"),
15411 }
15412 }
15413
15414 #[test]
15415 fn test_expression_sql() {
15416 let expr = crate::parse_one("SELECT 1 + 2", crate::DialectType::Generic).unwrap();
15417 assert_eq!(expr.sql(), "SELECT 1 + 2");
15418 }
15419
15420 #[test]
15421 fn test_expression_sql_for() {
15422 let expr = crate::parse_one("SELECT IF(x > 0, 1, 0)", crate::DialectType::Generic).unwrap();
15423 let sql = expr.sql_for(crate::DialectType::Generic);
15424 assert!(sql.contains("CASE WHEN"), "Expected CASE WHEN in: {}", sql);
15426 }
15427}