prettier-plugin-bq 0.2.58 → 0.2.60
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/README.md +8 -7
- package/dist/keywords.d.ts +3 -0
- package/dist/keywords.js +33 -1
- package/dist/keywords.js.map +1 -1
- package/dist/printer.js +557 -147
- package/dist/printer.js.map +1 -1
- package/package.json +8 -8
package/dist/printer.js
CHANGED
|
@@ -400,6 +400,8 @@ const printSQL = (path, options, print) => {
|
|
|
400
400
|
return printAddColumnClause(path, options, print, node);
|
|
401
401
|
case "AddConstraintClause":
|
|
402
402
|
return printAddConstraintClause(path, options, print, node);
|
|
403
|
+
case "AggregatePipeOperator":
|
|
404
|
+
return printAggregatePipeOperator(path, options, print, node);
|
|
403
405
|
case "AlterBICapacityStatement":
|
|
404
406
|
return printAlterBICapacityStatement(path, options, print, node);
|
|
405
407
|
case "AlterColumnStatement":
|
|
@@ -426,6 +428,8 @@ const printSQL = (path, options, print) => {
|
|
|
426
428
|
return printAssertStatement(path, options, print, node);
|
|
427
429
|
case "Asterisk":
|
|
428
430
|
return printAsterisk(path, options, print, node);
|
|
431
|
+
case "BasePipeOperator":
|
|
432
|
+
return printBasePipeOperator(path, options, print, node);
|
|
429
433
|
case "BeginStatement":
|
|
430
434
|
return printBeginStatement(path, options, print, node);
|
|
431
435
|
case "BetweenOperator":
|
|
@@ -450,6 +454,10 @@ const printSQL = (path, options, print) => {
|
|
|
450
454
|
return printCaseExprArm(path, options, print, node);
|
|
451
455
|
case "CastArgument":
|
|
452
456
|
return printCastArgument(path, options, print, node);
|
|
457
|
+
case "CaseStatement":
|
|
458
|
+
return printCaseStatement(path, options, print, node);
|
|
459
|
+
case "CaseStatementArm":
|
|
460
|
+
return printCaseStatementArm(path, options, print, node);
|
|
453
461
|
case "Comment":
|
|
454
462
|
return printComment(path, options, print, node);
|
|
455
463
|
case "Constraint":
|
|
@@ -502,6 +510,8 @@ const printSQL = (path, options, print) => {
|
|
|
502
510
|
return printForStatement(path, options, print, node);
|
|
503
511
|
case "ForSystemTimeAsOfClause":
|
|
504
512
|
return printForSystemTimeAsOfclause(path, options, print, node);
|
|
513
|
+
case "FromStatement":
|
|
514
|
+
return printFromStatement(path, options, print, node);
|
|
505
515
|
case "GrantStatement":
|
|
506
516
|
return printGrantStatement(path, options, print, node);
|
|
507
517
|
case "GroupByExprs":
|
|
@@ -534,6 +544,8 @@ const printSQL = (path, options, print) => {
|
|
|
534
544
|
return printIsDistinctFromOperator(path, options, print, node);
|
|
535
545
|
case "JoinOperator":
|
|
536
546
|
return printJoinOperator(path, options, print, node);
|
|
547
|
+
case "JoinPipeOperator":
|
|
548
|
+
return printJoinPipeOperator(path, options, print, node);
|
|
537
549
|
case "Keyword":
|
|
538
550
|
return printKeyword(path, options, print, node);
|
|
539
551
|
case "KeywordSequence":
|
|
@@ -552,6 +564,8 @@ const printSQL = (path, options, print) => {
|
|
|
552
564
|
return printKeywordWithType(path, options, print, node);
|
|
553
565
|
case "LimitClause":
|
|
554
566
|
return printLimitClause(path, options, print, node);
|
|
567
|
+
case "LimitPipeOperator":
|
|
568
|
+
return printLimitPipeOperator(path, options, print, node);
|
|
555
569
|
case "LoadStatement":
|
|
556
570
|
return printLoadStatement(path, options, print, node);
|
|
557
571
|
case "LoopStatement":
|
|
@@ -570,10 +584,14 @@ const printSQL = (path, options, print) => {
|
|
|
570
584
|
return printOverwritePartitionsClause(path, options, print, node);
|
|
571
585
|
case "Parameter":
|
|
572
586
|
return printIdentifier(path, options, print, node);
|
|
587
|
+
case "PipeStatement":
|
|
588
|
+
return printPipeStatement(path, options, print, node);
|
|
573
589
|
case "PivotConfig":
|
|
574
590
|
return printPivotConfig(path, options, print, node);
|
|
575
591
|
case "PivotOperator":
|
|
576
592
|
return printPivotOperator(path, options, print, node);
|
|
593
|
+
case "PivotPipeOperator":
|
|
594
|
+
return printPivotPipeOperator(path, options, print, node);
|
|
577
595
|
case "RevokeStatement":
|
|
578
596
|
return printRevokeStatement(path, options, print, node);
|
|
579
597
|
case "RaiseStatement":
|
|
@@ -600,6 +618,8 @@ const printSQL = (path, options, print) => {
|
|
|
600
618
|
return printSymbol(path, options, print, node);
|
|
601
619
|
case "TableSampleClause":
|
|
602
620
|
return printTableSampleClause(path, options, print, node);
|
|
621
|
+
case "TableSamplePipeOperator":
|
|
622
|
+
return printTableSamplePipeOperator(path, options, print, node);
|
|
603
623
|
case "TableSampleRatio":
|
|
604
624
|
return printTableSampleRatio(path, options, print, node);
|
|
605
625
|
case "Template":
|
|
@@ -618,10 +638,14 @@ const printSQL = (path, options, print) => {
|
|
|
618
638
|
return printUnaryOperator(path, options, print, node);
|
|
619
639
|
case "UndropStatement":
|
|
620
640
|
return printUndropStatement(path, options, print, node);
|
|
641
|
+
case "UnionPipeOperator":
|
|
642
|
+
return printUnionPipeOperator(path, options, print, node);
|
|
621
643
|
case "UnpivotConfig":
|
|
622
644
|
return printUnpivotConfig(path, options, print, node);
|
|
623
645
|
case "UnpivotOperator":
|
|
624
646
|
return printUnpivotOperator(path, options, print, node);
|
|
647
|
+
case "UnpivotPipeOperator":
|
|
648
|
+
return printUnpivotPipeOperator(path, options, print, node);
|
|
625
649
|
case "UpdateStatement":
|
|
626
650
|
return printUpdateStatement(path, options, print, node);
|
|
627
651
|
case "WhenClause":
|
|
@@ -654,16 +678,16 @@ exports.printSQL = printSQL;
|
|
|
654
678
|
const printAccessOperator = (path, options, print, node) => {
|
|
655
679
|
const p = new Printer(path, options, print, node);
|
|
656
680
|
const docs = {
|
|
657
|
-
leading_comments: "",
|
|
681
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
658
682
|
left: p.child("left"),
|
|
659
683
|
self: p.self("asItIs", true),
|
|
660
684
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
661
685
|
right: p.child("right", undefined, "all"),
|
|
662
686
|
rparen: p.child("rparen", undefined, "all"),
|
|
663
|
-
as: "",
|
|
687
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
664
688
|
alias: printAlias(path, options, print, node),
|
|
665
689
|
order: printOrder(path, options, print, node),
|
|
666
|
-
null_order: "",
|
|
690
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
667
691
|
comma: printComma(path, options, print, node),
|
|
668
692
|
};
|
|
669
693
|
return [
|
|
@@ -704,6 +728,32 @@ const printAddColumnClause = (path, options, print, node) => {
|
|
|
704
728
|
]),
|
|
705
729
|
];
|
|
706
730
|
};
|
|
731
|
+
const printAggregatePipeOperator = (path, options, print, node) => {
|
|
732
|
+
const p = new Printer(path, options, print, node);
|
|
733
|
+
p.setNotRoot("exprs");
|
|
734
|
+
p.setGroupRecommended("exprs");
|
|
735
|
+
if (node.children.exprs) {
|
|
736
|
+
node.children.exprs.NodeVec[p.len("exprs") - 1].isFinalColumn = true;
|
|
737
|
+
}
|
|
738
|
+
const docs = {
|
|
739
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
740
|
+
self: p.self(),
|
|
741
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
742
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
743
|
+
exprs: p.child("exprs", (x) => group([line, x])),
|
|
744
|
+
groupby: p.child("groupby"),
|
|
745
|
+
};
|
|
746
|
+
return [
|
|
747
|
+
docs.leading_comments,
|
|
748
|
+
docs.self,
|
|
749
|
+
docs.trailing_comments,
|
|
750
|
+
p.has("keywords") ? " " : "",
|
|
751
|
+
docs.keywords,
|
|
752
|
+
indent(docs.exprs),
|
|
753
|
+
p.has("groupby") ? hardline : "",
|
|
754
|
+
docs.groupby,
|
|
755
|
+
];
|
|
756
|
+
};
|
|
707
757
|
const printAddConstraintClause = (path, options, print, node) => {
|
|
708
758
|
const p = new Printer(path, options, print, node);
|
|
709
759
|
const docs = {
|
|
@@ -743,7 +793,7 @@ const printAlterBICapacityStatement = (path, options, print, node) => {
|
|
|
743
793
|
docs.set,
|
|
744
794
|
" ",
|
|
745
795
|
docs.options,
|
|
746
|
-
softline,
|
|
796
|
+
p.has("semicolon") ? softline : "",
|
|
747
797
|
docs.semicolon,
|
|
748
798
|
]),
|
|
749
799
|
p.newLine(),
|
|
@@ -818,7 +868,7 @@ const printAlterModelStatement = (path, options, print, node) => {
|
|
|
818
868
|
docs.set,
|
|
819
869
|
" ",
|
|
820
870
|
docs.options,
|
|
821
|
-
softline,
|
|
871
|
+
p.has("semicolon") ? softline : "",
|
|
822
872
|
docs.semicolon,
|
|
823
873
|
]),
|
|
824
874
|
p.newLine(),
|
|
@@ -846,7 +896,7 @@ const printAlterOrganizationStatement = (path, options, print, node) => {
|
|
|
846
896
|
docs.set,
|
|
847
897
|
" ",
|
|
848
898
|
docs.options,
|
|
849
|
-
softline,
|
|
899
|
+
p.has("semicolon") ? softline : "",
|
|
850
900
|
docs.semicolon,
|
|
851
901
|
]),
|
|
852
902
|
p.newLine(),
|
|
@@ -877,7 +927,7 @@ const printAlterProjectStatement = (path, options, print, node) => {
|
|
|
877
927
|
docs.set,
|
|
878
928
|
" ",
|
|
879
929
|
docs.options,
|
|
880
|
-
softline,
|
|
930
|
+
p.has("semicolon") ? softline : "",
|
|
881
931
|
docs.semicolon,
|
|
882
932
|
]),
|
|
883
933
|
p.newLine(),
|
|
@@ -908,7 +958,7 @@ const printAlterReservationStatement = (path, options, print, node) => {
|
|
|
908
958
|
docs.set,
|
|
909
959
|
" ",
|
|
910
960
|
docs.options,
|
|
911
|
-
softline,
|
|
961
|
+
p.has("semicolon") ? softline : "",
|
|
912
962
|
docs.semicolon,
|
|
913
963
|
]),
|
|
914
964
|
p.newLine(),
|
|
@@ -924,6 +974,8 @@ const printAlterSchemaStatement = (path, options, print, node) => {
|
|
|
924
974
|
if_exists: p.child("if_exists", (x) => group([line, x])),
|
|
925
975
|
ident: p.child("ident", undefined, "all"),
|
|
926
976
|
set: p.child("set"),
|
|
977
|
+
add: p.child("add"),
|
|
978
|
+
drop: p.child("drop"),
|
|
927
979
|
options: p.child("options", undefined, "all"),
|
|
928
980
|
default_collate: p.child("default_collate", undefined, "all"),
|
|
929
981
|
semicolon: p.child("semicolon"),
|
|
@@ -939,11 +991,10 @@ const printAlterSchemaStatement = (path, options, print, node) => {
|
|
|
939
991
|
p.has("ident") ? " " : "",
|
|
940
992
|
docs.ident,
|
|
941
993
|
line,
|
|
942
|
-
docs.set,
|
|
943
|
-
|
|
944
|
-
docs.
|
|
945
|
-
|
|
946
|
-
softline,
|
|
994
|
+
p.has("set") ? [docs.set, " ", docs.default_collate, docs.options] : "",
|
|
995
|
+
docs.add,
|
|
996
|
+
docs.drop,
|
|
997
|
+
p.has("semicolon") ? softline : "",
|
|
947
998
|
docs.semicolon,
|
|
948
999
|
]),
|
|
949
1000
|
p.newLine(),
|
|
@@ -1027,7 +1078,7 @@ const printAlterTableStatement = (path, options, print, node) => {
|
|
|
1027
1078
|
docs.drop_columns,
|
|
1028
1079
|
p.has("alter_column_stmt") ? hardline : "",
|
|
1029
1080
|
docs.alter_column_stmt,
|
|
1030
|
-
softline,
|
|
1081
|
+
p.has("semicolon") ? softline : "",
|
|
1031
1082
|
docs.semicolon,
|
|
1032
1083
|
]),
|
|
1033
1084
|
p.newLine(),
|
|
@@ -1065,7 +1116,7 @@ const printAlterViewStatement = (path, options, print, node) => {
|
|
|
1065
1116
|
p.has("set") ? " " : "",
|
|
1066
1117
|
docs.options,
|
|
1067
1118
|
docs.alter_column_stmt,
|
|
1068
|
-
softline,
|
|
1119
|
+
p.has("semicolon") ? softline : "",
|
|
1069
1120
|
docs.semicolon,
|
|
1070
1121
|
]),
|
|
1071
1122
|
p.newLine(),
|
|
@@ -1079,7 +1130,7 @@ const printAsterisk = (path, options, print, node) => {
|
|
|
1079
1130
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1080
1131
|
except: p.child("except", (x) => [" ", x], "all"),
|
|
1081
1132
|
replace: p.child("replace", (x) => [" ", x], "all"),
|
|
1082
|
-
as: "",
|
|
1133
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1083
1134
|
alias: printAlias(path, options, print, node),
|
|
1084
1135
|
comma: printComma(path, options, print, node),
|
|
1085
1136
|
};
|
|
@@ -1093,6 +1144,63 @@ const printAsterisk = (path, options, print, node) => {
|
|
|
1093
1144
|
docs.comma,
|
|
1094
1145
|
];
|
|
1095
1146
|
};
|
|
1147
|
+
const printBasePipeOperator = (path, options, print, node) => {
|
|
1148
|
+
const p = new Printer(path, options, print, node);
|
|
1149
|
+
p.setNotRoot("exprs");
|
|
1150
|
+
p.setGroupRecommended("exprs");
|
|
1151
|
+
// trailing comma is...
|
|
1152
|
+
// allowed!
|
|
1153
|
+
// * select
|
|
1154
|
+
// * extend
|
|
1155
|
+
// * set
|
|
1156
|
+
// * drop
|
|
1157
|
+
// * rename
|
|
1158
|
+
// * aggregate
|
|
1159
|
+
// * order by
|
|
1160
|
+
// * union / intersect / except
|
|
1161
|
+
// NOT allowed!
|
|
1162
|
+
// * as
|
|
1163
|
+
// * where
|
|
1164
|
+
// * limit
|
|
1165
|
+
// * call
|
|
1166
|
+
// * join
|
|
1167
|
+
// other
|
|
1168
|
+
// * table sample
|
|
1169
|
+
// * pivot
|
|
1170
|
+
// * unpivot
|
|
1171
|
+
const commaTolerantOperators = [
|
|
1172
|
+
"SELECT",
|
|
1173
|
+
"EXTEND",
|
|
1174
|
+
"SET",
|
|
1175
|
+
"DROP",
|
|
1176
|
+
"RENAME",
|
|
1177
|
+
"AGGREGATE",
|
|
1178
|
+
"ORDER",
|
|
1179
|
+
"UNION",
|
|
1180
|
+
"INTERSECT",
|
|
1181
|
+
"EXCEPT",
|
|
1182
|
+
];
|
|
1183
|
+
if (node.children.exprs &&
|
|
1184
|
+
node.token &&
|
|
1185
|
+
commaTolerantOperators.includes(node.token.literal.toUpperCase())) {
|
|
1186
|
+
node.children.exprs.NodeVec[p.len("exprs") - 1].isFinalColumn = true;
|
|
1187
|
+
}
|
|
1188
|
+
const docs = {
|
|
1189
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
1190
|
+
self: p.self(),
|
|
1191
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1192
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
1193
|
+
exprs: p.child("exprs", (x) => group([line, x])),
|
|
1194
|
+
};
|
|
1195
|
+
return [
|
|
1196
|
+
docs.leading_comments,
|
|
1197
|
+
docs.self,
|
|
1198
|
+
docs.trailing_comments,
|
|
1199
|
+
p.has("keywords") ? " " : "",
|
|
1200
|
+
docs.keywords,
|
|
1201
|
+
indent(docs.exprs),
|
|
1202
|
+
];
|
|
1203
|
+
};
|
|
1096
1204
|
const printArrayLiteral = (path, options, print, node) => {
|
|
1097
1205
|
const p = new Printer(path, options, print, node);
|
|
1098
1206
|
const docs = {
|
|
@@ -1104,10 +1212,10 @@ const printArrayLiteral = (path, options, print, node) => {
|
|
|
1104
1212
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1105
1213
|
exprs: p.child("exprs", (x) => group(x), "none", line),
|
|
1106
1214
|
rparen: p.child("rparen"),
|
|
1107
|
-
as: "",
|
|
1215
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1108
1216
|
alias: printAlias(path, options, print, node),
|
|
1109
1217
|
order: printOrder(path, options, print, node),
|
|
1110
|
-
null_order: "",
|
|
1218
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1111
1219
|
comma: printComma(path, options, print, node),
|
|
1112
1220
|
};
|
|
1113
1221
|
return [
|
|
@@ -1151,7 +1259,7 @@ const printAssertStatement = (path, options, print, node) => {
|
|
|
1151
1259
|
docs.as,
|
|
1152
1260
|
p.has("description") ? " " : "",
|
|
1153
1261
|
docs.description,
|
|
1154
|
-
softline,
|
|
1262
|
+
p.has("semicolon") ? softline : "",
|
|
1155
1263
|
docs.semicolon,
|
|
1156
1264
|
]),
|
|
1157
1265
|
p.newLine(),
|
|
@@ -1200,7 +1308,7 @@ const printBeginStatement = (path, options, print, node) => {
|
|
|
1200
1308
|
docs.end,
|
|
1201
1309
|
p.has("trailing_label") ? " " : "",
|
|
1202
1310
|
docs.trailing_label,
|
|
1203
|
-
softline,
|
|
1311
|
+
p.has("semicolon") ? softline : "",
|
|
1204
1312
|
docs.semicolon,
|
|
1205
1313
|
]),
|
|
1206
1314
|
p.newLine(),
|
|
@@ -1209,7 +1317,7 @@ const printBeginStatement = (path, options, print, node) => {
|
|
|
1209
1317
|
const printBetweenOperator = (path, options, print, node) => {
|
|
1210
1318
|
const p = new Printer(path, options, print, node);
|
|
1211
1319
|
const docs = {
|
|
1212
|
-
leading_comments: "",
|
|
1320
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1213
1321
|
left: p.child("left"),
|
|
1214
1322
|
not: p.child("not", undefined, "all"),
|
|
1215
1323
|
self: p.self("upper", true),
|
|
@@ -1217,10 +1325,10 @@ const printBetweenOperator = (path, options, print, node) => {
|
|
|
1217
1325
|
right_min: p.child("right_min"),
|
|
1218
1326
|
and: p.child("and"),
|
|
1219
1327
|
right_max: p.child("right_max", undefined, "all"),
|
|
1220
|
-
as: "",
|
|
1328
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1221
1329
|
alias: printAlias(path, options, print, node),
|
|
1222
1330
|
order: printOrder(path, options, print, node),
|
|
1223
|
-
null_order: "",
|
|
1331
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1224
1332
|
comma: printComma(path, options, print, node),
|
|
1225
1333
|
};
|
|
1226
1334
|
return [
|
|
@@ -1248,10 +1356,10 @@ const printBooleanLiteral = (path, options, print, node) => {
|
|
|
1248
1356
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
1249
1357
|
self: p.self(),
|
|
1250
1358
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1251
|
-
as: "",
|
|
1359
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1252
1360
|
alias: printAlias(path, options, print, node),
|
|
1253
1361
|
order: printOrder(path, options, print, node),
|
|
1254
|
-
null_order: "",
|
|
1362
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1255
1363
|
comma: printComma(path, options, print, node),
|
|
1256
1364
|
};
|
|
1257
1365
|
return [
|
|
@@ -1278,10 +1386,10 @@ const printBinaryOperator = (path, options, print, node) => {
|
|
|
1278
1386
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1279
1387
|
quantifier: p.child("quantifier", undefined, "all"),
|
|
1280
1388
|
right: p.child("right", undefined, "all"),
|
|
1281
|
-
as: "",
|
|
1389
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1282
1390
|
alias: printAlias(path, options, print, node),
|
|
1283
1391
|
order: printOrder(path, options, print, node),
|
|
1284
|
-
null_order: "",
|
|
1392
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1285
1393
|
comma: printComma(path, options, print, node),
|
|
1286
1394
|
};
|
|
1287
1395
|
// NOTE
|
|
@@ -1407,12 +1515,30 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1407
1515
|
toUpper(parent.token);
|
|
1408
1516
|
}
|
|
1409
1517
|
break;
|
|
1518
|
+
case "KLL_QUANTILES":
|
|
1519
|
+
if (keywords_1.kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1520
|
+
func.isPreDefinedFunction = true;
|
|
1521
|
+
toUpper(parent.token);
|
|
1522
|
+
}
|
|
1523
|
+
break;
|
|
1524
|
+
case "OBJ":
|
|
1525
|
+
if (keywords_1.objFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1526
|
+
func.isPreDefinedFunction = true;
|
|
1527
|
+
toUpper(parent.token);
|
|
1528
|
+
}
|
|
1529
|
+
break;
|
|
1410
1530
|
case "ML":
|
|
1411
1531
|
if (keywords_1.mlFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1412
1532
|
func.isPreDefinedFunction = true;
|
|
1413
1533
|
toUpper(parent.token);
|
|
1414
1534
|
}
|
|
1415
1535
|
break;
|
|
1536
|
+
case "AI":
|
|
1537
|
+
if (keywords_1.aiFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1538
|
+
func.isPreDefinedFunction = true;
|
|
1539
|
+
toUpper(parent.token);
|
|
1540
|
+
}
|
|
1541
|
+
break;
|
|
1416
1542
|
}
|
|
1417
1543
|
}
|
|
1418
1544
|
else if (parent.node_type === "DotOperator") {
|
|
@@ -1449,6 +1575,34 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1449
1575
|
toUpper(grandParent.token);
|
|
1450
1576
|
}
|
|
1451
1577
|
break;
|
|
1578
|
+
case "KLL_QUANTILES":
|
|
1579
|
+
if (keywords_1.kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1580
|
+
func.isPreDefinedFunction = true;
|
|
1581
|
+
toUpper(parent.token);
|
|
1582
|
+
toUpper(grandParent.token);
|
|
1583
|
+
}
|
|
1584
|
+
break;
|
|
1585
|
+
case "OBJ":
|
|
1586
|
+
if (keywords_1.objFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1587
|
+
func.isPreDefinedFunction = true;
|
|
1588
|
+
toUpper(parent.token);
|
|
1589
|
+
toUpper(grandParent.token);
|
|
1590
|
+
}
|
|
1591
|
+
break;
|
|
1592
|
+
case "ML":
|
|
1593
|
+
if (keywords_1.mlFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1594
|
+
func.isPreDefinedFunction = true;
|
|
1595
|
+
toUpper(parent.token);
|
|
1596
|
+
toUpper(grandParent.token);
|
|
1597
|
+
}
|
|
1598
|
+
break;
|
|
1599
|
+
case "AI":
|
|
1600
|
+
if (keywords_1.aiFunctions.includes(func.token.literal.toUpperCase())) {
|
|
1601
|
+
func.isPreDefinedFunction = true;
|
|
1602
|
+
toUpper(parent.token);
|
|
1603
|
+
toUpper(grandParent.token);
|
|
1604
|
+
}
|
|
1605
|
+
break;
|
|
1452
1606
|
}
|
|
1453
1607
|
}
|
|
1454
1608
|
}
|
|
@@ -1482,7 +1636,7 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1482
1636
|
}
|
|
1483
1637
|
}
|
|
1484
1638
|
const docs = {
|
|
1485
|
-
leading_comments: "",
|
|
1639
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1486
1640
|
func: p.child("func"),
|
|
1487
1641
|
self: p.self("asItIs", true),
|
|
1488
1642
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
@@ -1494,10 +1648,10 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
|
|
|
1494
1648
|
having: p.child("having"),
|
|
1495
1649
|
rparen: p.child("rparen"),
|
|
1496
1650
|
over: p.child("over", (x) => [" ", x], "all"),
|
|
1497
|
-
as: "",
|
|
1651
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1498
1652
|
alias: printAlias(path, options, print, node),
|
|
1499
1653
|
order: printOrder(path, options, print, node),
|
|
1500
|
-
null_order: "",
|
|
1654
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1501
1655
|
comma: printComma(path, options, print, node),
|
|
1502
1656
|
};
|
|
1503
1657
|
// TODO
|
|
@@ -1548,8 +1702,8 @@ const printCallingTableFunction = (path, options, print, node) => {
|
|
|
1548
1702
|
const docs = {
|
|
1549
1703
|
self: printCallingFunctionGeneral(path, options, print, node),
|
|
1550
1704
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
1551
|
-
unpivot: "",
|
|
1552
|
-
with_offset: "",
|
|
1705
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1706
|
+
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1553
1707
|
/* eslint-disable unicorn/no-unused-properties */
|
|
1554
1708
|
leading_comments: "",
|
|
1555
1709
|
func: "",
|
|
@@ -1568,7 +1722,7 @@ const printCallingUnnest = (path, options, print, node) => {
|
|
|
1568
1722
|
self: printCallingFunctionGeneral(path, options, print, node),
|
|
1569
1723
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
1570
1724
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
1571
|
-
unpivot: "",
|
|
1725
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1572
1726
|
/* eslint-disable unicorn/no-unused-properties */
|
|
1573
1727
|
leading_comments: "",
|
|
1574
1728
|
func: "",
|
|
@@ -1602,7 +1756,7 @@ const printCallStatement = (path, options, print, node) => {
|
|
|
1602
1756
|
docs.trailing_comments,
|
|
1603
1757
|
" ",
|
|
1604
1758
|
docs.procedure,
|
|
1605
|
-
softline,
|
|
1759
|
+
p.has("semicolon") ? softline : "",
|
|
1606
1760
|
docs.semicolon,
|
|
1607
1761
|
]),
|
|
1608
1762
|
p.newLine(),
|
|
@@ -1617,10 +1771,10 @@ const printCaseExpr = (path, options, print, node) => {
|
|
|
1617
1771
|
expr: p.child("expr", undefined, "all"),
|
|
1618
1772
|
arms: p.child("arms", (x) => [line, group(x)], "none"),
|
|
1619
1773
|
end: p.child("end"),
|
|
1620
|
-
as: "",
|
|
1774
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1621
1775
|
alias: printAlias(path, options, print, node),
|
|
1622
1776
|
order: printOrder(path, options, print, node),
|
|
1623
|
-
null_order: "",
|
|
1777
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1624
1778
|
comma: printComma(path, options, print, node),
|
|
1625
1779
|
};
|
|
1626
1780
|
let res = [
|
|
@@ -1683,10 +1837,61 @@ const printCaseExprArm = (path, options, print, node) => {
|
|
|
1683
1837
|
];
|
|
1684
1838
|
}
|
|
1685
1839
|
};
|
|
1840
|
+
const printCaseStatement = (path, options, print, node) => {
|
|
1841
|
+
const p = new Printer(path, options, print, node);
|
|
1842
|
+
const docs = {
|
|
1843
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
1844
|
+
self: p.self(),
|
|
1845
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1846
|
+
expr: p.child("expr", undefined, "all"),
|
|
1847
|
+
arms: p.child("arms", (x) => [line, group(x)]),
|
|
1848
|
+
end_case: group(p.child("end_case", undefined, "none", line)),
|
|
1849
|
+
semicolon: p.child("semicolon"),
|
|
1850
|
+
};
|
|
1851
|
+
return [
|
|
1852
|
+
docs.leading_comments,
|
|
1853
|
+
group([
|
|
1854
|
+
docs.self,
|
|
1855
|
+
docs.trailing_comments,
|
|
1856
|
+
p.has("expr") ? " " : "",
|
|
1857
|
+
docs.expr,
|
|
1858
|
+
indent(docs.arms),
|
|
1859
|
+
line,
|
|
1860
|
+
docs.end_case,
|
|
1861
|
+
p.has("semicolon") ? softline : "",
|
|
1862
|
+
docs.semicolon,
|
|
1863
|
+
]),
|
|
1864
|
+
p.newLine(),
|
|
1865
|
+
];
|
|
1866
|
+
};
|
|
1867
|
+
const printCaseStatementArm = (path, options, print, node) => {
|
|
1868
|
+
const p = new Printer(path, options, print, node);
|
|
1869
|
+
p.setNotRoot("stmts");
|
|
1870
|
+
const docs = {
|
|
1871
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
1872
|
+
self: p.self(),
|
|
1873
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1874
|
+
expr: p.child("expr", undefined, "all"),
|
|
1875
|
+
then: p.child("then", undefined, "all"),
|
|
1876
|
+
stmts: p.child("stmts", (x) => [hardline, group(x)]),
|
|
1877
|
+
};
|
|
1878
|
+
return [
|
|
1879
|
+
docs.leading_comments,
|
|
1880
|
+
group([
|
|
1881
|
+
docs.self,
|
|
1882
|
+
docs.trailing_comments,
|
|
1883
|
+
p.has("expr") ? " " : "",
|
|
1884
|
+
docs.expr,
|
|
1885
|
+
p.has("then") ? " " : "",
|
|
1886
|
+
docs.then,
|
|
1887
|
+
indent([docs.stmts]),
|
|
1888
|
+
]),
|
|
1889
|
+
];
|
|
1890
|
+
};
|
|
1686
1891
|
const printCastArgument = (path, options, print, node) => {
|
|
1687
1892
|
const p = new Printer(path, options, print, node);
|
|
1688
1893
|
const docs = {
|
|
1689
|
-
leading_comments: "",
|
|
1894
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1690
1895
|
cast_from: p.child("cast_from"),
|
|
1691
1896
|
self: p.self("upper", true),
|
|
1692
1897
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
@@ -1750,16 +1955,16 @@ const printComment = (path, options, print, node) => {
|
|
|
1750
1955
|
const printConstraint = (path, options, print, node) => {
|
|
1751
1956
|
const p = new Printer(path, options, print, node);
|
|
1752
1957
|
const docs = {
|
|
1753
|
-
constraint: p.child("constraint", undefined, "all"),
|
|
1754
|
-
if_not_exists: p.child("if_not_exists", (x) => group([line, x]), "all"),
|
|
1755
|
-
ident: p.child("ident", undefined, "all"),
|
|
1756
|
-
leading_comments: "",
|
|
1757
|
-
self: p.self("upper", true),
|
|
1958
|
+
constraint: p.child("constraint", undefined, "all"), // CONSTRAINT
|
|
1959
|
+
if_not_exists: p.child("if_not_exists", (x) => group([line, x]), "all"), // IF NOT EXISTS
|
|
1960
|
+
ident: p.child("ident", undefined, "all"), // ident
|
|
1961
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
1962
|
+
self: p.self("upper", true), // PRIMARY | FOREIGN
|
|
1758
1963
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
1759
|
-
key: p.child("key", undefined, "all"),
|
|
1760
|
-
columns: p.child("columns", undefined, "all"),
|
|
1761
|
-
references: p.child("references", undefined, "all"),
|
|
1762
|
-
enforced: p.child("enforced", undefined, "all"),
|
|
1964
|
+
key: p.child("key", undefined, "all"), // KEY
|
|
1965
|
+
columns: p.child("columns", undefined, "all"), // (col)
|
|
1966
|
+
references: p.child("references", undefined, "all"), // REFERENCES tablename(col)
|
|
1967
|
+
enforced: p.child("enforced", undefined, "all"), // NOT ENFORCED
|
|
1763
1968
|
comma: p.child("comma", undefined, "all"),
|
|
1764
1969
|
};
|
|
1765
1970
|
return [
|
|
@@ -1796,9 +2001,10 @@ const printCreateFunctionStatement = (path, options, print, node) => {
|
|
|
1796
2001
|
ident: p.child("ident", undefined, "all"),
|
|
1797
2002
|
group: p.child("group", undefined, "all"),
|
|
1798
2003
|
returns: p.child("returns"),
|
|
1799
|
-
remote: p.child("remote"),
|
|
1800
2004
|
determinism: group(p.child("determinism", undefined, "none", line)),
|
|
1801
2005
|
language: p.child("language"),
|
|
2006
|
+
remote: p.child("remote"),
|
|
2007
|
+
connection: p.child("connection", undefined, p.has("remote") ? "all" : "none"),
|
|
1802
2008
|
options: p.child("options"),
|
|
1803
2009
|
as: p.child("as"),
|
|
1804
2010
|
semicolon: p.child("semicolon"),
|
|
@@ -1825,17 +2031,18 @@ const printCreateFunctionStatement = (path, options, print, node) => {
|
|
|
1825
2031
|
]),
|
|
1826
2032
|
p.has("returns") ? line : "",
|
|
1827
2033
|
docs.returns,
|
|
1828
|
-
p.has("remote") ? line : "",
|
|
1829
|
-
docs.remote,
|
|
1830
2034
|
p.has("determinism") ? line : "",
|
|
1831
2035
|
docs.determinism,
|
|
1832
2036
|
p.has("language") ? line : "",
|
|
1833
2037
|
docs.language,
|
|
2038
|
+
p.has("remote") || p.has("connection")
|
|
2039
|
+
? [line, docs.remote, p.has("remote") ? " " : "", docs.connection]
|
|
2040
|
+
: "",
|
|
1834
2041
|
p.has("options") ? line : "",
|
|
1835
2042
|
docs.options,
|
|
1836
2043
|
p.has("as") ? line : "",
|
|
1837
2044
|
docs.as,
|
|
1838
|
-
softline,
|
|
2045
|
+
p.has("semicolon") ? softline : "",
|
|
1839
2046
|
docs.semicolon,
|
|
1840
2047
|
]),
|
|
1841
2048
|
p.newLine(),
|
|
@@ -1885,7 +2092,7 @@ const printCreateModelStatement = (path, options, print, node) => {
|
|
|
1885
2092
|
docs.query,
|
|
1886
2093
|
p.has("training_data_custom_holiday") ? line : "",
|
|
1887
2094
|
docs.training_data_custom_holiday,
|
|
1888
|
-
softline,
|
|
2095
|
+
p.has("semicolon") ? softline : "",
|
|
1889
2096
|
docs.semicolon,
|
|
1890
2097
|
]),
|
|
1891
2098
|
p.newLine(),
|
|
@@ -1937,7 +2144,7 @@ const printCreateProcedureStatement = (path, options, print, node) => {
|
|
|
1937
2144
|
docs.stmt,
|
|
1938
2145
|
p.has("as") ? line : "",
|
|
1939
2146
|
docs.as,
|
|
1940
|
-
softline,
|
|
2147
|
+
p.has("semicolon") ? softline : "",
|
|
1941
2148
|
docs.semicolon,
|
|
1942
2149
|
]),
|
|
1943
2150
|
p.newLine(),
|
|
@@ -1973,7 +2180,7 @@ const printCreateReservationStatement = (path, options, print, node) => {
|
|
|
1973
2180
|
p.has("json_string") ? " " : "",
|
|
1974
2181
|
docs.json_string,
|
|
1975
2182
|
docs.options,
|
|
1976
|
-
softline,
|
|
2183
|
+
p.has("semicolon") ? softline : "",
|
|
1977
2184
|
docs.semicolon,
|
|
1978
2185
|
]),
|
|
1979
2186
|
p.newLine(),
|
|
@@ -2017,7 +2224,7 @@ const printCreateRowAccessPolicyStatement = (path, options, print, node) => {
|
|
|
2017
2224
|
docs.filter,
|
|
2018
2225
|
" ",
|
|
2019
2226
|
docs.using,
|
|
2020
|
-
softline,
|
|
2227
|
+
p.has("semicolon") ? softline : "",
|
|
2021
2228
|
docs.semicolon,
|
|
2022
2229
|
]),
|
|
2023
2230
|
p.newLine(),
|
|
@@ -2056,7 +2263,7 @@ const printCreateSchemaStatement = (path, options, print, node) => {
|
|
|
2056
2263
|
docs.with_connection,
|
|
2057
2264
|
p.has("options") ? line : "",
|
|
2058
2265
|
docs.options,
|
|
2059
|
-
softline,
|
|
2266
|
+
p.has("semicolon") ? softline : "",
|
|
2060
2267
|
docs.semicolon,
|
|
2061
2268
|
]),
|
|
2062
2269
|
p.newLine(),
|
|
@@ -2100,7 +2307,7 @@ const printCreateIndexStatement = (path, options, print, node) => {
|
|
|
2100
2307
|
docs.storing,
|
|
2101
2308
|
p.has("options") ? line : "",
|
|
2102
2309
|
docs.options,
|
|
2103
|
-
softline,
|
|
2310
|
+
p.has("semicolon") ? softline : "",
|
|
2104
2311
|
docs.semicolon,
|
|
2105
2312
|
]),
|
|
2106
2313
|
p.newLine(),
|
|
@@ -2172,7 +2379,7 @@ const printCreateTableStatement = (path, options, print, node) => {
|
|
|
2172
2379
|
docs.options,
|
|
2173
2380
|
p.has("as") ? line : "",
|
|
2174
2381
|
docs.as,
|
|
2175
|
-
softline,
|
|
2382
|
+
p.has("semicolon") ? softline : "",
|
|
2176
2383
|
docs.semicolon,
|
|
2177
2384
|
]),
|
|
2178
2385
|
p.newLine(),
|
|
@@ -2219,7 +2426,7 @@ const printCreateViewStatement = (path, options, print, node) => {
|
|
|
2219
2426
|
docs.options,
|
|
2220
2427
|
line,
|
|
2221
2428
|
docs.as,
|
|
2222
|
-
softline,
|
|
2429
|
+
p.has("semicolon") ? softline : "",
|
|
2223
2430
|
docs.semicolon,
|
|
2224
2431
|
]),
|
|
2225
2432
|
p.newLine(),
|
|
@@ -2246,7 +2453,7 @@ const printDeclareStatement = (path, options, print, node) => {
|
|
|
2246
2453
|
docs.variable_type,
|
|
2247
2454
|
p.has("default") ? line : "",
|
|
2248
2455
|
docs.default,
|
|
2249
|
-
softline,
|
|
2456
|
+
p.has("semicolon") ? softline : "",
|
|
2250
2457
|
docs.semicolon,
|
|
2251
2458
|
]),
|
|
2252
2459
|
p.newLine(),
|
|
@@ -2273,7 +2480,7 @@ const printDeleteStatement = (path, options, print, node) => {
|
|
|
2273
2480
|
docs.table_name,
|
|
2274
2481
|
line,
|
|
2275
2482
|
docs.where,
|
|
2276
|
-
softline,
|
|
2483
|
+
p.has("semicolon") ? softline : "",
|
|
2277
2484
|
docs.semicolon,
|
|
2278
2485
|
]),
|
|
2279
2486
|
p.newLine(),
|
|
@@ -2304,20 +2511,20 @@ const printDotOperator = (path, options, print, node) => {
|
|
|
2304
2511
|
const p = new Printer(path, options, print, node);
|
|
2305
2512
|
p.setNotGlobal("right");
|
|
2306
2513
|
const docs = {
|
|
2307
|
-
leading_comments: "",
|
|
2514
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2308
2515
|
left: p.child("left"),
|
|
2309
2516
|
self: p.self("upper", true),
|
|
2310
2517
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2311
2518
|
right: p.child("right", undefined, "all"),
|
|
2312
|
-
as: "",
|
|
2519
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2313
2520
|
alias: printAlias(path, options, print, node),
|
|
2314
2521
|
for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
|
|
2315
2522
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2316
|
-
unpivot: "",
|
|
2523
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2317
2524
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
2318
2525
|
tablesample: p.child("tablesample", undefined, "all"),
|
|
2319
2526
|
order: printOrder(path, options, print, node),
|
|
2320
|
-
null_order: "",
|
|
2527
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2321
2528
|
comma: printComma(path, options, print, node),
|
|
2322
2529
|
};
|
|
2323
2530
|
return [
|
|
@@ -2359,7 +2566,7 @@ const printDropRowAccessPolicyStatement = (path, options, print, node) => {
|
|
|
2359
2566
|
docs.ident,
|
|
2360
2567
|
line,
|
|
2361
2568
|
docs.on,
|
|
2362
|
-
softline,
|
|
2569
|
+
p.has("semicolon") ? softline : "",
|
|
2363
2570
|
docs.semicolon,
|
|
2364
2571
|
]),
|
|
2365
2572
|
p.newLine(),
|
|
@@ -2401,7 +2608,7 @@ const printDropStatement = (path, options, print, node) => {
|
|
|
2401
2608
|
docs.on,
|
|
2402
2609
|
p.has("cascade_or_restrict") ? " " : "",
|
|
2403
2610
|
docs.cascade_or_restrict,
|
|
2404
|
-
softline,
|
|
2611
|
+
p.has("semicolon") ? softline : "",
|
|
2405
2612
|
docs.semicolon,
|
|
2406
2613
|
]),
|
|
2407
2614
|
p.newLine(),
|
|
@@ -2433,10 +2640,10 @@ const printEmptyStruct = (path, options, print, node) => {
|
|
|
2433
2640
|
self: p.self(),
|
|
2434
2641
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2435
2642
|
rparen: p.child("rparen"),
|
|
2436
|
-
as: "",
|
|
2643
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2437
2644
|
alias: printAlias(path, options, print, node),
|
|
2438
2645
|
order: printOrder(path, options, print, node),
|
|
2439
|
-
null_order: "",
|
|
2646
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2440
2647
|
comma: printComma(path, options, print, node),
|
|
2441
2648
|
};
|
|
2442
2649
|
return [
|
|
@@ -2481,7 +2688,7 @@ const printExecuteStatement = (path, options, print, node) => {
|
|
|
2481
2688
|
docs.into,
|
|
2482
2689
|
p.has("using") ? line : "",
|
|
2483
2690
|
docs.using,
|
|
2484
|
-
softline,
|
|
2691
|
+
p.has("semicolon") ? softline : "",
|
|
2485
2692
|
docs.semicolon,
|
|
2486
2693
|
]),
|
|
2487
2694
|
p.newLine(),
|
|
@@ -2512,7 +2719,7 @@ const printExportDataStatement = (path, options, print, node) => {
|
|
|
2512
2719
|
docs.options,
|
|
2513
2720
|
line,
|
|
2514
2721
|
docs.as,
|
|
2515
|
-
softline,
|
|
2722
|
+
p.has("semicolon") ? softline : "",
|
|
2516
2723
|
docs.semicolon,
|
|
2517
2724
|
]),
|
|
2518
2725
|
p.newLine(),
|
|
@@ -2540,7 +2747,7 @@ const printExportModelStatement = (path, options, print, node) => {
|
|
|
2540
2747
|
docs.ident,
|
|
2541
2748
|
line,
|
|
2542
2749
|
docs.options,
|
|
2543
|
-
softline,
|
|
2750
|
+
p.has("semicolon") ? softline : "",
|
|
2544
2751
|
docs.semicolon,
|
|
2545
2752
|
]),
|
|
2546
2753
|
p.newLine(),
|
|
@@ -2550,7 +2757,7 @@ const printExtractArgument = (path, options, print, node) => {
|
|
|
2550
2757
|
const p = new Printer(path, options, print, node);
|
|
2551
2758
|
node.children.extract_datepart.Node.isDatePart = true;
|
|
2552
2759
|
const docs = {
|
|
2553
|
-
leading_comments: "",
|
|
2760
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2554
2761
|
extract_datepart: p.child("extract_datepart"),
|
|
2555
2762
|
self: p.self("upper", true),
|
|
2556
2763
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
@@ -2614,7 +2821,7 @@ const printForStatement = (path, options, print, node) => {
|
|
|
2614
2821
|
docs.end_for,
|
|
2615
2822
|
p.has("trailing_label") ? " " : "",
|
|
2616
2823
|
docs.trailing_label,
|
|
2617
|
-
softline,
|
|
2824
|
+
p.has("semicolon") ? softline : "",
|
|
2618
2825
|
docs.semicolon,
|
|
2619
2826
|
]),
|
|
2620
2827
|
p.newLine(),
|
|
@@ -2638,6 +2845,28 @@ const printForSystemTimeAsOfclause = (path, options, print, node) => {
|
|
|
2638
2845
|
docs.expr,
|
|
2639
2846
|
];
|
|
2640
2847
|
};
|
|
2848
|
+
const printFromStatement = (path, options, print, node) => {
|
|
2849
|
+
const p = new Printer(path, options, print, node);
|
|
2850
|
+
const docs = {
|
|
2851
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
2852
|
+
self: p.self("upper"),
|
|
2853
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2854
|
+
expr: p.child("expr", undefined, "first"),
|
|
2855
|
+
semicolon: p.child("semicolon"),
|
|
2856
|
+
};
|
|
2857
|
+
return [
|
|
2858
|
+
docs.leading_comments,
|
|
2859
|
+
group([
|
|
2860
|
+
docs.self,
|
|
2861
|
+
docs.trailing_comments,
|
|
2862
|
+
" ",
|
|
2863
|
+
docs.expr,
|
|
2864
|
+
p.has("semicolon") ? softline : "",
|
|
2865
|
+
docs.semicolon,
|
|
2866
|
+
]),
|
|
2867
|
+
p.newLine(),
|
|
2868
|
+
];
|
|
2869
|
+
};
|
|
2641
2870
|
const printGrantStatement = (path, options, print, node) => {
|
|
2642
2871
|
const p = new Printer(path, options, print, node);
|
|
2643
2872
|
const docs = {
|
|
@@ -2663,7 +2892,7 @@ const printGrantStatement = (path, options, print, node) => {
|
|
|
2663
2892
|
docs.ident,
|
|
2664
2893
|
line,
|
|
2665
2894
|
group(docs.to),
|
|
2666
|
-
softline,
|
|
2895
|
+
p.has("semicolon") ? softline : "",
|
|
2667
2896
|
docs.semicolon,
|
|
2668
2897
|
]),
|
|
2669
2898
|
p.newLine(),
|
|
@@ -2704,13 +2933,13 @@ const printGroupedExpr = (path, options, print, node) => {
|
|
|
2704
2933
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2705
2934
|
expr: p.child("expr"),
|
|
2706
2935
|
rparen: p.child("rparen"),
|
|
2707
|
-
as: "",
|
|
2936
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2708
2937
|
alias: printAlias(path, options, print, node),
|
|
2709
2938
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2710
|
-
unpivot: "",
|
|
2711
|
-
with_offset: "",
|
|
2939
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2940
|
+
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2712
2941
|
order: printOrder(path, options, print, node),
|
|
2713
|
-
null_order: "",
|
|
2942
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2714
2943
|
comma: printComma(path, options, print, node),
|
|
2715
2944
|
};
|
|
2716
2945
|
return [
|
|
@@ -2789,15 +3018,15 @@ const printGroupedStatement = (path, options, print, node) => {
|
|
|
2789
3018
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2790
3019
|
stmt: p.child("stmt"),
|
|
2791
3020
|
rparen: p.child("rparen"),
|
|
2792
|
-
as: "",
|
|
3021
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2793
3022
|
alias: printAlias(path, options, print, node),
|
|
2794
3023
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2795
|
-
unpivot: "",
|
|
2796
|
-
with_offset: "",
|
|
3024
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3025
|
+
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2797
3026
|
orderby: p.child("orderby"),
|
|
2798
3027
|
limit: p.child("limit"),
|
|
2799
3028
|
order: printOrder(path, options, print, node),
|
|
2800
|
-
null_order: "",
|
|
3029
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2801
3030
|
comma: printComma(path, options, print, node),
|
|
2802
3031
|
semicolon: p.child("semicolon", undefined, "all"),
|
|
2803
3032
|
};
|
|
@@ -2876,15 +3105,15 @@ const printIdentifier = (path, options, print, node) => {
|
|
|
2876
3105
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
2877
3106
|
self: node.isPreDefinedFunction || node.isDatePart ? p.self("upper") : p.self(),
|
|
2878
3107
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2879
|
-
as: "",
|
|
3108
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2880
3109
|
alias: printAlias(path, options, print, node),
|
|
2881
3110
|
for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
|
|
2882
3111
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
2883
|
-
unpivot: "",
|
|
3112
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2884
3113
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
2885
3114
|
tablesample: p.child("tablesample", undefined, "all"),
|
|
2886
3115
|
order: printOrder(path, options, print, node),
|
|
2887
|
-
null_order: "",
|
|
3116
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2888
3117
|
comma: printComma(path, options, print, node),
|
|
2889
3118
|
};
|
|
2890
3119
|
return [
|
|
@@ -2946,7 +3175,7 @@ const printIfStatement = (path, options, print, node) => {
|
|
|
2946
3175
|
docs.else,
|
|
2947
3176
|
line,
|
|
2948
3177
|
docs.end_if,
|
|
2949
|
-
softline,
|
|
3178
|
+
p.has("semicolon") ? softline : "",
|
|
2950
3179
|
docs.semicolon,
|
|
2951
3180
|
]),
|
|
2952
3181
|
p.newLine(),
|
|
@@ -2956,16 +3185,16 @@ const printInOperator = (path, options, print, node) => {
|
|
|
2956
3185
|
const p = new Printer(path, options, print, node);
|
|
2957
3186
|
p.setNotRoot("right");
|
|
2958
3187
|
const docs = {
|
|
2959
|
-
leading_comments: "",
|
|
3188
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2960
3189
|
left: p.child("left"),
|
|
2961
3190
|
not: p.child("not"),
|
|
2962
3191
|
self: p.self("asItIs", true),
|
|
2963
3192
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
2964
3193
|
right: p.child("right", undefined, "all"),
|
|
2965
|
-
as: "",
|
|
3194
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2966
3195
|
alias: printAlias(path, options, print, node),
|
|
2967
3196
|
order: printOrder(path, options, print, node),
|
|
2968
|
-
null_order: "",
|
|
3197
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
2969
3198
|
comma: printComma(path, options, print, node),
|
|
2970
3199
|
};
|
|
2971
3200
|
return [
|
|
@@ -3006,7 +3235,7 @@ const printInsertStatement = (path, options, print, node) => {
|
|
|
3006
3235
|
docs.columns,
|
|
3007
3236
|
line,
|
|
3008
3237
|
docs.input,
|
|
3009
|
-
|
|
3238
|
+
p.has("semicolon") ? softline : "",
|
|
3010
3239
|
docs.semicolon,
|
|
3011
3240
|
]),
|
|
3012
3241
|
p.newLine(),
|
|
@@ -3022,7 +3251,7 @@ const printIntervalLiteral = (path, options, print, node) => {
|
|
|
3022
3251
|
date_part: p.child("date_part", undefined, "all"),
|
|
3023
3252
|
to: p.child("to", undefined, "all"),
|
|
3024
3253
|
to_date_part: p.child("to_date_part", undefined, "all"),
|
|
3025
|
-
as: "",
|
|
3254
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3026
3255
|
alias: printAlias(path, options, print, node),
|
|
3027
3256
|
comma: printComma(path, options, print, node),
|
|
3028
3257
|
};
|
|
@@ -3054,10 +3283,10 @@ const printIsDistinctFromOperator = (path, options, print, node) => {
|
|
|
3054
3283
|
distinct: p.child("distinct", undefined, "all"),
|
|
3055
3284
|
from: p.child("from", undefined, "all"),
|
|
3056
3285
|
right: p.child("right", undefined, "all"),
|
|
3057
|
-
as: "",
|
|
3286
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3058
3287
|
alias: printAlias(path, options, print, node),
|
|
3059
3288
|
order: printOrder(path, options, print, node),
|
|
3060
|
-
null_order: "",
|
|
3289
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3061
3290
|
comma: printComma(path, options, print, node),
|
|
3062
3291
|
};
|
|
3063
3292
|
return [
|
|
@@ -3088,7 +3317,7 @@ const printJoinOperator = (path, options, print, node) => {
|
|
|
3088
3317
|
p.setNotRoot("left");
|
|
3089
3318
|
p.setNotRoot("right");
|
|
3090
3319
|
const docs = {
|
|
3091
|
-
leading_comments: "",
|
|
3320
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3092
3321
|
left: p.child("left"),
|
|
3093
3322
|
join_type: p.child("join_type"),
|
|
3094
3323
|
outer: p.consumeAllCommentsOfX("outer"),
|
|
@@ -3097,10 +3326,10 @@ const printJoinOperator = (path, options, print, node) => {
|
|
|
3097
3326
|
right: p.child("right", undefined, "all"),
|
|
3098
3327
|
on: p.child("on", undefined, "all"),
|
|
3099
3328
|
using: p.child("using", undefined, "all"),
|
|
3100
|
-
as: "",
|
|
3329
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3101
3330
|
alias: printAlias(path, options, print, node),
|
|
3102
3331
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
3103
|
-
unpivot: "",
|
|
3332
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3104
3333
|
with_offset: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3105
3334
|
};
|
|
3106
3335
|
return [
|
|
@@ -3125,6 +3354,37 @@ const printJoinOperator = (path, options, print, node) => {
|
|
|
3125
3354
|
docs.pivot,
|
|
3126
3355
|
];
|
|
3127
3356
|
};
|
|
3357
|
+
const printJoinPipeOperator = (path, options, print, node) => {
|
|
3358
|
+
const p = new Printer(path, options, print, node);
|
|
3359
|
+
p.setNotRoot("exprs");
|
|
3360
|
+
p.setGroupRecommended("exprs");
|
|
3361
|
+
const docs = {
|
|
3362
|
+
method: p.child("method"),
|
|
3363
|
+
leading_comments: p.has("method")
|
|
3364
|
+
? ""
|
|
3365
|
+
: printLeadingComments(path, options, print, node),
|
|
3366
|
+
self: p.self("asItIs", p.has("method")),
|
|
3367
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3368
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
3369
|
+
exprs: p.child("exprs", (x) => group([line, x])),
|
|
3370
|
+
on: p.child("on"),
|
|
3371
|
+
using: p.child("using"),
|
|
3372
|
+
};
|
|
3373
|
+
return [
|
|
3374
|
+
docs.method,
|
|
3375
|
+
p.has("method") ? " " : "",
|
|
3376
|
+
docs.leading_comments,
|
|
3377
|
+
docs.self,
|
|
3378
|
+
docs.trailing_comments,
|
|
3379
|
+
p.has("keywords") ? " " : "",
|
|
3380
|
+
docs.keywords,
|
|
3381
|
+
indent(docs.exprs),
|
|
3382
|
+
p.has("on") ? line : "",
|
|
3383
|
+
docs.on,
|
|
3384
|
+
p.has("using") ? line : "",
|
|
3385
|
+
docs.using,
|
|
3386
|
+
];
|
|
3387
|
+
};
|
|
3128
3388
|
const printKeyword = (path, options, print, node) => {
|
|
3129
3389
|
const p = new Printer(path, options, print, node);
|
|
3130
3390
|
const docs = {
|
|
@@ -3260,6 +3520,29 @@ const printLimitClause = (path, options, print, node) => {
|
|
|
3260
3520
|
docs.offset,
|
|
3261
3521
|
];
|
|
3262
3522
|
};
|
|
3523
|
+
const printLimitPipeOperator = (path, options, print, node) => {
|
|
3524
|
+
const p = new Printer(path, options, print, node);
|
|
3525
|
+
p.setNotRoot("exprs");
|
|
3526
|
+
p.setGroupRecommended("exprs");
|
|
3527
|
+
const docs = {
|
|
3528
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
3529
|
+
self: p.self(),
|
|
3530
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3531
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
3532
|
+
exprs: p.child("exprs", (x) => group([line, x])),
|
|
3533
|
+
offset: p.child("offset"),
|
|
3534
|
+
};
|
|
3535
|
+
return [
|
|
3536
|
+
docs.leading_comments,
|
|
3537
|
+
docs.self,
|
|
3538
|
+
docs.trailing_comments,
|
|
3539
|
+
p.has("keywords") ? " " : "",
|
|
3540
|
+
docs.keywords,
|
|
3541
|
+
indent(docs.exprs),
|
|
3542
|
+
p.has("offset") ? line : "",
|
|
3543
|
+
docs.offset,
|
|
3544
|
+
];
|
|
3545
|
+
};
|
|
3263
3546
|
const printLoadStatement = (path, options, print, node) => {
|
|
3264
3547
|
const p = new Printer(path, options, print, node);
|
|
3265
3548
|
const docs = {
|
|
@@ -3318,7 +3601,7 @@ const printLoadStatement = (path, options, print, node) => {
|
|
|
3318
3601
|
docs.connection,
|
|
3319
3602
|
p.has("with") ? " " : "",
|
|
3320
3603
|
docs.connection_name,
|
|
3321
|
-
softline,
|
|
3604
|
+
p.has("semicolon") ? softline : "",
|
|
3322
3605
|
docs.semicolon,
|
|
3323
3606
|
]),
|
|
3324
3607
|
p.newLine(),
|
|
@@ -3361,7 +3644,7 @@ const printLoopStatement = (path, options, print, node) => {
|
|
|
3361
3644
|
docs.end_loop,
|
|
3362
3645
|
p.has("trailing_label") ? " " : "",
|
|
3363
3646
|
docs.trailing_label,
|
|
3364
|
-
softline,
|
|
3647
|
+
p.has("semicolon") ? softline : "",
|
|
3365
3648
|
docs.semicolon,
|
|
3366
3649
|
]),
|
|
3367
3650
|
p.newLine(),
|
|
@@ -3393,7 +3676,7 @@ const printMergeStatement = (path, options, print, node) => {
|
|
|
3393
3676
|
line,
|
|
3394
3677
|
docs.on,
|
|
3395
3678
|
docs.whens,
|
|
3396
|
-
softline,
|
|
3679
|
+
p.has("semicolon") ? softline : "",
|
|
3397
3680
|
docs.semicolon,
|
|
3398
3681
|
]),
|
|
3399
3682
|
p.newLine(),
|
|
@@ -3406,16 +3689,16 @@ const printMultiTokenIdentifier = (path, options, print, node) => {
|
|
|
3406
3689
|
self: p.self(),
|
|
3407
3690
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3408
3691
|
trailing_idents: p.child("trailing_idents", undefined, "all"),
|
|
3409
|
-
as: "",
|
|
3692
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3410
3693
|
alias: printAlias(path, options, print, node),
|
|
3411
3694
|
for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
|
|
3412
3695
|
pivot: printPivotOrUnpivotOperator(path, options, print, node),
|
|
3413
|
-
unpivot: "",
|
|
3696
|
+
unpivot: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3414
3697
|
with_offset: p.child("with_offset", undefined, "all"),
|
|
3415
3698
|
tablesample: p.child("tablesample", undefined, "all"),
|
|
3416
3699
|
// NOTE order, null_order, comma may be unnecessary for the time being.
|
|
3417
3700
|
order: printOrder(path, options, print, node),
|
|
3418
|
-
null_order: "",
|
|
3701
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3419
3702
|
comma: printComma(path, options, print, node),
|
|
3420
3703
|
};
|
|
3421
3704
|
return [
|
|
@@ -3439,10 +3722,10 @@ const printNullLiteral = (path, options, print, node) => {
|
|
|
3439
3722
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
3440
3723
|
self: p.self("upper"),
|
|
3441
3724
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3442
|
-
as: "",
|
|
3725
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3443
3726
|
alias: printAlias(path, options, print, node),
|
|
3444
3727
|
order: printOrder(path, options, print, node),
|
|
3445
|
-
null_order: "",
|
|
3728
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3446
3729
|
comma: printComma(path, options, print, node),
|
|
3447
3730
|
};
|
|
3448
3731
|
return [
|
|
@@ -3458,12 +3741,12 @@ const printNumericLiteral = (path, options, print, node) => {
|
|
|
3458
3741
|
const p = new Printer(path, options, print, node);
|
|
3459
3742
|
const docs = {
|
|
3460
3743
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
3461
|
-
self: p.self("lower"),
|
|
3744
|
+
self: p.self("lower"), // in the case of `3.14e10`
|
|
3462
3745
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3463
|
-
as: "",
|
|
3746
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3464
3747
|
alias: printAlias(path, options, print, node),
|
|
3465
3748
|
order: printOrder(path, options, print, node),
|
|
3466
|
-
null_order: "",
|
|
3749
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3467
3750
|
comma: printComma(path, options, print, node),
|
|
3468
3751
|
};
|
|
3469
3752
|
return [
|
|
@@ -3478,7 +3761,7 @@ const printNumericLiteral = (path, options, print, node) => {
|
|
|
3478
3761
|
const printOverClause = (path, options, print, node) => {
|
|
3479
3762
|
const p = new Printer(path, options, print, node);
|
|
3480
3763
|
const docs = {
|
|
3481
|
-
leading_comments: "",
|
|
3764
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3482
3765
|
self: p.self("upper", true),
|
|
3483
3766
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3484
3767
|
window: p.child("window", (x) => [" ", x], "all"),
|
|
@@ -3488,7 +3771,7 @@ const printOverClause = (path, options, print, node) => {
|
|
|
3488
3771
|
const printOverwritePartitionsClause = (path, options, print, node) => {
|
|
3489
3772
|
const p = new Printer(path, options, print, node);
|
|
3490
3773
|
const docs = {
|
|
3491
|
-
leading_comments: "",
|
|
3774
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3492
3775
|
overwrite: p.child("overwrite"),
|
|
3493
3776
|
self: p.self("upper", true),
|
|
3494
3777
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
@@ -3503,6 +3786,28 @@ const printOverwritePartitionsClause = (path, options, print, node) => {
|
|
|
3503
3786
|
docs.grouped_expr,
|
|
3504
3787
|
]);
|
|
3505
3788
|
};
|
|
3789
|
+
const printPipeStatement = (path, options, print, node) => {
|
|
3790
|
+
const p = new Printer(path, options, print, node);
|
|
3791
|
+
p.setNotRoot("left");
|
|
3792
|
+
p.setNotRoot("right");
|
|
3793
|
+
const docs = {
|
|
3794
|
+
left: p.child("left"),
|
|
3795
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
3796
|
+
self: p.self("upper"),
|
|
3797
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3798
|
+
right: p.child("right"),
|
|
3799
|
+
semicolon: p.child("semicolon"),
|
|
3800
|
+
};
|
|
3801
|
+
return [
|
|
3802
|
+
docs.left,
|
|
3803
|
+
hardline,
|
|
3804
|
+
docs.leading_comments,
|
|
3805
|
+
group([docs.self, docs.trailing_comments, indent([line, docs.right])]),
|
|
3806
|
+
p.has("semicolon") ? softline : "",
|
|
3807
|
+
docs.semicolon,
|
|
3808
|
+
p.newLine(),
|
|
3809
|
+
];
|
|
3810
|
+
};
|
|
3506
3811
|
const printPivotConfig = (path, options, print, node) => {
|
|
3507
3812
|
const p = new Printer(path, options, print, node);
|
|
3508
3813
|
const docs = {
|
|
@@ -3545,6 +3850,31 @@ const printPivotOperator = (path, options, print, node) => {
|
|
|
3545
3850
|
p.has("alias") ? [" ", docs.alias] : "",
|
|
3546
3851
|
];
|
|
3547
3852
|
};
|
|
3853
|
+
const printPivotPipeOperator = (path, options, print, node) => {
|
|
3854
|
+
const p = new Printer(path, options, print, node);
|
|
3855
|
+
const docs = {
|
|
3856
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
3857
|
+
self: p.self(),
|
|
3858
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3859
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
3860
|
+
config: p.child("config", undefined, "first"),
|
|
3861
|
+
as: p.child("as", undefined, "all"),
|
|
3862
|
+
alias: p.child("alias", undefined, "all"),
|
|
3863
|
+
};
|
|
3864
|
+
return [
|
|
3865
|
+
docs.leading_comments,
|
|
3866
|
+
docs.self,
|
|
3867
|
+
docs.trailing_comments,
|
|
3868
|
+
p.has("keywords") ? " " : "",
|
|
3869
|
+
docs.keywords,
|
|
3870
|
+
" ",
|
|
3871
|
+
docs.config,
|
|
3872
|
+
p.has("alias")
|
|
3873
|
+
? [" ", docs.as || (options.printKeywordsInUpperCase ? "AS" : "as")]
|
|
3874
|
+
: "",
|
|
3875
|
+
p.has("alias") ? [" ", docs.alias] : "",
|
|
3876
|
+
];
|
|
3877
|
+
};
|
|
3548
3878
|
const printRevokeStatement = (path, options, print, node) => {
|
|
3549
3879
|
const p = new Printer(path, options, print, node);
|
|
3550
3880
|
const docs = {
|
|
@@ -3570,7 +3900,7 @@ const printRevokeStatement = (path, options, print, node) => {
|
|
|
3570
3900
|
docs.ident,
|
|
3571
3901
|
line,
|
|
3572
3902
|
group(docs.from),
|
|
3573
|
-
softline,
|
|
3903
|
+
p.has("semicolon") ? softline : "",
|
|
3574
3904
|
docs.semicolon,
|
|
3575
3905
|
]),
|
|
3576
3906
|
p.newLine(),
|
|
@@ -3592,7 +3922,7 @@ const printRaiseStatement = (path, options, print, node) => {
|
|
|
3592
3922
|
docs.trailing_comments,
|
|
3593
3923
|
p.has("using") ? " " : "",
|
|
3594
3924
|
docs.using,
|
|
3595
|
-
softline,
|
|
3925
|
+
p.has("semicolon") ? softline : "",
|
|
3596
3926
|
docs.semicolon,
|
|
3597
3927
|
]),
|
|
3598
3928
|
p.newLine(),
|
|
@@ -3602,13 +3932,13 @@ const printRangeLiteral = (path, options, print, node) => {
|
|
|
3602
3932
|
const p = new Printer(path, options, print, node);
|
|
3603
3933
|
const docs = {
|
|
3604
3934
|
type: p.child("type"),
|
|
3605
|
-
leading_comments: "",
|
|
3935
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3606
3936
|
self: p.self("asItIs", true),
|
|
3607
3937
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3608
|
-
as: "",
|
|
3938
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3609
3939
|
alias: printAlias(path, options, print, node),
|
|
3610
3940
|
order: printOrder(path, options, print, node),
|
|
3611
|
-
null_order: "",
|
|
3941
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3612
3942
|
comma: printComma(path, options, print, node),
|
|
3613
3943
|
};
|
|
3614
3944
|
return [
|
|
@@ -3690,7 +4020,7 @@ const printRepeatStatement = (path, options, print, node) => {
|
|
|
3690
4020
|
docs.end_repeat,
|
|
3691
4021
|
p.has("trailing_label") ? " " : "",
|
|
3692
4022
|
docs.trailing_label,
|
|
3693
|
-
softline,
|
|
4023
|
+
p.has("semicolon") ? softline : "",
|
|
3694
4024
|
docs.semicolon,
|
|
3695
4025
|
]),
|
|
3696
4026
|
p.newLine(),
|
|
@@ -3791,14 +4121,19 @@ const printSetOperator = (path, options, print, node) => {
|
|
|
3791
4121
|
const docs = {
|
|
3792
4122
|
with: p.child("with"),
|
|
3793
4123
|
left: p.child("left"),
|
|
3794
|
-
|
|
3795
|
-
|
|
4124
|
+
method: p.child("method"),
|
|
4125
|
+
leading_comments: p.has("method")
|
|
4126
|
+
? ""
|
|
4127
|
+
: printLeadingComments(path, options, print, node),
|
|
4128
|
+
self: p.self("upper", p.has("method")),
|
|
3796
4129
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3797
4130
|
distinct_or_all: p.child("distinct_or_all", undefined, "all"),
|
|
4131
|
+
by: p.child("by", undefined, "all"),
|
|
4132
|
+
corresponding: p.child("corresponding", undefined, "all"),
|
|
3798
4133
|
right: p.child("right"),
|
|
3799
4134
|
semicolon: p.child("semicolon", undefined, "all"),
|
|
3800
4135
|
};
|
|
3801
|
-
|
|
4136
|
+
return [
|
|
3802
4137
|
docs.with,
|
|
3803
4138
|
p.has("with")
|
|
3804
4139
|
? options.printBlankLineAfterCte
|
|
@@ -3807,23 +4142,20 @@ const printSetOperator = (path, options, print, node) => {
|
|
|
3807
4142
|
: "",
|
|
3808
4143
|
docs.left,
|
|
3809
4144
|
line,
|
|
4145
|
+
p.has("method") ? [docs.method, " "] : "",
|
|
3810
4146
|
docs.leading_comments,
|
|
3811
4147
|
docs.self,
|
|
3812
4148
|
docs.trailing_comments,
|
|
3813
4149
|
" ",
|
|
3814
4150
|
docs.distinct_or_all,
|
|
4151
|
+
p.has("by") ? [" ", docs.by] : "",
|
|
4152
|
+
p.has("corresponding") ? [" ", docs.corresponding] : "",
|
|
3815
4153
|
line,
|
|
3816
4154
|
docs.right,
|
|
3817
4155
|
p.has("semicolon") ? softline : "",
|
|
3818
4156
|
docs.semicolon,
|
|
3819
4157
|
p.newLine(),
|
|
3820
4158
|
];
|
|
3821
|
-
if (node.notRoot) {
|
|
3822
|
-
return res;
|
|
3823
|
-
}
|
|
3824
|
-
else {
|
|
3825
|
-
return group(res);
|
|
3826
|
-
}
|
|
3827
4159
|
};
|
|
3828
4160
|
const printSetStatement = (path, options, print, node) => {
|
|
3829
4161
|
const p = new Printer(path, options, print, node);
|
|
@@ -3841,7 +4173,7 @@ const printSetStatement = (path, options, print, node) => {
|
|
|
3841
4173
|
docs.self,
|
|
3842
4174
|
docs.trailing_comments,
|
|
3843
4175
|
indent([line, docs.expr]),
|
|
3844
|
-
softline,
|
|
4176
|
+
p.has("semicolon") ? softline : "",
|
|
3845
4177
|
docs.semicolon,
|
|
3846
4178
|
]),
|
|
3847
4179
|
p.newLine(),
|
|
@@ -3869,10 +4201,10 @@ const printStringLiteral = (path, options, print, node) => {
|
|
|
3869
4201
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
3870
4202
|
self: p.self(),
|
|
3871
4203
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3872
|
-
as: "",
|
|
4204
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3873
4205
|
alias: printAlias(path, options, print, node),
|
|
3874
4206
|
order: printOrder(path, options, print, node),
|
|
3875
|
-
null_order: "",
|
|
4207
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3876
4208
|
comma: printComma(path, options, print, node),
|
|
3877
4209
|
};
|
|
3878
4210
|
return [
|
|
@@ -3896,10 +4228,10 @@ const printStructLiteral = (path, options, print, node) => {
|
|
|
3896
4228
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
3897
4229
|
exprs: p.child("exprs", (x) => group(x), "none", line),
|
|
3898
4230
|
rparen: p.child("rparen"),
|
|
3899
|
-
as: "",
|
|
4231
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3900
4232
|
alias: printAlias(path, options, print, node),
|
|
3901
4233
|
order: printOrder(path, options, print, node),
|
|
3902
|
-
null_order: "",
|
|
4234
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
3903
4235
|
comma: printComma(path, options, print, node),
|
|
3904
4236
|
};
|
|
3905
4237
|
return [
|
|
@@ -3947,6 +4279,26 @@ const printTableSampleClause = (path, options, print, node) => {
|
|
|
3947
4279
|
docs.group,
|
|
3948
4280
|
];
|
|
3949
4281
|
};
|
|
4282
|
+
// table sample
|
|
4283
|
+
const printTableSamplePipeOperator = (path, options, print, node) => {
|
|
4284
|
+
const p = new Printer(path, options, print, node);
|
|
4285
|
+
const docs = {
|
|
4286
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4287
|
+
self: p.self(),
|
|
4288
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4289
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
4290
|
+
group: p.child("group", undefined, "all"),
|
|
4291
|
+
};
|
|
4292
|
+
return [
|
|
4293
|
+
docs.leading_comments,
|
|
4294
|
+
docs.self,
|
|
4295
|
+
docs.trailing_comments,
|
|
4296
|
+
p.has("keywords") ? " " : "",
|
|
4297
|
+
docs.keywords,
|
|
4298
|
+
" ",
|
|
4299
|
+
docs.group,
|
|
4300
|
+
];
|
|
4301
|
+
};
|
|
3950
4302
|
const printTableSampleRatio = (path, options, print, node) => {
|
|
3951
4303
|
const p = new Printer(path, options, print, node);
|
|
3952
4304
|
const docs = {
|
|
@@ -4033,17 +4385,17 @@ const printType = (path, options, print, node) => {
|
|
|
4033
4385
|
leading_comments: printLeadingComments(path, options, print, node),
|
|
4034
4386
|
self: p.self("upper"),
|
|
4035
4387
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4036
|
-
type: p.child("type", undefined, "all"),
|
|
4037
|
-
type_declaration: p.child("type_declaration", undefined, "all"),
|
|
4038
|
-
parameter: p.child("parameter", undefined, "all"),
|
|
4039
|
-
collate: p.child("collate", undefined, "all"),
|
|
4040
|
-
constraint: p.child("constraint", undefined, "all"),
|
|
4041
|
-
primarykey: p.child("primarykey", undefined, "all"),
|
|
4042
|
-
references: p.child("references", undefined, "all"),
|
|
4043
|
-
enforced: p.child("enforced", undefined, "all"),
|
|
4044
|
-
not_null: p.child("not_null", (x) => group([line, x])),
|
|
4045
|
-
default: p.child("default", undefined, "all"),
|
|
4046
|
-
options: p.child("options", undefined, "all"),
|
|
4388
|
+
type: p.child("type", undefined, "all"), // INT64 | ARRAY
|
|
4389
|
+
type_declaration: p.child("type_declaration", undefined, "all"), // <INT64>
|
|
4390
|
+
parameter: p.child("parameter", undefined, "all"), // STRING(10)
|
|
4391
|
+
collate: p.child("collate", undefined, "all"), // DEFAUT COLLATE 'und:ci'
|
|
4392
|
+
constraint: p.child("constraint", undefined, "all"), // CONSTRAINT ident
|
|
4393
|
+
primarykey: p.child("primarykey", undefined, "all"), // PRIMARY KEY
|
|
4394
|
+
references: p.child("references", undefined, "all"), // REFERENCES tablename(col)
|
|
4395
|
+
enforced: p.child("enforced", undefined, "all"), // NOT ENFORCED
|
|
4396
|
+
not_null: p.child("not_null", (x) => group([line, x])), // NOT NULL
|
|
4397
|
+
default: p.child("default", undefined, "all"), // DEFAULT CURRENT_TIMESTAMP
|
|
4398
|
+
options: p.child("options", undefined, "all"), // OPTIONS()
|
|
4047
4399
|
aggregate: p.child("aggregate", (x) => group([line, x])), // NOT AGGREGATEj:w
|
|
4048
4400
|
};
|
|
4049
4401
|
return [
|
|
@@ -4075,7 +4427,7 @@ const printType = (path, options, print, node) => {
|
|
|
4075
4427
|
const printTypeDeclaration = (path, options, print, node) => {
|
|
4076
4428
|
const p = new Printer(path, options, print, node);
|
|
4077
4429
|
const docs = {
|
|
4078
|
-
leading_comments: "",
|
|
4430
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
4079
4431
|
in_out: p.child("in_out"),
|
|
4080
4432
|
self: p.self("asItIs", true),
|
|
4081
4433
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
@@ -4111,10 +4463,10 @@ const printUnaryOperator = (path, options, print, node) => {
|
|
|
4111
4463
|
self: p.includedIn(lowerCaseOperators) ? p.self("lower") : p.self("upper"),
|
|
4112
4464
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4113
4465
|
right: p.child("right", undefined, "all"),
|
|
4114
|
-
as: "",
|
|
4466
|
+
as: "", // eslint-disable-line unicorn/no-unused-properties
|
|
4115
4467
|
alias: printAlias(path, options, print, node),
|
|
4116
4468
|
order: printOrder(path, options, print, node),
|
|
4117
|
-
null_order: "",
|
|
4469
|
+
null_order: "", // eslint-disable-line unicorn/no-unused-properties
|
|
4118
4470
|
comma: printComma(path, options, print, node),
|
|
4119
4471
|
};
|
|
4120
4472
|
return [
|
|
@@ -4149,12 +4501,45 @@ const printUndropStatement = (path, options, print, node) => {
|
|
|
4149
4501
|
docs.if_not_exists,
|
|
4150
4502
|
" ",
|
|
4151
4503
|
docs.ident,
|
|
4152
|
-
softline,
|
|
4504
|
+
p.has("semicolon") ? softline : "",
|
|
4153
4505
|
docs.semicolon,
|
|
4154
4506
|
]),
|
|
4155
4507
|
p.newLine(),
|
|
4156
4508
|
];
|
|
4157
4509
|
};
|
|
4510
|
+
const printUnionPipeOperator = (path, options, print, node) => {
|
|
4511
|
+
const p = new Printer(path, options, print, node);
|
|
4512
|
+
p.setNotRoot("exprs");
|
|
4513
|
+
p.setGroupRecommended("exprs");
|
|
4514
|
+
if (node.children.exprs) {
|
|
4515
|
+
// trailing comma is allowed
|
|
4516
|
+
node.children.exprs.NodeVec[p.len("exprs") - 1].isFinalColumn = true;
|
|
4517
|
+
}
|
|
4518
|
+
const docs = {
|
|
4519
|
+
method: p.child("method"),
|
|
4520
|
+
leading_comments: p.has("method")
|
|
4521
|
+
? ""
|
|
4522
|
+
: printLeadingComments(path, options, print, node),
|
|
4523
|
+
self: p.self("asItIs", p.has("method")),
|
|
4524
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4525
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
4526
|
+
by: p.child("by", undefined, "all"),
|
|
4527
|
+
corresponding: p.child("corresponding", undefined, "all"),
|
|
4528
|
+
exprs: p.child("exprs", (x) => group([line, x])),
|
|
4529
|
+
};
|
|
4530
|
+
return [
|
|
4531
|
+
docs.method,
|
|
4532
|
+
p.has("method") ? " " : "",
|
|
4533
|
+
docs.leading_comments,
|
|
4534
|
+
docs.self,
|
|
4535
|
+
docs.trailing_comments,
|
|
4536
|
+
p.has("keywords") ? " " : "",
|
|
4537
|
+
docs.keywords,
|
|
4538
|
+
p.has("by") ? [" ", docs.by] : "",
|
|
4539
|
+
p.has("corresponding") ? [" ", docs.corresponding] : "",
|
|
4540
|
+
indent(docs.exprs),
|
|
4541
|
+
];
|
|
4542
|
+
};
|
|
4158
4543
|
const printUnpivotConfig = (path, options, print, node) => {
|
|
4159
4544
|
const p = new Printer(path, options, print, node);
|
|
4160
4545
|
const docs = {
|
|
@@ -4199,6 +4584,31 @@ const printUnpivotOperator = (path, options, print, node) => {
|
|
|
4199
4584
|
p.has("alias") ? [" ", docs.alias] : "",
|
|
4200
4585
|
];
|
|
4201
4586
|
};
|
|
4587
|
+
const printUnpivotPipeOperator = (path, options, print, node) => {
|
|
4588
|
+
const p = new Printer(path, options, print, node);
|
|
4589
|
+
const docs = {
|
|
4590
|
+
leading_comments: printLeadingComments(path, options, print, node),
|
|
4591
|
+
self: p.self(),
|
|
4592
|
+
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4593
|
+
keywords: p.child("keywords", undefined, "all"),
|
|
4594
|
+
config: p.child("config", undefined, "first"),
|
|
4595
|
+
as: p.child("as", undefined, "all"),
|
|
4596
|
+
alias: p.child("alias", undefined, "all"),
|
|
4597
|
+
};
|
|
4598
|
+
return [
|
|
4599
|
+
docs.leading_comments,
|
|
4600
|
+
docs.self,
|
|
4601
|
+
docs.trailing_comments,
|
|
4602
|
+
p.has("keywords") ? " " : "",
|
|
4603
|
+
docs.keywords,
|
|
4604
|
+
" ",
|
|
4605
|
+
docs.config,
|
|
4606
|
+
p.has("alias")
|
|
4607
|
+
? [" ", docs.as || (options.printKeywordsInUpperCase ? "AS" : "as")]
|
|
4608
|
+
: "",
|
|
4609
|
+
p.has("alias") ? [" ", docs.alias] : "",
|
|
4610
|
+
];
|
|
4611
|
+
};
|
|
4202
4612
|
const printUpdateStatement = (path, options, print, node) => {
|
|
4203
4613
|
const p = new Printer(path, options, print, node);
|
|
4204
4614
|
const docs = {
|
|
@@ -4224,7 +4634,7 @@ const printUpdateStatement = (path, options, print, node) => {
|
|
|
4224
4634
|
docs.from,
|
|
4225
4635
|
line,
|
|
4226
4636
|
docs.where,
|
|
4227
|
-
|
|
4637
|
+
p.has("semicolon") ? softline : "",
|
|
4228
4638
|
docs.semicolon,
|
|
4229
4639
|
]),
|
|
4230
4640
|
p.newLine(),
|
|
@@ -4302,7 +4712,7 @@ const printWhileStatement = (path, options, print, node) => {
|
|
|
4302
4712
|
docs.end_while,
|
|
4303
4713
|
p.has("trailing_label") ? " " : "",
|
|
4304
4714
|
docs.trailing_label,
|
|
4305
|
-
softline,
|
|
4715
|
+
p.has("semicolon") ? softline : "",
|
|
4306
4716
|
docs.semicolon,
|
|
4307
4717
|
]),
|
|
4308
4718
|
p.newLine(),
|
|
@@ -4376,7 +4786,7 @@ const printWindowSpecification = (path, options, print, node) => {
|
|
|
4376
4786
|
p.has("orderby") ||
|
|
4377
4787
|
p.has("frame"));
|
|
4378
4788
|
const docs = {
|
|
4379
|
-
leading_comments: "",
|
|
4789
|
+
leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
|
|
4380
4790
|
self: p.self("upper", true),
|
|
4381
4791
|
trailing_comments: printTrailingComments(path, options, print, node),
|
|
4382
4792
|
name: p.child("name"),
|