prettier-plugin-bq 0.2.60 → 0.2.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/keywords.d.ts +1 -0
- package/dist/keywords.js +12 -2
- package/dist/keywords.js.map +1 -1
- package/dist/printer.js +343 -5
- package/dist/printer.js.map +1 -1
- package/package.json +4 -4
package/dist/printer.js
CHANGED
|
@@ -422,6 +422,8 @@ const printSQL = (path, options, print) => {
|
|
|
422
422
|
return printAlterTableStatement(path, options, print, node);
|
|
423
423
|
case "AlterViewStatement":
|
|
424
424
|
return printAlterViewStatement(path, options, print, node);
|
|
425
|
+
case "AlterVectorIndexStatement":
|
|
426
|
+
return printAlterVectorIndexStatement(path, options, print, node);
|
|
425
427
|
case "ArrayLiteral":
|
|
426
428
|
return printArrayLiteral(path, options, print, node);
|
|
427
429
|
case "AssertStatement":
|
|
@@ -512,6 +514,8 @@ const printSQL = (path, options, print) => {
|
|
|
512
514
|
return printForSystemTimeAsOfclause(path, options, print, node);
|
|
513
515
|
case "FromStatement":
|
|
514
516
|
return printFromStatement(path, options, print, node);
|
|
517
|
+
case "FunctionChain":
|
|
518
|
+
return printFunctionChain(path, options, print, node);
|
|
515
519
|
case "GrantStatement":
|
|
516
520
|
return printGrantStatement(path, options, print, node);
|
|
517
521
|
case "GroupByExprs":
|
|
@@ -522,6 +526,8 @@ const printSQL = (path, options, print) => {
|
|
|
522
526
|
return printGroupedExprs(path, options, print, node);
|
|
523
527
|
case "GroupedIdentWithOptions":
|
|
524
528
|
return printGroupedIdentWithOptions(path, options, print, node);
|
|
529
|
+
case "GroupedPattern":
|
|
530
|
+
return printGroupedPattern(path, options, print, node);
|
|
525
531
|
case "GroupedStatement":
|
|
526
532
|
return printGroupedStatement(path, options, print, node);
|
|
527
533
|
case "GroupedType":
|
|
@@ -570,6 +576,12 @@ const printSQL = (path, options, print) => {
|
|
|
570
576
|
return printLoadStatement(path, options, print, node);
|
|
571
577
|
case "LoopStatement":
|
|
572
578
|
return printLoopStatement(path, options, print, node);
|
|
579
|
+
case "MatchRecognizeClause":
|
|
580
|
+
return printMatchRecognizeClause(path, options, print, node);
|
|
581
|
+
case "MatchRecognizeConfig":
|
|
582
|
+
return printMatchRecognizeConfig(path, options, print, node);
|
|
583
|
+
case "MatchRecognizePipeOperator":
|
|
584
|
+
return printMatchRecognizePipeOperator(path, options, print, node);
|
|
573
585
|
case "MergeStatement":
|
|
574
586
|
return printMergeStatement(path, options, print, node);
|
|
575
587
|
case "MultiTokenIdentifier":
|
|
@@ -578,12 +590,20 @@ const printSQL = (path, options, print) => {
|
|
|
578
590
|
return printNullLiteral(path, options, print, node);
|
|
579
591
|
case "NumericLiteral":
|
|
580
592
|
return printNumericLiteral(path, options, print, node);
|
|
593
|
+
case "OrPattern":
|
|
594
|
+
return printOrPattern(path, options, print, node);
|
|
581
595
|
case "OverClause":
|
|
582
596
|
return printOverClause(path, options, print, node);
|
|
583
597
|
case "OverwritePartitionsClause":
|
|
584
598
|
return printOverwritePartitionsClause(path, options, print, node);
|
|
585
599
|
case "Parameter":
|
|
586
600
|
return printIdentifier(path, options, print, node);
|
|
601
|
+
case "Pattern":
|
|
602
|
+
return printPattern(path, options, print, node);
|
|
603
|
+
case "PatternClause":
|
|
604
|
+
return printPatternClause(path, options, print, node);
|
|
605
|
+
case "PatternQuantifier":
|
|
606
|
+
return printPatternQuantifier(path, options, print, node);
|
|
587
607
|
case "PipeStatement":
|
|
588
608
|
return printPipeStatement(path, options, print, node);
|
|
589
609
|
case "PivotConfig":
|
|
@@ -602,6 +622,8 @@ const printSQL = (path, options, print) => {
|
|
|
602
622
|
return printRenameColumnClause(path, options, print, node);
|
|
603
623
|
case "RepeatStatement":
|
|
604
624
|
return printRepeatStatement(path, options, print, node);
|
|
625
|
+
case "SelectPipeOperator":
|
|
626
|
+
return printSelectPipeOperator(path, options, print, node);
|
|
605
627
|
case "SelectStatement":
|
|
606
628
|
return printSelectStatement(path, options, print, node);
|
|
607
629
|
case "SetOperator":
|
|
@@ -666,6 +688,8 @@ const printSQL = (path, options, print) => {
|
|
|
666
688
|
return printWithOffsetClause(path, options, print, node);
|
|
667
689
|
case "WithPartitionColumnsClause":
|
|
668
690
|
return printWithPartitionColumnsClause(path, options, print, node);
|
|
691
|
+
case "WithPipeOperator":
|
|
692
|
+
return printWithPipeOperator(path, options, print, node);
|
|
669
693
|
case "WithQuery":
|
|
670
694
|
return printWithQuery(path, options, print, node);
|
|
671
695
|
case "XXXByExprs":
|
|
@@ -1122,6 +1146,39 @@ const printAlterViewStatement = (path, options, print, node) => {
|
|
|
1122
1146
|
p.newLine(),
|
|
1123
1147
|
];
|
|
1124
1148
|
};
|
|
1149
|
+
const printAlterVectorIndexStatement = (path, options, print, node) => {
|
|
1150
|
+
const p = new Printer(path, options, print, node);
|
|
1151
|
+
const docs = {
|
|
1152
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
1153
|
+
self: p.self("upper"),
|
|
1154
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1155
|
+
what: p.child("what", undefined, "all"),
|
|
1156
|
+
if_exists: p.child("if_exists", (x) => group([line, x])),
|
|
1157
|
+
ident: p.child("ident", undefined, "all"),
|
|
1158
|
+
on: p.child("on"),
|
|
1159
|
+
operation: p.child("operation"),
|
|
1160
|
+
semicolon: p.child("semicolon"),
|
|
1161
|
+
};
|
|
1162
|
+
return [
|
|
1163
|
+
docs.leading_comments,
|
|
1164
|
+
group([
|
|
1165
|
+
docs.self,
|
|
1166
|
+
docs.trailing_comments,
|
|
1167
|
+
" ",
|
|
1168
|
+
docs.what,
|
|
1169
|
+
docs.if_exists,
|
|
1170
|
+
p.has("ident") ? " " : "",
|
|
1171
|
+
docs.ident,
|
|
1172
|
+
line,
|
|
1173
|
+
docs.on,
|
|
1174
|
+
line,
|
|
1175
|
+
docs.operation,
|
|
1176
|
+
p.has("semicolon") ? softline : "",
|
|
1177
|
+
docs.semicolon,
|
|
1178
|
+
]),
|
|
1179
|
+
p.newLine(),
|
|
1180
|
+
];
|
|
1181
|
+
};
|
|
1125
1182
|
const printAsterisk = (path, options, print, node) => {
|
|
1126
1183
|
const p = new Printer(path, options, print, node);
|
|
1127
1184
|
const docs = {
|
|
@@ -1539,6 +1596,12 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1539
1596
|
toUpper(parent.token);
|
|
1540
1597
|
}
|
|
1541
1598
|
break;
|
|
1599
|
+
case "VECTOR_INDEX":
|
|
1600
|
+
if (keywords_1.vectorIndexFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1601
|
+
func.isPreDefinedFunction = true;
|
|
1602
|
+
toUpper(parent.token);
|
|
1603
|
+
}
|
|
1604
|
+
break;
|
|
1542
1605
|
}
|
|
1543
1606
|
}
|
|
1544
1607
|
else if (parent.node_type === "DotOperator") {
|
|
@@ -1603,6 +1666,13 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1603
1666
|
toUpper(grandParent.token);
|
|
1604
1667
|
}
|
|
1605
1668
|
break;
|
|
1669
|
+
case "VECTOR_INDEX":
|
|
1670
|
+
if (keywords_1.vectorIndexFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1671
|
+
func.isPreDefinedFunction = true;
|
|
1672
|
+
toUpper(parent.token);
|
|
1673
|
+
toUpper(grandParent.token);
|
|
1674
|
+
}
|
|
1675
|
+
break;
|
|
1606
1676
|
}
|
|
1607
1677
|
}
|
|
1608
1678
|
}
|
|
@@ -1618,7 +1688,9 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1618
1688
|
}
|
|
1619
1689
|
// XXX_DIFF
|
|
1620
1690
|
if (["DATE_DIFF", "DATETIME_DIFF", "TIME_DIFF", "TIMESTAMP_DIFF"].includes(func_literal)) {
|
|
1621
|
-
args.NodeVec[2]
|
|
1691
|
+
const node = args.NodeVec[2];
|
|
1692
|
+
if (node)
|
|
1693
|
+
node.isDatePart = true; // not chained function
|
|
1622
1694
|
}
|
|
1623
1695
|
// XXX_TRUNC
|
|
1624
1696
|
if ([
|
|
@@ -1627,11 +1699,15 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1627
1699
|
"TIME_TRUNC",
|
|
1628
1700
|
"TIMESTAMP_TRUNC",
|
|
1629
1701
|
].includes(func_literal)) {
|
|
1630
|
-
args.NodeVec[1]
|
|
1702
|
+
const node = args.NodeVec[1];
|
|
1703
|
+
if (node)
|
|
1704
|
+
node.isDatePart = true; // not chained function
|
|
1631
1705
|
}
|
|
1632
1706
|
// LAST_DAY
|
|
1633
1707
|
if (func_literal === "LAST_DAY" && 2 <= p.len("args")) {
|
|
1634
|
-
args.NodeVec[1]
|
|
1708
|
+
const node = args.NodeVec[1];
|
|
1709
|
+
if (node)
|
|
1710
|
+
node.isDatePart = true; // not chained function
|
|
1635
1711
|
}
|
|
1636
1712
|
}
|
|
1637
1713
|
}
|
|
@@ -1699,10 +1775,12 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1699
1775
|
];
|
|
1700
1776
|
};
|
|
1701
1777
|
const printCallingTableFunction = (path, options, print, node) => {
|
|
1778
|
+
const p = new Printer(path, options, print, node);
|
|
1702
1779
|
const docs = {
|
|
1703
1780
|
self: printCallingFunctionGeneral(path, options, print, node),
|
|
1704
1781
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
1705
1782
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1783
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
1706
1784
|
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1707
1785
|
/* eslint-disable unicorn/no-unused-properties */
|
|
1708
1786
|
leading_comments: "",
|
|
@@ -1714,7 +1792,12 @@ const printCallingTableFunction = (path, options, print, node) => {
|
|
|
1714
1792
|
alias: "",
|
|
1715
1793
|
/* eslint-enable unicorn/no-unused-properties */
|
|
1716
1794
|
};
|
|
1717
|
-
return [
|
|
1795
|
+
return [
|
|
1796
|
+
docs.self,
|
|
1797
|
+
docs.pivot,
|
|
1798
|
+
p.has("match_recognize") ? " " : "",
|
|
1799
|
+
docs.match_recognize,
|
|
1800
|
+
];
|
|
1718
1801
|
};
|
|
1719
1802
|
const printCallingUnnest = (path, options, print, node) => {
|
|
1720
1803
|
const p = new Printer(path, options, print, node);
|
|
@@ -1723,6 +1806,7 @@ const printCallingUnnest = (path, options, print, node) => {
|
|
|
1723
1806
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
1724
1807
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
1725
1808
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1809
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
1726
1810
|
/* eslint-disable unicorn/no-unused-properties */
|
|
1727
1811
|
leading_comments: "",
|
|
1728
1812
|
func: "",
|
|
@@ -1738,6 +1822,8 @@ const printCallingUnnest = (path, options, print, node) => {
|
|
|
1738
1822
|
p.has("with_offset") ? " " : "",
|
|
1739
1823
|
docs.with_offset,
|
|
1740
1824
|
docs.pivot,
|
|
1825
|
+
p.has("match_recognize") ? " " : "",
|
|
1826
|
+
docs.match_recognize,
|
|
1741
1827
|
];
|
|
1742
1828
|
};
|
|
1743
1829
|
const printCallStatement = (path, options, print, node) => {
|
|
@@ -2283,6 +2369,7 @@ const printCreateIndexStatement = (path, options, print, node) => {
|
|
|
2283
2369
|
tablename: p.child("tablename", undefined, "all"),
|
|
2284
2370
|
column_group: p.child("column_group", undefined, "all"),
|
|
2285
2371
|
storing: p.child("storing"),
|
|
2372
|
+
partitionby: p.child("partitionby"),
|
|
2286
2373
|
options: p.child("options"),
|
|
2287
2374
|
semicolon: p.child("semicolon"),
|
|
2288
2375
|
};
|
|
@@ -2305,6 +2392,8 @@ const printCreateIndexStatement = (path, options, print, node) => {
|
|
|
2305
2392
|
docs.column_group,
|
|
2306
2393
|
p.has("storing") ? line : "",
|
|
2307
2394
|
docs.storing,
|
|
2395
|
+
p.has("partitionby") ? line : "",
|
|
2396
|
+
docs.partitionby,
|
|
2308
2397
|
p.has("options") ? line : "",
|
|
2309
2398
|
docs.options,
|
|
2310
2399
|
p.has("semicolon") ? softline : "",
|
|
@@ -2521,6 +2610,7 @@ const printDotOperator = (path, options, print, node) => {
|
|
|
2521
2610
|
for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
|
|
2522
2611
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2523
2612
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2613
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
2524
2614
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
2525
2615
|
tablesample: p.child("tablesample", undefined, "all"),
|
|
2526
2616
|
order: printOrder(path, options, print, node),
|
|
@@ -2535,6 +2625,8 @@ const printDotOperator = (path, options, print, node) => {
|
|
|
2535
2625
|
docs.alias,
|
|
2536
2626
|
p.has("for_system_time_as_of") ? [" ", docs.for_system_time_as_of] : "",
|
|
2537
2627
|
docs.pivot,
|
|
2628
|
+
p.has("match_recognize") ? " " : "",
|
|
2629
|
+
docs.match_recognize,
|
|
2538
2630
|
p.has("with_offset") ? " " : "",
|
|
2539
2631
|
docs.with_offset,
|
|
2540
2632
|
p.has("tablesample") ? [" ", docs.tablesample] : "",
|
|
@@ -2848,6 +2940,7 @@ const printForSystemTimeAsOfclause = (path, options, print, node) => {
|
|
|
2848
2940
|
const printFromStatement = (path, options, print, node) => {
|
|
2849
2941
|
const p = new Printer(path, options, print, node);
|
|
2850
2942
|
const docs = {
|
|
2943
|
+
with: p.child("with"),
|
|
2851
2944
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
2852
2945
|
self: p.self("upper"),
|
|
2853
2946
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
@@ -2855,8 +2948,11 @@ const printFromStatement = (path, options, print, node) => {
|
|
|
2855
2948
|
semicolon: p.child("semicolon"),
|
|
2856
2949
|
};
|
|
2857
2950
|
return [
|
|
2951
|
+
docs.with,
|
|
2952
|
+
p.has("with") ? hardline : "",
|
|
2858
2953
|
docs.leading_comments,
|
|
2859
2954
|
group([
|
|
2955
|
+
p.has("with") ? breakParent : "",
|
|
2860
2956
|
docs.self,
|
|
2861
2957
|
docs.trailing_comments,
|
|
2862
2958
|
" ",
|
|
@@ -2867,6 +2963,47 @@ const printFromStatement = (path, options, print, node) => {
|
|
|
2867
2963
|
p.newLine(),
|
|
2868
2964
|
];
|
|
2869
2965
|
};
|
|
2966
|
+
const printFunctionChain = (path, options, print, node) => {
|
|
2967
|
+
const p = new Printer(path, options, print, node);
|
|
2968
|
+
const docs = {
|
|
2969
|
+
left: p.child("left"),
|
|
2970
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
2971
|
+
self: p.self("upper"),
|
|
2972
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2973
|
+
right: p.child("right", undefined, "all"),
|
|
2974
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2975
|
+
alias: printAlias(path, options, print, node),
|
|
2976
|
+
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2977
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2978
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
2979
|
+
with_offset: p.child("with_offset", undefined, "all"),
|
|
2980
|
+
order: printOrder(path, options, print, node),
|
|
2981
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2982
|
+
comma: printComma(path, options, print, node),
|
|
2983
|
+
};
|
|
2984
|
+
let res = [
|
|
2985
|
+
docs.left,
|
|
2986
|
+
softline,
|
|
2987
|
+
docs.leading_comments,
|
|
2988
|
+
docs.self,
|
|
2989
|
+
docs.trailing_comments,
|
|
2990
|
+
docs.right,
|
|
2991
|
+
docs.alias,
|
|
2992
|
+
];
|
|
2993
|
+
if (node.groupRecommended) {
|
|
2994
|
+
res = group(res);
|
|
2995
|
+
}
|
|
2996
|
+
return [
|
|
2997
|
+
res,
|
|
2998
|
+
docs.pivot,
|
|
2999
|
+
p.has("match_recognize") ? " " : "",
|
|
3000
|
+
docs.match_recognize,
|
|
3001
|
+
p.has("with_offset") ? " " : "",
|
|
3002
|
+
docs.with_offset,
|
|
3003
|
+
docs.order,
|
|
3004
|
+
docs.comma,
|
|
3005
|
+
];
|
|
3006
|
+
};
|
|
2870
3007
|
const printGrantStatement = (path, options, print, node) => {
|
|
2871
3008
|
const p = new Printer(path, options, print, node);
|
|
2872
3009
|
const docs = {
|
|
@@ -2937,6 +3074,7 @@ const printGroupedExpr = (path, options, print, node) => {
|
|
|
2937
3074
|
alias: printAlias(path, options, print, node),
|
|
2938
3075
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2939
3076
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3077
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
2940
3078
|
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2941
3079
|
order: printOrder(path, options, print, node),
|
|
2942
3080
|
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
@@ -2953,6 +3091,8 @@ const printGroupedExpr = (path, options, print, node) => {
|
|
|
2953
3091
|
]),
|
|
2954
3092
|
docs.alias,
|
|
2955
3093
|
docs.pivot,
|
|
3094
|
+
p.has("match_recognize") ? " " : "",
|
|
3095
|
+
docs.match_recognize,
|
|
2956
3096
|
docs.order,
|
|
2957
3097
|
docs.comma,
|
|
2958
3098
|
];
|
|
@@ -3008,6 +3148,28 @@ const printGroupedIdentWithOptions = (path, options, print, node) => {
|
|
|
3008
3148
|
]),
|
|
3009
3149
|
];
|
|
3010
3150
|
};
|
|
3151
|
+
const printGroupedPattern = (path, options, print, node) => {
|
|
3152
|
+
const p = new Printer(path, options, print, node);
|
|
3153
|
+
const docs = {
|
|
3154
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
3155
|
+
self: p.self(),
|
|
3156
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3157
|
+
patterns: p.child("patterns", undefined, "none", line),
|
|
3158
|
+
rparen: p.child("rparen"),
|
|
3159
|
+
suffixes: p.child("suffixes", undefined, "all"),
|
|
3160
|
+
};
|
|
3161
|
+
return [
|
|
3162
|
+
docs.leading_comments,
|
|
3163
|
+
group([
|
|
3164
|
+
docs.self,
|
|
3165
|
+
docs.trailing_comments,
|
|
3166
|
+
indent([softline, docs.patterns]),
|
|
3167
|
+
softline,
|
|
3168
|
+
docs.rparen,
|
|
3169
|
+
docs.suffixes,
|
|
3170
|
+
]),
|
|
3171
|
+
];
|
|
3172
|
+
};
|
|
3011
3173
|
const printGroupedStatement = (path, options, print, node) => {
|
|
3012
3174
|
const p = new Printer(path, options, print, node);
|
|
3013
3175
|
p.setNotRoot("stmt");
|
|
@@ -3022,6 +3184,7 @@ const printGroupedStatement = (path, options, print, node) => {
|
|
|
3022
3184
|
alias: printAlias(path, options, print, node),
|
|
3023
3185
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
3024
3186
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3187
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
3025
3188
|
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3026
3189
|
orderby: p.child("orderby"),
|
|
3027
3190
|
limit: p.child("limit"),
|
|
@@ -3049,6 +3212,8 @@ const printGroupedStatement = (path, options, print, node) => {
|
|
|
3049
3212
|
softline,
|
|
3050
3213
|
docs.rparen,
|
|
3051
3214
|
docs.pivot,
|
|
3215
|
+
p.has("match_recognize") ? " " : "",
|
|
3216
|
+
docs.match_recognize,
|
|
3052
3217
|
]),
|
|
3053
3218
|
p.has("orderby") ? line : "",
|
|
3054
3219
|
docs.orderby,
|
|
@@ -3110,6 +3275,7 @@ const printIdentifier = (path, options, print, node) => {
|
|
|
3110
3275
|
for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
|
|
3111
3276
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
3112
3277
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3278
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
3113
3279
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
3114
3280
|
tablesample: p.child("tablesample", undefined, "all"),
|
|
3115
3281
|
order: printOrder(path, options, print, node),
|
|
@@ -3123,6 +3289,8 @@ const printIdentifier = (path, options, print, node) => {
|
|
|
3123
3289
|
docs.alias,
|
|
3124
3290
|
p.has("for_system_time_as_of") ? [" ", docs.for_system_time_as_of] : "",
|
|
3125
3291
|
docs.pivot,
|
|
3292
|
+
p.has("match_recognize") ? " " : "",
|
|
3293
|
+
docs.match_recognize,
|
|
3126
3294
|
p.has("with_offset") ? " " : "",
|
|
3127
3295
|
docs.with_offset,
|
|
3128
3296
|
p.has("tablesample") ? [" ", docs.tablesample] : "",
|
|
@@ -3330,6 +3498,7 @@ const printJoinOperator = (path, options, print, node) => {
|
|
|
3330
3498
|
alias: printAlias(path, options, print, node),
|
|
3331
3499
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
3332
3500
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3501
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
3333
3502
|
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3334
3503
|
};
|
|
3335
3504
|
return [
|
|
@@ -3352,6 +3521,8 @@ const printJoinOperator = (path, options, print, node) => {
|
|
|
3352
3521
|
docs.using,
|
|
3353
3522
|
docs.alias,
|
|
3354
3523
|
docs.pivot,
|
|
3524
|
+
p.has("match_recognize") ? " " : "",
|
|
3525
|
+
docs.match_recognize,
|
|
3355
3526
|
];
|
|
3356
3527
|
};
|
|
3357
3528
|
const printJoinPipeOperator = (path, options, print, node) => {
|
|
@@ -3650,6 +3821,71 @@ const printLoopStatement = (path, options, print, node) => {
|
|
|
3650
3821
|
p.newLine(),
|
|
3651
3822
|
];
|
|
3652
3823
|
};
|
|
3824
|
+
const printMatchRecognizeClause = (path, options, print, node) => {
|
|
3825
|
+
const p = new Printer(path, options, print, node);
|
|
3826
|
+
const docs = {
|
|
3827
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
3828
|
+
self: p.self("upper"),
|
|
3829
|
+
config: p.child("config", undefined, "all"),
|
|
3830
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3831
|
+
as: p.child("as", undefined, "all"),
|
|
3832
|
+
alias: p.child("alias", undefined, "all"),
|
|
3833
|
+
};
|
|
3834
|
+
return [
|
|
3835
|
+
docs.leading_comments,
|
|
3836
|
+
docs.self,
|
|
3837
|
+
docs.trailing_comments,
|
|
3838
|
+
" ",
|
|
3839
|
+
docs.config,
|
|
3840
|
+
p.has("alias")
|
|
3841
|
+
? [" ", docs.as || (options.printKeywordsInUpperCase ? "AS" : "as")]
|
|
3842
|
+
: "",
|
|
3843
|
+
p.has("alias") ? [" ", docs.alias] : "",
|
|
3844
|
+
];
|
|
3845
|
+
};
|
|
3846
|
+
const printMatchRecognizeConfig = (path, options, print, node) => {
|
|
3847
|
+
const p = new Printer(path, options, print, node);
|
|
3848
|
+
const docs = {
|
|
3849
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
3850
|
+
self: p.self("upper", true),
|
|
3851
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3852
|
+
partitionby: p.child("partitionby"),
|
|
3853
|
+
orderby: p.child("orderby"),
|
|
3854
|
+
measures: p.child("measures"),
|
|
3855
|
+
skip_rule: p.child("skip_rule"),
|
|
3856
|
+
pattern: p.child("pattern"),
|
|
3857
|
+
define: p.child("define"),
|
|
3858
|
+
options: p.child("options"),
|
|
3859
|
+
rparen: p.child("rparen"),
|
|
3860
|
+
};
|
|
3861
|
+
return [
|
|
3862
|
+
docs.leading_comments,
|
|
3863
|
+
docs.self,
|
|
3864
|
+
docs.trailing_comments,
|
|
3865
|
+
indent([
|
|
3866
|
+
hardline,
|
|
3867
|
+
group(docs.partitionby),
|
|
3868
|
+
p.has("partitionby") ? line : "",
|
|
3869
|
+
group(docs.orderby),
|
|
3870
|
+
// some are necessary but handle as if optional for simplicity
|
|
3871
|
+
p.has("measures") ? line : "",
|
|
3872
|
+
docs.measures,
|
|
3873
|
+
p.has("skip_rule") ? line : "",
|
|
3874
|
+
docs.skip_rule,
|
|
3875
|
+
p.has("pattern") ? line : "",
|
|
3876
|
+
docs.pattern,
|
|
3877
|
+
p.has("define") ? line : "",
|
|
3878
|
+
docs.define,
|
|
3879
|
+
p.has("options") ? line : "",
|
|
3880
|
+
docs.options,
|
|
3881
|
+
]),
|
|
3882
|
+
softline,
|
|
3883
|
+
docs.rparen,
|
|
3884
|
+
];
|
|
3885
|
+
};
|
|
3886
|
+
const printMatchRecognizePipeOperator = (path, options, print, node) => {
|
|
3887
|
+
return printMatchRecognizeClause(path, options, print, node);
|
|
3888
|
+
};
|
|
3653
3889
|
const printMergeStatement = (path, options, print, node) => {
|
|
3654
3890
|
const p = new Printer(path, options, print, node);
|
|
3655
3891
|
const docs = {
|
|
@@ -3694,6 +3930,7 @@ const printMultiTokenIdentifier = (path, options, print, node) => {
|
|
|
3694
3930
|
for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
|
|
3695
3931
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
3696
3932
|
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3933
|
+
match_recognize: p.child("match_recognize", undefined, "all"),
|
|
3697
3934
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
3698
3935
|
tablesample: p.child("tablesample", undefined, "all"),
|
|
3699
3936
|
// NOTE order, null_order, comma may be unnecessary for the time being.
|
|
@@ -3709,6 +3946,8 @@ const printMultiTokenIdentifier = (path, options, print, node) => {
|
|
|
3709
3946
|
docs.alias,
|
|
3710
3947
|
p.has("for_system_time_as_of") ? [" ", docs.for_system_time_as_of] : "",
|
|
3711
3948
|
docs.pivot,
|
|
3949
|
+
p.has("match_recognize") ? " " : "",
|
|
3950
|
+
docs.match_recognize,
|
|
3712
3951
|
p.has("with_offset") ? " " : "",
|
|
3713
3952
|
docs.with_offset,
|
|
3714
3953
|
p.has("tablesample") ? [" ", docs.tablesample] : "",
|
|
@@ -3758,6 +3997,24 @@ const printNumericLiteral = (path, options, print, node) => {
|
|
|
3758
3997
|
docs.comma,
|
|
3759
3998
|
];
|
|
3760
3999
|
};
|
|
4000
|
+
const printOrPattern = (path, options, print, node) => {
|
|
4001
|
+
var _a;
|
|
4002
|
+
const p = new Printer(path, options, print, node);
|
|
4003
|
+
const docs = {
|
|
4004
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4005
|
+
self: p.self("upper"),
|
|
4006
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4007
|
+
left: p.child("left", undefined, "none", line),
|
|
4008
|
+
right: p.child("right", undefined, "all", line),
|
|
4009
|
+
};
|
|
4010
|
+
const left_is_or_pattern = ((_a = node.children.left.NodeVec[0]) === null || _a === void 0 ? void 0 : _a.node_type) === "OrPattern";
|
|
4011
|
+
return [
|
|
4012
|
+
left_is_or_pattern ? docs.left : group(docs.left),
|
|
4013
|
+
line,
|
|
4014
|
+
docs.leading_comments,
|
|
4015
|
+
group([docs.self, docs.trailing_comments, indent([line, docs.right])]),
|
|
4016
|
+
];
|
|
4017
|
+
};
|
|
3761
4018
|
const printOverClause = (path, options, print, node) => {
|
|
3762
4019
|
const p = new Printer(path, options, print, node);
|
|
3763
4020
|
const docs = {
|
|
@@ -3786,6 +4043,58 @@ const printOverwritePartitionsClause = (path, options, print, node) => {
|
|
|
3786
4043
|
docs.grouped_expr,
|
|
3787
4044
|
]);
|
|
3788
4045
|
};
|
|
4046
|
+
const printPattern = (path, options, print, node) => {
|
|
4047
|
+
const p = new Printer(path, options, print, node);
|
|
4048
|
+
const docs = {
|
|
4049
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4050
|
+
self: p.self("asItIs"),
|
|
4051
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4052
|
+
suffixes: p.child("suffixes", undefined, "all"),
|
|
4053
|
+
};
|
|
4054
|
+
return [
|
|
4055
|
+
docs.leading_comments,
|
|
4056
|
+
docs.self,
|
|
4057
|
+
docs.trailing_comments,
|
|
4058
|
+
docs.suffixes,
|
|
4059
|
+
];
|
|
4060
|
+
};
|
|
4061
|
+
const printPatternClause = (path, options, print, node) => {
|
|
4062
|
+
const p = new Printer(path, options, print, node);
|
|
4063
|
+
const docs = {
|
|
4064
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4065
|
+
self: p.self("upper"),
|
|
4066
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4067
|
+
pattern: p.child("pattern", undefined, "all"),
|
|
4068
|
+
};
|
|
4069
|
+
return [
|
|
4070
|
+
docs.leading_comments,
|
|
4071
|
+
docs.self,
|
|
4072
|
+
docs.trailing_comments,
|
|
4073
|
+
" ",
|
|
4074
|
+
docs.pattern,
|
|
4075
|
+
];
|
|
4076
|
+
};
|
|
4077
|
+
const printPatternQuantifier = (path, options, print, node) => {
|
|
4078
|
+
const p = new Printer(path, options, print, node);
|
|
4079
|
+
const docs = {
|
|
4080
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4081
|
+
self: p.self("upper"),
|
|
4082
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4083
|
+
min: p.child("min", undefined, "all"),
|
|
4084
|
+
comma: p.child("comma", undefined, "all"),
|
|
4085
|
+
max: p.child("max", undefined, "all"),
|
|
4086
|
+
rbrace: p.child("rbrace", undefined, "all"),
|
|
4087
|
+
};
|
|
4088
|
+
return [
|
|
4089
|
+
docs.leading_comments,
|
|
4090
|
+
docs.self,
|
|
4091
|
+
docs.trailing_comments,
|
|
4092
|
+
docs.min,
|
|
4093
|
+
docs.comma,
|
|
4094
|
+
docs.max,
|
|
4095
|
+
docs.rbrace,
|
|
4096
|
+
];
|
|
4097
|
+
};
|
|
3789
4098
|
const printPipeStatement = (path, options, print, node) => {
|
|
3790
4099
|
const p = new Printer(path, options, print, node);
|
|
3791
4100
|
p.setNotRoot("left");
|
|
@@ -4026,6 +4335,32 @@ const printRepeatStatement = (path, options, print, node) => {
|
|
|
4026
4335
|
p.newLine(),
|
|
4027
4336
|
];
|
|
4028
4337
|
};
|
|
4338
|
+
const printSelectPipeOperator = (path, options, print, node) => {
|
|
4339
|
+
const p = new Printer(path, options, print, node);
|
|
4340
|
+
p.setNotRoot("exprs");
|
|
4341
|
+
p.setGroupRecommended("exprs");
|
|
4342
|
+
if (node.children.exprs) {
|
|
4343
|
+
node.children.exprs.NodeVec[p.len("exprs") - 1].isFinalColumn = true;
|
|
4344
|
+
}
|
|
4345
|
+
const docs = {
|
|
4346
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4347
|
+
self: p.self(),
|
|
4348
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4349
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
4350
|
+
exprs: p.child("exprs", (x) => group([line, x])),
|
|
4351
|
+
window: p.child("window"),
|
|
4352
|
+
};
|
|
4353
|
+
return [
|
|
4354
|
+
docs.leading_comments,
|
|
4355
|
+
docs.self,
|
|
4356
|
+
docs.trailing_comments,
|
|
4357
|
+
p.has("keywords") ? " " : "",
|
|
4358
|
+
docs.keywords,
|
|
4359
|
+
indent(docs.exprs),
|
|
4360
|
+
p.has("window") ? line : "",
|
|
4361
|
+
docs.window,
|
|
4362
|
+
];
|
|
4363
|
+
};
|
|
4029
4364
|
const printSelectStatement = (path, options, print, node) => {
|
|
4030
4365
|
const p = new Printer(path, options, print, node);
|
|
4031
4366
|
p.setNotRoot("exprs");
|
|
@@ -4879,6 +5214,9 @@ const printWithPartitionColumnsClause = (path, options, print, node) => {
|
|
|
4879
5214
|
]),
|
|
4880
5215
|
];
|
|
4881
5216
|
};
|
|
5217
|
+
const printWithPipeOperator = (path, options, print, node) => {
|
|
5218
|
+
return printWithClause(path, options, print, node);
|
|
5219
|
+
};
|
|
4882
5220
|
const printWithQuery = (path, options, print, node) => {
|
|
4883
5221
|
const p = new Printer(path, options, print, node);
|
|
4884
5222
|
p.setNotRoot("stmt");
|
|
@@ -4935,7 +5273,7 @@ const printAlias = (path, options, print, node) => {
|
|
|
4935
5273
|
else {
|
|
4936
5274
|
as_ = options.printKeywordsInUpperCase ? "AS" : "as";
|
|
4937
5275
|
}
|
|
4938
|
-
return [" ", as_, " ", p.child("alias", undefined, "all")];
|
|
5276
|
+
return [" ", as_, " ", group(p.child("alias", undefined, "all"))];
|
|
4939
5277
|
};
|
|
4940
5278
|
const printComma = (path, options, print, node) => {
|
|
4941
5279
|
const p = new Printer(path, options, print, node);
|