prettier-plugin-bq 0.2.57 → 0.2.59

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/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.default_collate,
945
- docs.options,
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,24 @@ 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;
1410
1524
  case "ML":
1411
1525
  if (keywords_1.mlFunctions.includes(func.token.literal.toUpperCase())) {
1412
1526
  func.isPreDefinedFunction = true;
1413
1527
  toUpper(parent.token);
1414
1528
  }
1415
1529
  break;
1530
+ case "AI":
1531
+ if (keywords_1.aiFunctions.includes(func.token.literal.toUpperCase())) {
1532
+ func.isPreDefinedFunction = true;
1533
+ toUpper(parent.token);
1534
+ }
1535
+ break;
1416
1536
  }
1417
1537
  }
1418
1538
  else if (parent.node_type === "DotOperator") {
@@ -1449,6 +1569,27 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1449
1569
  toUpper(grandParent.token);
1450
1570
  }
1451
1571
  break;
1572
+ case "KLL_QUANTILES":
1573
+ if (keywords_1.kllQuantilesFunctions.includes(func.token.literal.toUpperCase())) {
1574
+ func.isPreDefinedFunction = true;
1575
+ toUpper(parent.token);
1576
+ toUpper(grandParent.token);
1577
+ }
1578
+ break;
1579
+ case "ML":
1580
+ if (keywords_1.mlFunctions.includes(func.token.literal.toUpperCase())) {
1581
+ func.isPreDefinedFunction = true;
1582
+ toUpper(parent.token);
1583
+ toUpper(grandParent.token);
1584
+ }
1585
+ break;
1586
+ case "AI":
1587
+ if (keywords_1.aiFunctions.includes(func.token.literal.toUpperCase())) {
1588
+ func.isPreDefinedFunction = true;
1589
+ toUpper(parent.token);
1590
+ toUpper(grandParent.token);
1591
+ }
1592
+ break;
1452
1593
  }
1453
1594
  }
1454
1595
  }
@@ -1482,7 +1623,7 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1482
1623
  }
1483
1624
  }
1484
1625
  const docs = {
1485
- leading_comments: "",
1626
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
1486
1627
  func: p.child("func"),
1487
1628
  self: p.self("asItIs", true),
1488
1629
  trailing_comments: printTrailingComments(path, options, print, node),
@@ -1494,10 +1635,10 @@ const printCallingFunctionGeneral = (path, options, print, node) => {
1494
1635
  having: p.child("having"),
1495
1636
  rparen: p.child("rparen"),
1496
1637
  over: p.child("over", (x) => [" ", x], "all"),
1497
- as: "",
1638
+ as: "", // eslint-disable-line unicorn/no-unused-properties
1498
1639
  alias: printAlias(path, options, print, node),
1499
1640
  order: printOrder(path, options, print, node),
1500
- null_order: "",
1641
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
1501
1642
  comma: printComma(path, options, print, node),
1502
1643
  };
1503
1644
  // TODO
@@ -1548,8 +1689,8 @@ const printCallingTableFunction = (path, options, print, node) => {
1548
1689
  const docs = {
1549
1690
  self: printCallingFunctionGeneral(path, options, print, node),
1550
1691
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
1551
- unpivot: "",
1552
- with_offset: "",
1692
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
1693
+ with_offset: "", // eslint-disable-line unicorn/no-unused-properties
1553
1694
  /* eslint-disable unicorn/no-unused-properties */
1554
1695
  leading_comments: "",
1555
1696
  func: "",
@@ -1568,7 +1709,7 @@ const printCallingUnnest = (path, options, print, node) => {
1568
1709
  self: printCallingFunctionGeneral(path, options, print, node),
1569
1710
  with_offset: p.child("with_offset", undefined, "all"),
1570
1711
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
1571
- unpivot: "",
1712
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
1572
1713
  /* eslint-disable unicorn/no-unused-properties */
1573
1714
  leading_comments: "",
1574
1715
  func: "",
@@ -1602,7 +1743,7 @@ const printCallStatement = (path, options, print, node) => {
1602
1743
  docs.trailing_comments,
1603
1744
  " ",
1604
1745
  docs.procedure,
1605
- softline,
1746
+ p.has("semicolon") ? softline : "",
1606
1747
  docs.semicolon,
1607
1748
  ]),
1608
1749
  p.newLine(),
@@ -1617,10 +1758,10 @@ const printCaseExpr = (path, options, print, node) => {
1617
1758
  expr: p.child("expr", undefined, "all"),
1618
1759
  arms: p.child("arms", (x) => [line, group(x)], "none"),
1619
1760
  end: p.child("end"),
1620
- as: "",
1761
+ as: "", // eslint-disable-line unicorn/no-unused-properties
1621
1762
  alias: printAlias(path, options, print, node),
1622
1763
  order: printOrder(path, options, print, node),
1623
- null_order: "",
1764
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
1624
1765
  comma: printComma(path, options, print, node),
1625
1766
  };
1626
1767
  let res = [
@@ -1683,10 +1824,61 @@ const printCaseExprArm = (path, options, print, node) => {
1683
1824
  ];
1684
1825
  }
1685
1826
  };
1827
+ const printCaseStatement = (path, options, print, node) => {
1828
+ const p = new Printer(path, options, print, node);
1829
+ const docs = {
1830
+ leading_comments: printLeadingComments(path, options, print, node),
1831
+ self: p.self(),
1832
+ trailing_comments: printTrailingComments(path, options, print, node),
1833
+ expr: p.child("expr", undefined, "all"),
1834
+ arms: p.child("arms", (x) => [line, group(x)]),
1835
+ end_case: group(p.child("end_case", undefined, "none", line)),
1836
+ semicolon: p.child("semicolon"),
1837
+ };
1838
+ return [
1839
+ docs.leading_comments,
1840
+ group([
1841
+ docs.self,
1842
+ docs.trailing_comments,
1843
+ p.has("expr") ? " " : "",
1844
+ docs.expr,
1845
+ indent(docs.arms),
1846
+ line,
1847
+ docs.end_case,
1848
+ p.has("semicolon") ? softline : "",
1849
+ docs.semicolon,
1850
+ ]),
1851
+ p.newLine(),
1852
+ ];
1853
+ };
1854
+ const printCaseStatementArm = (path, options, print, node) => {
1855
+ const p = new Printer(path, options, print, node);
1856
+ p.setNotRoot("stmts");
1857
+ const docs = {
1858
+ leading_comments: printLeadingComments(path, options, print, node),
1859
+ self: p.self(),
1860
+ trailing_comments: printTrailingComments(path, options, print, node),
1861
+ expr: p.child("expr", undefined, "all"),
1862
+ then: p.child("then", undefined, "all"),
1863
+ stmts: p.child("stmts", (x) => [hardline, group(x)]),
1864
+ };
1865
+ return [
1866
+ docs.leading_comments,
1867
+ group([
1868
+ docs.self,
1869
+ docs.trailing_comments,
1870
+ p.has("expr") ? " " : "",
1871
+ docs.expr,
1872
+ p.has("then") ? " " : "",
1873
+ docs.then,
1874
+ indent([docs.stmts]),
1875
+ ]),
1876
+ ];
1877
+ };
1686
1878
  const printCastArgument = (path, options, print, node) => {
1687
1879
  const p = new Printer(path, options, print, node);
1688
1880
  const docs = {
1689
- leading_comments: "",
1881
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
1690
1882
  cast_from: p.child("cast_from"),
1691
1883
  self: p.self("upper", true),
1692
1884
  trailing_comments: printTrailingComments(path, options, print, node),
@@ -1738,7 +1930,7 @@ const printComment = (path, options, print, node) => {
1738
1930
  formattedRows.push(" " + lastRow.slice(-2));
1739
1931
  }
1740
1932
  else {
1741
- formattedRows.push(" " + lastRow.slice(-2)); // eslint-disable-line @typescript-eslint/no-non-null-assertion
1933
+ formattedRows.push(" " + lastRow.slice(-2));
1742
1934
  }
1743
1935
  token.literal = formattedRows.join("\n");
1744
1936
  }
@@ -1750,16 +1942,16 @@ const printComment = (path, options, print, node) => {
1750
1942
  const printConstraint = (path, options, print, node) => {
1751
1943
  const p = new Printer(path, options, print, node);
1752
1944
  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),
1945
+ constraint: p.child("constraint", undefined, "all"), // CONSTRAINT
1946
+ if_not_exists: p.child("if_not_exists", (x) => group([line, x]), "all"), // IF NOT EXISTS
1947
+ ident: p.child("ident", undefined, "all"), // ident
1948
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
1949
+ self: p.self("upper", true), // PRIMARY | FOREIGN
1758
1950
  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"),
1951
+ key: p.child("key", undefined, "all"), // KEY
1952
+ columns: p.child("columns", undefined, "all"), // (col)
1953
+ references: p.child("references", undefined, "all"), // REFERENCES tablename(col)
1954
+ enforced: p.child("enforced", undefined, "all"), // NOT ENFORCED
1763
1955
  comma: p.child("comma", undefined, "all"),
1764
1956
  };
1765
1957
  return [
@@ -1796,9 +1988,10 @@ const printCreateFunctionStatement = (path, options, print, node) => {
1796
1988
  ident: p.child("ident", undefined, "all"),
1797
1989
  group: p.child("group", undefined, "all"),
1798
1990
  returns: p.child("returns"),
1799
- remote: p.child("remote"),
1800
1991
  determinism: group(p.child("determinism", undefined, "none", line)),
1801
1992
  language: p.child("language"),
1993
+ remote: p.child("remote"),
1994
+ connection: p.child("connection", undefined, p.has("remote") ? "all" : "none"),
1802
1995
  options: p.child("options"),
1803
1996
  as: p.child("as"),
1804
1997
  semicolon: p.child("semicolon"),
@@ -1825,17 +2018,18 @@ const printCreateFunctionStatement = (path, options, print, node) => {
1825
2018
  ]),
1826
2019
  p.has("returns") ? line : "",
1827
2020
  docs.returns,
1828
- p.has("remote") ? line : "",
1829
- docs.remote,
1830
2021
  p.has("determinism") ? line : "",
1831
2022
  docs.determinism,
1832
2023
  p.has("language") ? line : "",
1833
2024
  docs.language,
2025
+ p.has("remote") || p.has("connection")
2026
+ ? [line, docs.remote, p.has("remote") ? " " : "", docs.connection]
2027
+ : "",
1834
2028
  p.has("options") ? line : "",
1835
2029
  docs.options,
1836
2030
  p.has("as") ? line : "",
1837
2031
  docs.as,
1838
- softline,
2032
+ p.has("semicolon") ? softline : "",
1839
2033
  docs.semicolon,
1840
2034
  ]),
1841
2035
  p.newLine(),
@@ -1885,7 +2079,7 @@ const printCreateModelStatement = (path, options, print, node) => {
1885
2079
  docs.query,
1886
2080
  p.has("training_data_custom_holiday") ? line : "",
1887
2081
  docs.training_data_custom_holiday,
1888
- softline,
2082
+ p.has("semicolon") ? softline : "",
1889
2083
  docs.semicolon,
1890
2084
  ]),
1891
2085
  p.newLine(),
@@ -1937,7 +2131,7 @@ const printCreateProcedureStatement = (path, options, print, node) => {
1937
2131
  docs.stmt,
1938
2132
  p.has("as") ? line : "",
1939
2133
  docs.as,
1940
- softline,
2134
+ p.has("semicolon") ? softline : "",
1941
2135
  docs.semicolon,
1942
2136
  ]),
1943
2137
  p.newLine(),
@@ -1973,7 +2167,7 @@ const printCreateReservationStatement = (path, options, print, node) => {
1973
2167
  p.has("json_string") ? " " : "",
1974
2168
  docs.json_string,
1975
2169
  docs.options,
1976
- softline,
2170
+ p.has("semicolon") ? softline : "",
1977
2171
  docs.semicolon,
1978
2172
  ]),
1979
2173
  p.newLine(),
@@ -2017,7 +2211,7 @@ const printCreateRowAccessPolicyStatement = (path, options, print, node) => {
2017
2211
  docs.filter,
2018
2212
  " ",
2019
2213
  docs.using,
2020
- softline,
2214
+ p.has("semicolon") ? softline : "",
2021
2215
  docs.semicolon,
2022
2216
  ]),
2023
2217
  p.newLine(),
@@ -2029,10 +2223,12 @@ const printCreateSchemaStatement = (path, options, print, node) => {
2029
2223
  leading_comments: printLeadingComments(path, options, print, node),
2030
2224
  self: p.self("upper"),
2031
2225
  trailing_comments: printTrailingComments(path, options, print, node),
2226
+ external: p.child("external", undefined, "all"),
2032
2227
  what: p.child("what", undefined, "all"),
2033
2228
  if_not_exists: p.child("if_not_exists", (x) => group([line, x])),
2034
2229
  ident: p.child("ident", undefined, "all"),
2035
2230
  default_collate: p.child("default_collate"),
2231
+ with_connection: p.child("with_connection"),
2036
2232
  options: p.child("options"),
2037
2233
  semicolon: p.child("semicolon"),
2038
2234
  };
@@ -2041,6 +2237,8 @@ const printCreateSchemaStatement = (path, options, print, node) => {
2041
2237
  group([
2042
2238
  docs.self,
2043
2239
  docs.trailing_comments,
2240
+ p.has("external") ? " " : "",
2241
+ docs.external,
2044
2242
  " ",
2045
2243
  docs.what,
2046
2244
  docs.if_not_exists,
@@ -2048,9 +2246,11 @@ const printCreateSchemaStatement = (path, options, print, node) => {
2048
2246
  docs.ident,
2049
2247
  p.has("default_collate") ? line : "",
2050
2248
  docs.default_collate,
2249
+ p.has("with_connection") ? line : "",
2250
+ docs.with_connection,
2051
2251
  p.has("options") ? line : "",
2052
2252
  docs.options,
2053
- softline,
2253
+ p.has("semicolon") ? softline : "",
2054
2254
  docs.semicolon,
2055
2255
  ]),
2056
2256
  p.newLine(),
@@ -2094,7 +2294,7 @@ const printCreateIndexStatement = (path, options, print, node) => {
2094
2294
  docs.storing,
2095
2295
  p.has("options") ? line : "",
2096
2296
  docs.options,
2097
- softline,
2297
+ p.has("semicolon") ? softline : "",
2098
2298
  docs.semicolon,
2099
2299
  ]),
2100
2300
  p.newLine(),
@@ -2166,7 +2366,7 @@ const printCreateTableStatement = (path, options, print, node) => {
2166
2366
  docs.options,
2167
2367
  p.has("as") ? line : "",
2168
2368
  docs.as,
2169
- softline,
2369
+ p.has("semicolon") ? softline : "",
2170
2370
  docs.semicolon,
2171
2371
  ]),
2172
2372
  p.newLine(),
@@ -2213,7 +2413,7 @@ const printCreateViewStatement = (path, options, print, node) => {
2213
2413
  docs.options,
2214
2414
  line,
2215
2415
  docs.as,
2216
- softline,
2416
+ p.has("semicolon") ? softline : "",
2217
2417
  docs.semicolon,
2218
2418
  ]),
2219
2419
  p.newLine(),
@@ -2240,7 +2440,7 @@ const printDeclareStatement = (path, options, print, node) => {
2240
2440
  docs.variable_type,
2241
2441
  p.has("default") ? line : "",
2242
2442
  docs.default,
2243
- softline,
2443
+ p.has("semicolon") ? softline : "",
2244
2444
  docs.semicolon,
2245
2445
  ]),
2246
2446
  p.newLine(),
@@ -2267,7 +2467,7 @@ const printDeleteStatement = (path, options, print, node) => {
2267
2467
  docs.table_name,
2268
2468
  line,
2269
2469
  docs.where,
2270
- softline,
2470
+ p.has("semicolon") ? softline : "",
2271
2471
  docs.semicolon,
2272
2472
  ]),
2273
2473
  p.newLine(),
@@ -2298,20 +2498,20 @@ const printDotOperator = (path, options, print, node) => {
2298
2498
  const p = new Printer(path, options, print, node);
2299
2499
  p.setNotGlobal("right");
2300
2500
  const docs = {
2301
- leading_comments: "",
2501
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
2302
2502
  left: p.child("left"),
2303
2503
  self: p.self("upper", true),
2304
2504
  trailing_comments: printTrailingComments(path, options, print, node),
2305
2505
  right: p.child("right", undefined, "all"),
2306
- as: "",
2506
+ as: "", // eslint-disable-line unicorn/no-unused-properties
2307
2507
  alias: printAlias(path, options, print, node),
2308
2508
  for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
2309
2509
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
2310
- unpivot: "",
2510
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
2311
2511
  with_offset: p.child("with_offset", undefined, "all"),
2312
2512
  tablesample: p.child("tablesample", undefined, "all"),
2313
2513
  order: printOrder(path, options, print, node),
2314
- null_order: "",
2514
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
2315
2515
  comma: printComma(path, options, print, node),
2316
2516
  };
2317
2517
  return [
@@ -2353,7 +2553,7 @@ const printDropRowAccessPolicyStatement = (path, options, print, node) => {
2353
2553
  docs.ident,
2354
2554
  line,
2355
2555
  docs.on,
2356
- softline,
2556
+ p.has("semicolon") ? softline : "",
2357
2557
  docs.semicolon,
2358
2558
  ]),
2359
2559
  p.newLine(),
@@ -2395,7 +2595,7 @@ const printDropStatement = (path, options, print, node) => {
2395
2595
  docs.on,
2396
2596
  p.has("cascade_or_restrict") ? " " : "",
2397
2597
  docs.cascade_or_restrict,
2398
- softline,
2598
+ p.has("semicolon") ? softline : "",
2399
2599
  docs.semicolon,
2400
2600
  ]),
2401
2601
  p.newLine(),
@@ -2427,10 +2627,10 @@ const printEmptyStruct = (path, options, print, node) => {
2427
2627
  self: p.self(),
2428
2628
  trailing_comments: printTrailingComments(path, options, print, node),
2429
2629
  rparen: p.child("rparen"),
2430
- as: "",
2630
+ as: "", // eslint-disable-line unicorn/no-unused-properties
2431
2631
  alias: printAlias(path, options, print, node),
2432
2632
  order: printOrder(path, options, print, node),
2433
- null_order: "",
2633
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
2434
2634
  comma: printComma(path, options, print, node),
2435
2635
  };
2436
2636
  return [
@@ -2475,7 +2675,7 @@ const printExecuteStatement = (path, options, print, node) => {
2475
2675
  docs.into,
2476
2676
  p.has("using") ? line : "",
2477
2677
  docs.using,
2478
- softline,
2678
+ p.has("semicolon") ? softline : "",
2479
2679
  docs.semicolon,
2480
2680
  ]),
2481
2681
  p.newLine(),
@@ -2506,7 +2706,7 @@ const printExportDataStatement = (path, options, print, node) => {
2506
2706
  docs.options,
2507
2707
  line,
2508
2708
  docs.as,
2509
- softline,
2709
+ p.has("semicolon") ? softline : "",
2510
2710
  docs.semicolon,
2511
2711
  ]),
2512
2712
  p.newLine(),
@@ -2534,7 +2734,7 @@ const printExportModelStatement = (path, options, print, node) => {
2534
2734
  docs.ident,
2535
2735
  line,
2536
2736
  docs.options,
2537
- softline,
2737
+ p.has("semicolon") ? softline : "",
2538
2738
  docs.semicolon,
2539
2739
  ]),
2540
2740
  p.newLine(),
@@ -2544,7 +2744,7 @@ const printExtractArgument = (path, options, print, node) => {
2544
2744
  const p = new Printer(path, options, print, node);
2545
2745
  node.children.extract_datepart.Node.isDatePart = true;
2546
2746
  const docs = {
2547
- leading_comments: "",
2747
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
2548
2748
  extract_datepart: p.child("extract_datepart"),
2549
2749
  self: p.self("upper", true),
2550
2750
  trailing_comments: printTrailingComments(path, options, print, node),
@@ -2608,7 +2808,7 @@ const printForStatement = (path, options, print, node) => {
2608
2808
  docs.end_for,
2609
2809
  p.has("trailing_label") ? " " : "",
2610
2810
  docs.trailing_label,
2611
- softline,
2811
+ p.has("semicolon") ? softline : "",
2612
2812
  docs.semicolon,
2613
2813
  ]),
2614
2814
  p.newLine(),
@@ -2632,6 +2832,28 @@ const printForSystemTimeAsOfclause = (path, options, print, node) => {
2632
2832
  docs.expr,
2633
2833
  ];
2634
2834
  };
2835
+ const printFromStatement = (path, options, print, node) => {
2836
+ const p = new Printer(path, options, print, node);
2837
+ const docs = {
2838
+ leading_comments: printLeadingComments(path, options, print, node),
2839
+ self: p.self("upper"),
2840
+ trailing_comments: printTrailingComments(path, options, print, node),
2841
+ expr: p.child("expr", undefined, "first"),
2842
+ semicolon: p.child("semicolon"),
2843
+ };
2844
+ return [
2845
+ docs.leading_comments,
2846
+ group([
2847
+ docs.self,
2848
+ docs.trailing_comments,
2849
+ " ",
2850
+ docs.expr,
2851
+ p.has("semicolon") ? softline : "",
2852
+ docs.semicolon,
2853
+ ]),
2854
+ p.newLine(),
2855
+ ];
2856
+ };
2635
2857
  const printGrantStatement = (path, options, print, node) => {
2636
2858
  const p = new Printer(path, options, print, node);
2637
2859
  const docs = {
@@ -2657,7 +2879,7 @@ const printGrantStatement = (path, options, print, node) => {
2657
2879
  docs.ident,
2658
2880
  line,
2659
2881
  group(docs.to),
2660
- softline,
2882
+ p.has("semicolon") ? softline : "",
2661
2883
  docs.semicolon,
2662
2884
  ]),
2663
2885
  p.newLine(),
@@ -2698,13 +2920,13 @@ const printGroupedExpr = (path, options, print, node) => {
2698
2920
  trailing_comments: printTrailingComments(path, options, print, node),
2699
2921
  expr: p.child("expr"),
2700
2922
  rparen: p.child("rparen"),
2701
- as: "",
2923
+ as: "", // eslint-disable-line unicorn/no-unused-properties
2702
2924
  alias: printAlias(path, options, print, node),
2703
2925
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
2704
- unpivot: "",
2705
- with_offset: "",
2926
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
2927
+ with_offset: "", // eslint-disable-line unicorn/no-unused-properties
2706
2928
  order: printOrder(path, options, print, node),
2707
- null_order: "",
2929
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
2708
2930
  comma: printComma(path, options, print, node),
2709
2931
  };
2710
2932
  return [
@@ -2783,15 +3005,15 @@ const printGroupedStatement = (path, options, print, node) => {
2783
3005
  trailing_comments: printTrailingComments(path, options, print, node),
2784
3006
  stmt: p.child("stmt"),
2785
3007
  rparen: p.child("rparen"),
2786
- as: "",
3008
+ as: "", // eslint-disable-line unicorn/no-unused-properties
2787
3009
  alias: printAlias(path, options, print, node),
2788
3010
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
2789
- unpivot: "",
2790
- with_offset: "",
3011
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
3012
+ with_offset: "", // eslint-disable-line unicorn/no-unused-properties
2791
3013
  orderby: p.child("orderby"),
2792
3014
  limit: p.child("limit"),
2793
3015
  order: printOrder(path, options, print, node),
2794
- null_order: "",
3016
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
2795
3017
  comma: printComma(path, options, print, node),
2796
3018
  semicolon: p.child("semicolon", undefined, "all"),
2797
3019
  };
@@ -2870,15 +3092,15 @@ const printIdentifier = (path, options, print, node) => {
2870
3092
  leading_comments: printLeadingComments(path, options, print, node),
2871
3093
  self: node.isPreDefinedFunction || node.isDatePart ? p.self("upper") : p.self(),
2872
3094
  trailing_comments: printTrailingComments(path, options, print, node),
2873
- as: "",
3095
+ as: "", // eslint-disable-line unicorn/no-unused-properties
2874
3096
  alias: printAlias(path, options, print, node),
2875
3097
  for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
2876
3098
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
2877
- unpivot: "",
3099
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
2878
3100
  with_offset: p.child("with_offset", undefined, "all"),
2879
3101
  tablesample: p.child("tablesample", undefined, "all"),
2880
3102
  order: printOrder(path, options, print, node),
2881
- null_order: "",
3103
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
2882
3104
  comma: printComma(path, options, print, node),
2883
3105
  };
2884
3106
  return [
@@ -2940,7 +3162,7 @@ const printIfStatement = (path, options, print, node) => {
2940
3162
  docs.else,
2941
3163
  line,
2942
3164
  docs.end_if,
2943
- softline,
3165
+ p.has("semicolon") ? softline : "",
2944
3166
  docs.semicolon,
2945
3167
  ]),
2946
3168
  p.newLine(),
@@ -2950,16 +3172,16 @@ const printInOperator = (path, options, print, node) => {
2950
3172
  const p = new Printer(path, options, print, node);
2951
3173
  p.setNotRoot("right");
2952
3174
  const docs = {
2953
- leading_comments: "",
3175
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
2954
3176
  left: p.child("left"),
2955
3177
  not: p.child("not"),
2956
3178
  self: p.self("asItIs", true),
2957
3179
  trailing_comments: printTrailingComments(path, options, print, node),
2958
3180
  right: p.child("right", undefined, "all"),
2959
- as: "",
3181
+ as: "", // eslint-disable-line unicorn/no-unused-properties
2960
3182
  alias: printAlias(path, options, print, node),
2961
3183
  order: printOrder(path, options, print, node),
2962
- null_order: "",
3184
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
2963
3185
  comma: printComma(path, options, print, node),
2964
3186
  };
2965
3187
  return [
@@ -3000,7 +3222,7 @@ const printInsertStatement = (path, options, print, node) => {
3000
3222
  docs.columns,
3001
3223
  line,
3002
3224
  docs.input,
3003
- node.notRoot ? "" : softline,
3225
+ p.has("semicolon") ? softline : "",
3004
3226
  docs.semicolon,
3005
3227
  ]),
3006
3228
  p.newLine(),
@@ -3016,7 +3238,7 @@ const printIntervalLiteral = (path, options, print, node) => {
3016
3238
  date_part: p.child("date_part", undefined, "all"),
3017
3239
  to: p.child("to", undefined, "all"),
3018
3240
  to_date_part: p.child("to_date_part", undefined, "all"),
3019
- as: "",
3241
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3020
3242
  alias: printAlias(path, options, print, node),
3021
3243
  comma: printComma(path, options, print, node),
3022
3244
  };
@@ -3048,10 +3270,10 @@ const printIsDistinctFromOperator = (path, options, print, node) => {
3048
3270
  distinct: p.child("distinct", undefined, "all"),
3049
3271
  from: p.child("from", undefined, "all"),
3050
3272
  right: p.child("right", undefined, "all"),
3051
- as: "",
3273
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3052
3274
  alias: printAlias(path, options, print, node),
3053
3275
  order: printOrder(path, options, print, node),
3054
- null_order: "",
3276
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3055
3277
  comma: printComma(path, options, print, node),
3056
3278
  };
3057
3279
  return [
@@ -3082,7 +3304,7 @@ const printJoinOperator = (path, options, print, node) => {
3082
3304
  p.setNotRoot("left");
3083
3305
  p.setNotRoot("right");
3084
3306
  const docs = {
3085
- leading_comments: "",
3307
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
3086
3308
  left: p.child("left"),
3087
3309
  join_type: p.child("join_type"),
3088
3310
  outer: p.consumeAllCommentsOfX("outer"),
@@ -3091,10 +3313,10 @@ const printJoinOperator = (path, options, print, node) => {
3091
3313
  right: p.child("right", undefined, "all"),
3092
3314
  on: p.child("on", undefined, "all"),
3093
3315
  using: p.child("using", undefined, "all"),
3094
- as: "",
3316
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3095
3317
  alias: printAlias(path, options, print, node),
3096
3318
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
3097
- unpivot: "",
3319
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
3098
3320
  with_offset: "", // eslint-disable-line unicorn/no-unused-properties
3099
3321
  };
3100
3322
  return [
@@ -3119,6 +3341,37 @@ const printJoinOperator = (path, options, print, node) => {
3119
3341
  docs.pivot,
3120
3342
  ];
3121
3343
  };
3344
+ const printJoinPipeOperator = (path, options, print, node) => {
3345
+ const p = new Printer(path, options, print, node);
3346
+ p.setNotRoot("exprs");
3347
+ p.setGroupRecommended("exprs");
3348
+ const docs = {
3349
+ method: p.child("method"),
3350
+ leading_comments: p.has("method")
3351
+ ? ""
3352
+ : printLeadingComments(path, options, print, node),
3353
+ self: p.self("asItIs", p.has("method")),
3354
+ trailing_comments: printTrailingComments(path, options, print, node),
3355
+ keywords: p.child("keywords", undefined, "all"),
3356
+ exprs: p.child("exprs", (x) => group([line, x])),
3357
+ on: p.child("on"),
3358
+ using: p.child("using"),
3359
+ };
3360
+ return [
3361
+ docs.method,
3362
+ p.has("method") ? " " : "",
3363
+ docs.leading_comments,
3364
+ docs.self,
3365
+ docs.trailing_comments,
3366
+ p.has("keywords") ? " " : "",
3367
+ docs.keywords,
3368
+ indent(docs.exprs),
3369
+ p.has("on") ? line : "",
3370
+ docs.on,
3371
+ p.has("using") ? line : "",
3372
+ docs.using,
3373
+ ];
3374
+ };
3122
3375
  const printKeyword = (path, options, print, node) => {
3123
3376
  const p = new Printer(path, options, print, node);
3124
3377
  const docs = {
@@ -3254,6 +3507,29 @@ const printLimitClause = (path, options, print, node) => {
3254
3507
  docs.offset,
3255
3508
  ];
3256
3509
  };
3510
+ const printLimitPipeOperator = (path, options, print, node) => {
3511
+ const p = new Printer(path, options, print, node);
3512
+ p.setNotRoot("exprs");
3513
+ p.setGroupRecommended("exprs");
3514
+ const docs = {
3515
+ leading_comments: printLeadingComments(path, options, print, node),
3516
+ self: p.self(),
3517
+ trailing_comments: printTrailingComments(path, options, print, node),
3518
+ keywords: p.child("keywords", undefined, "all"),
3519
+ exprs: p.child("exprs", (x) => group([line, x])),
3520
+ offset: p.child("offset"),
3521
+ };
3522
+ return [
3523
+ docs.leading_comments,
3524
+ docs.self,
3525
+ docs.trailing_comments,
3526
+ p.has("keywords") ? " " : "",
3527
+ docs.keywords,
3528
+ indent(docs.exprs),
3529
+ p.has("offset") ? line : "",
3530
+ docs.offset,
3531
+ ];
3532
+ };
3257
3533
  const printLoadStatement = (path, options, print, node) => {
3258
3534
  const p = new Printer(path, options, print, node);
3259
3535
  const docs = {
@@ -3312,7 +3588,7 @@ const printLoadStatement = (path, options, print, node) => {
3312
3588
  docs.connection,
3313
3589
  p.has("with") ? " " : "",
3314
3590
  docs.connection_name,
3315
- softline,
3591
+ p.has("semicolon") ? softline : "",
3316
3592
  docs.semicolon,
3317
3593
  ]),
3318
3594
  p.newLine(),
@@ -3355,7 +3631,7 @@ const printLoopStatement = (path, options, print, node) => {
3355
3631
  docs.end_loop,
3356
3632
  p.has("trailing_label") ? " " : "",
3357
3633
  docs.trailing_label,
3358
- softline,
3634
+ p.has("semicolon") ? softline : "",
3359
3635
  docs.semicolon,
3360
3636
  ]),
3361
3637
  p.newLine(),
@@ -3387,7 +3663,7 @@ const printMergeStatement = (path, options, print, node) => {
3387
3663
  line,
3388
3664
  docs.on,
3389
3665
  docs.whens,
3390
- softline,
3666
+ p.has("semicolon") ? softline : "",
3391
3667
  docs.semicolon,
3392
3668
  ]),
3393
3669
  p.newLine(),
@@ -3400,16 +3676,16 @@ const printMultiTokenIdentifier = (path, options, print, node) => {
3400
3676
  self: p.self(),
3401
3677
  trailing_comments: printTrailingComments(path, options, print, node),
3402
3678
  trailing_idents: p.child("trailing_idents", undefined, "all"),
3403
- as: "",
3679
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3404
3680
  alias: printAlias(path, options, print, node),
3405
3681
  for_system_time_as_of: p.child("for_system_time_as_of", undefined, "all"),
3406
3682
  pivot: printPivotOrUnpivotOperator(path, options, print, node),
3407
- unpivot: "",
3683
+ unpivot: "", // eslint-disable-line unicorn/no-unused-properties
3408
3684
  with_offset: p.child("with_offset", undefined, "all"),
3409
3685
  tablesample: p.child("tablesample", undefined, "all"),
3410
3686
  // NOTE order, null_order, comma may be unnecessary for the time being.
3411
3687
  order: printOrder(path, options, print, node),
3412
- null_order: "",
3688
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3413
3689
  comma: printComma(path, options, print, node),
3414
3690
  };
3415
3691
  return [
@@ -3433,10 +3709,10 @@ const printNullLiteral = (path, options, print, node) => {
3433
3709
  leading_comments: printLeadingComments(path, options, print, node),
3434
3710
  self: p.self("upper"),
3435
3711
  trailing_comments: printTrailingComments(path, options, print, node),
3436
- as: "",
3712
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3437
3713
  alias: printAlias(path, options, print, node),
3438
3714
  order: printOrder(path, options, print, node),
3439
- null_order: "",
3715
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3440
3716
  comma: printComma(path, options, print, node),
3441
3717
  };
3442
3718
  return [
@@ -3452,12 +3728,12 @@ const printNumericLiteral = (path, options, print, node) => {
3452
3728
  const p = new Printer(path, options, print, node);
3453
3729
  const docs = {
3454
3730
  leading_comments: printLeadingComments(path, options, print, node),
3455
- self: p.self("lower"),
3731
+ self: p.self("lower"), // in the case of `3.14e10`
3456
3732
  trailing_comments: printTrailingComments(path, options, print, node),
3457
- as: "",
3733
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3458
3734
  alias: printAlias(path, options, print, node),
3459
3735
  order: printOrder(path, options, print, node),
3460
- null_order: "",
3736
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3461
3737
  comma: printComma(path, options, print, node),
3462
3738
  };
3463
3739
  return [
@@ -3472,7 +3748,7 @@ const printNumericLiteral = (path, options, print, node) => {
3472
3748
  const printOverClause = (path, options, print, node) => {
3473
3749
  const p = new Printer(path, options, print, node);
3474
3750
  const docs = {
3475
- leading_comments: "",
3751
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
3476
3752
  self: p.self("upper", true),
3477
3753
  trailing_comments: printTrailingComments(path, options, print, node),
3478
3754
  window: p.child("window", (x) => [" ", x], "all"),
@@ -3482,7 +3758,7 @@ const printOverClause = (path, options, print, node) => {
3482
3758
  const printOverwritePartitionsClause = (path, options, print, node) => {
3483
3759
  const p = new Printer(path, options, print, node);
3484
3760
  const docs = {
3485
- leading_comments: "",
3761
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
3486
3762
  overwrite: p.child("overwrite"),
3487
3763
  self: p.self("upper", true),
3488
3764
  trailing_comments: printTrailingComments(path, options, print, node),
@@ -3497,6 +3773,28 @@ const printOverwritePartitionsClause = (path, options, print, node) => {
3497
3773
  docs.grouped_expr,
3498
3774
  ]);
3499
3775
  };
3776
+ const printPipeStatement = (path, options, print, node) => {
3777
+ const p = new Printer(path, options, print, node);
3778
+ p.setNotRoot("left");
3779
+ p.setNotRoot("right");
3780
+ const docs = {
3781
+ left: p.child("left"),
3782
+ leading_comments: printLeadingComments(path, options, print, node),
3783
+ self: p.self("upper"),
3784
+ trailing_comments: printTrailingComments(path, options, print, node),
3785
+ right: p.child("right"),
3786
+ semicolon: p.child("semicolon"),
3787
+ };
3788
+ return [
3789
+ docs.left,
3790
+ hardline,
3791
+ docs.leading_comments,
3792
+ group([docs.self, docs.trailing_comments, indent([line, docs.right])]),
3793
+ p.has("semicolon") ? softline : "",
3794
+ docs.semicolon,
3795
+ p.newLine(),
3796
+ ];
3797
+ };
3500
3798
  const printPivotConfig = (path, options, print, node) => {
3501
3799
  const p = new Printer(path, options, print, node);
3502
3800
  const docs = {
@@ -3539,6 +3837,31 @@ const printPivotOperator = (path, options, print, node) => {
3539
3837
  p.has("alias") ? [" ", docs.alias] : "",
3540
3838
  ];
3541
3839
  };
3840
+ const printPivotPipeOperator = (path, options, print, node) => {
3841
+ const p = new Printer(path, options, print, node);
3842
+ const docs = {
3843
+ leading_comments: printLeadingComments(path, options, print, node),
3844
+ self: p.self(),
3845
+ trailing_comments: printTrailingComments(path, options, print, node),
3846
+ keywords: p.child("keywords", undefined, "all"),
3847
+ config: p.child("config", undefined, "first"),
3848
+ as: p.child("as", undefined, "all"),
3849
+ alias: p.child("alias", undefined, "all"),
3850
+ };
3851
+ return [
3852
+ docs.leading_comments,
3853
+ docs.self,
3854
+ docs.trailing_comments,
3855
+ p.has("keywords") ? " " : "",
3856
+ docs.keywords,
3857
+ " ",
3858
+ docs.config,
3859
+ p.has("alias")
3860
+ ? [" ", docs.as || (options.printKeywordsInUpperCase ? "AS" : "as")]
3861
+ : "",
3862
+ p.has("alias") ? [" ", docs.alias] : "",
3863
+ ];
3864
+ };
3542
3865
  const printRevokeStatement = (path, options, print, node) => {
3543
3866
  const p = new Printer(path, options, print, node);
3544
3867
  const docs = {
@@ -3564,7 +3887,7 @@ const printRevokeStatement = (path, options, print, node) => {
3564
3887
  docs.ident,
3565
3888
  line,
3566
3889
  group(docs.from),
3567
- softline,
3890
+ p.has("semicolon") ? softline : "",
3568
3891
  docs.semicolon,
3569
3892
  ]),
3570
3893
  p.newLine(),
@@ -3586,7 +3909,7 @@ const printRaiseStatement = (path, options, print, node) => {
3586
3909
  docs.trailing_comments,
3587
3910
  p.has("using") ? " " : "",
3588
3911
  docs.using,
3589
- softline,
3912
+ p.has("semicolon") ? softline : "",
3590
3913
  docs.semicolon,
3591
3914
  ]),
3592
3915
  p.newLine(),
@@ -3596,13 +3919,13 @@ const printRangeLiteral = (path, options, print, node) => {
3596
3919
  const p = new Printer(path, options, print, node);
3597
3920
  const docs = {
3598
3921
  type: p.child("type"),
3599
- leading_comments: "",
3922
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
3600
3923
  self: p.self("asItIs", true),
3601
3924
  trailing_comments: printTrailingComments(path, options, print, node),
3602
- as: "",
3925
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3603
3926
  alias: printAlias(path, options, print, node),
3604
3927
  order: printOrder(path, options, print, node),
3605
- null_order: "",
3928
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3606
3929
  comma: printComma(path, options, print, node),
3607
3930
  };
3608
3931
  return [
@@ -3684,7 +4007,7 @@ const printRepeatStatement = (path, options, print, node) => {
3684
4007
  docs.end_repeat,
3685
4008
  p.has("trailing_label") ? " " : "",
3686
4009
  docs.trailing_label,
3687
- softline,
4010
+ p.has("semicolon") ? softline : "",
3688
4011
  docs.semicolon,
3689
4012
  ]),
3690
4013
  p.newLine(),
@@ -3785,14 +4108,19 @@ const printSetOperator = (path, options, print, node) => {
3785
4108
  const docs = {
3786
4109
  with: p.child("with"),
3787
4110
  left: p.child("left"),
3788
- leading_comments: printLeadingComments(path, options, print, node),
3789
- self: p.self("upper"),
4111
+ method: p.child("method"),
4112
+ leading_comments: p.has("method")
4113
+ ? ""
4114
+ : printLeadingComments(path, options, print, node),
4115
+ self: p.self("upper", p.has("method")),
3790
4116
  trailing_comments: printTrailingComments(path, options, print, node),
3791
4117
  distinct_or_all: p.child("distinct_or_all", undefined, "all"),
4118
+ by: p.child("by", undefined, "all"),
4119
+ corresponding: p.child("corresponding", undefined, "all"),
3792
4120
  right: p.child("right"),
3793
4121
  semicolon: p.child("semicolon", undefined, "all"),
3794
4122
  };
3795
- const res = [
4123
+ return [
3796
4124
  docs.with,
3797
4125
  p.has("with")
3798
4126
  ? options.printBlankLineAfterCte
@@ -3801,23 +4129,20 @@ const printSetOperator = (path, options, print, node) => {
3801
4129
  : "",
3802
4130
  docs.left,
3803
4131
  line,
4132
+ p.has("method") ? [docs.method, " "] : "",
3804
4133
  docs.leading_comments,
3805
4134
  docs.self,
3806
4135
  docs.trailing_comments,
3807
4136
  " ",
3808
4137
  docs.distinct_or_all,
4138
+ p.has("by") ? [" ", docs.by] : "",
4139
+ p.has("corresponding") ? [" ", docs.corresponding] : "",
3809
4140
  line,
3810
4141
  docs.right,
3811
4142
  p.has("semicolon") ? softline : "",
3812
4143
  docs.semicolon,
3813
4144
  p.newLine(),
3814
4145
  ];
3815
- if (node.notRoot) {
3816
- return res;
3817
- }
3818
- else {
3819
- return group(res);
3820
- }
3821
4146
  };
3822
4147
  const printSetStatement = (path, options, print, node) => {
3823
4148
  const p = new Printer(path, options, print, node);
@@ -3835,7 +4160,7 @@ const printSetStatement = (path, options, print, node) => {
3835
4160
  docs.self,
3836
4161
  docs.trailing_comments,
3837
4162
  indent([line, docs.expr]),
3838
- softline,
4163
+ p.has("semicolon") ? softline : "",
3839
4164
  docs.semicolon,
3840
4165
  ]),
3841
4166
  p.newLine(),
@@ -3863,10 +4188,10 @@ const printStringLiteral = (path, options, print, node) => {
3863
4188
  leading_comments: printLeadingComments(path, options, print, node),
3864
4189
  self: p.self(),
3865
4190
  trailing_comments: printTrailingComments(path, options, print, node),
3866
- as: "",
4191
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3867
4192
  alias: printAlias(path, options, print, node),
3868
4193
  order: printOrder(path, options, print, node),
3869
- null_order: "",
4194
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3870
4195
  comma: printComma(path, options, print, node),
3871
4196
  };
3872
4197
  return [
@@ -3890,10 +4215,10 @@ const printStructLiteral = (path, options, print, node) => {
3890
4215
  trailing_comments: printTrailingComments(path, options, print, node),
3891
4216
  exprs: p.child("exprs", (x) => group(x), "none", line),
3892
4217
  rparen: p.child("rparen"),
3893
- as: "",
4218
+ as: "", // eslint-disable-line unicorn/no-unused-properties
3894
4219
  alias: printAlias(path, options, print, node),
3895
4220
  order: printOrder(path, options, print, node),
3896
- null_order: "",
4221
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
3897
4222
  comma: printComma(path, options, print, node),
3898
4223
  };
3899
4224
  return [
@@ -3941,6 +4266,26 @@ const printTableSampleClause = (path, options, print, node) => {
3941
4266
  docs.group,
3942
4267
  ];
3943
4268
  };
4269
+ // table sample
4270
+ const printTableSamplePipeOperator = (path, options, print, node) => {
4271
+ const p = new Printer(path, options, print, node);
4272
+ const docs = {
4273
+ leading_comments: printLeadingComments(path, options, print, node),
4274
+ self: p.self(),
4275
+ trailing_comments: printTrailingComments(path, options, print, node),
4276
+ keywords: p.child("keywords", undefined, "all"),
4277
+ group: p.child("group", undefined, "all"),
4278
+ };
4279
+ return [
4280
+ docs.leading_comments,
4281
+ docs.self,
4282
+ docs.trailing_comments,
4283
+ p.has("keywords") ? " " : "",
4284
+ docs.keywords,
4285
+ " ",
4286
+ docs.group,
4287
+ ];
4288
+ };
3944
4289
  const printTableSampleRatio = (path, options, print, node) => {
3945
4290
  const p = new Printer(path, options, print, node);
3946
4291
  const docs = {
@@ -4027,17 +4372,17 @@ const printType = (path, options, print, node) => {
4027
4372
  leading_comments: printLeadingComments(path, options, print, node),
4028
4373
  self: p.self("upper"),
4029
4374
  trailing_comments: printTrailingComments(path, options, print, node),
4030
- type: p.child("type", undefined, "all"),
4031
- type_declaration: p.child("type_declaration", undefined, "all"),
4032
- parameter: p.child("parameter", undefined, "all"),
4033
- collate: p.child("collate", undefined, "all"),
4034
- constraint: p.child("constraint", undefined, "all"),
4035
- primarykey: p.child("primarykey", undefined, "all"),
4036
- references: p.child("references", undefined, "all"),
4037
- enforced: p.child("enforced", undefined, "all"),
4038
- not_null: p.child("not_null", (x) => group([line, x])),
4039
- default: p.child("default", undefined, "all"),
4040
- options: p.child("options", undefined, "all"),
4375
+ type: p.child("type", undefined, "all"), // INT64 | ARRAY
4376
+ type_declaration: p.child("type_declaration", undefined, "all"), // <INT64>
4377
+ parameter: p.child("parameter", undefined, "all"), // STRING(10)
4378
+ collate: p.child("collate", undefined, "all"), // DEFAUT COLLATE 'und:ci'
4379
+ constraint: p.child("constraint", undefined, "all"), // CONSTRAINT ident
4380
+ primarykey: p.child("primarykey", undefined, "all"), // PRIMARY KEY
4381
+ references: p.child("references", undefined, "all"), // REFERENCES tablename(col)
4382
+ enforced: p.child("enforced", undefined, "all"), // NOT ENFORCED
4383
+ not_null: p.child("not_null", (x) => group([line, x])), // NOT NULL
4384
+ default: p.child("default", undefined, "all"), // DEFAULT CURRENT_TIMESTAMP
4385
+ options: p.child("options", undefined, "all"), // OPTIONS()
4041
4386
  aggregate: p.child("aggregate", (x) => group([line, x])), // NOT AGGREGATEj:w
4042
4387
  };
4043
4388
  return [
@@ -4069,7 +4414,7 @@ const printType = (path, options, print, node) => {
4069
4414
  const printTypeDeclaration = (path, options, print, node) => {
4070
4415
  const p = new Printer(path, options, print, node);
4071
4416
  const docs = {
4072
- leading_comments: "",
4417
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
4073
4418
  in_out: p.child("in_out"),
4074
4419
  self: p.self("asItIs", true),
4075
4420
  trailing_comments: printTrailingComments(path, options, print, node),
@@ -4105,10 +4450,10 @@ const printUnaryOperator = (path, options, print, node) => {
4105
4450
  self: p.includedIn(lowerCaseOperators) ? p.self("lower") : p.self("upper"),
4106
4451
  trailing_comments: printTrailingComments(path, options, print, node),
4107
4452
  right: p.child("right", undefined, "all"),
4108
- as: "",
4453
+ as: "", // eslint-disable-line unicorn/no-unused-properties
4109
4454
  alias: printAlias(path, options, print, node),
4110
4455
  order: printOrder(path, options, print, node),
4111
- null_order: "",
4456
+ null_order: "", // eslint-disable-line unicorn/no-unused-properties
4112
4457
  comma: printComma(path, options, print, node),
4113
4458
  };
4114
4459
  return [
@@ -4143,12 +4488,45 @@ const printUndropStatement = (path, options, print, node) => {
4143
4488
  docs.if_not_exists,
4144
4489
  " ",
4145
4490
  docs.ident,
4146
- softline,
4491
+ p.has("semicolon") ? softline : "",
4147
4492
  docs.semicolon,
4148
4493
  ]),
4149
4494
  p.newLine(),
4150
4495
  ];
4151
4496
  };
4497
+ const printUnionPipeOperator = (path, options, print, node) => {
4498
+ const p = new Printer(path, options, print, node);
4499
+ p.setNotRoot("exprs");
4500
+ p.setGroupRecommended("exprs");
4501
+ if (node.children.exprs) {
4502
+ // trailing comma is allowed
4503
+ node.children.exprs.NodeVec[p.len("exprs") - 1].isFinalColumn = true;
4504
+ }
4505
+ const docs = {
4506
+ method: p.child("method"),
4507
+ leading_comments: p.has("method")
4508
+ ? ""
4509
+ : printLeadingComments(path, options, print, node),
4510
+ self: p.self("asItIs", p.has("method")),
4511
+ trailing_comments: printTrailingComments(path, options, print, node),
4512
+ keywords: p.child("keywords", undefined, "all"),
4513
+ by: p.child("by", undefined, "all"),
4514
+ corresponding: p.child("corresponding", undefined, "all"),
4515
+ exprs: p.child("exprs", (x) => group([line, x])),
4516
+ };
4517
+ return [
4518
+ docs.method,
4519
+ p.has("method") ? " " : "",
4520
+ docs.leading_comments,
4521
+ docs.self,
4522
+ docs.trailing_comments,
4523
+ p.has("keywords") ? " " : "",
4524
+ docs.keywords,
4525
+ p.has("by") ? [" ", docs.by] : "",
4526
+ p.has("corresponding") ? [" ", docs.corresponding] : "",
4527
+ indent(docs.exprs),
4528
+ ];
4529
+ };
4152
4530
  const printUnpivotConfig = (path, options, print, node) => {
4153
4531
  const p = new Printer(path, options, print, node);
4154
4532
  const docs = {
@@ -4193,6 +4571,31 @@ const printUnpivotOperator = (path, options, print, node) => {
4193
4571
  p.has("alias") ? [" ", docs.alias] : "",
4194
4572
  ];
4195
4573
  };
4574
+ const printUnpivotPipeOperator = (path, options, print, node) => {
4575
+ const p = new Printer(path, options, print, node);
4576
+ const docs = {
4577
+ leading_comments: printLeadingComments(path, options, print, node),
4578
+ self: p.self(),
4579
+ trailing_comments: printTrailingComments(path, options, print, node),
4580
+ keywords: p.child("keywords", undefined, "all"),
4581
+ config: p.child("config", undefined, "first"),
4582
+ as: p.child("as", undefined, "all"),
4583
+ alias: p.child("alias", undefined, "all"),
4584
+ };
4585
+ return [
4586
+ docs.leading_comments,
4587
+ docs.self,
4588
+ docs.trailing_comments,
4589
+ p.has("keywords") ? " " : "",
4590
+ docs.keywords,
4591
+ " ",
4592
+ docs.config,
4593
+ p.has("alias")
4594
+ ? [" ", docs.as || (options.printKeywordsInUpperCase ? "AS" : "as")]
4595
+ : "",
4596
+ p.has("alias") ? [" ", docs.alias] : "",
4597
+ ];
4598
+ };
4196
4599
  const printUpdateStatement = (path, options, print, node) => {
4197
4600
  const p = new Printer(path, options, print, node);
4198
4601
  const docs = {
@@ -4218,7 +4621,7 @@ const printUpdateStatement = (path, options, print, node) => {
4218
4621
  docs.from,
4219
4622
  line,
4220
4623
  docs.where,
4221
- node.notRoot ? "" : softline,
4624
+ p.has("semicolon") ? softline : "",
4222
4625
  docs.semicolon,
4223
4626
  ]),
4224
4627
  p.newLine(),
@@ -4296,7 +4699,7 @@ const printWhileStatement = (path, options, print, node) => {
4296
4699
  docs.end_while,
4297
4700
  p.has("trailing_label") ? " " : "",
4298
4701
  docs.trailing_label,
4299
- softline,
4702
+ p.has("semicolon") ? softline : "",
4300
4703
  docs.semicolon,
4301
4704
  ]),
4302
4705
  p.newLine(),
@@ -4370,7 +4773,7 @@ const printWindowSpecification = (path, options, print, node) => {
4370
4773
  p.has("orderby") ||
4371
4774
  p.has("frame"));
4372
4775
  const docs = {
4373
- leading_comments: "",
4776
+ leading_comments: "", // eslint-disable-line unicorn/no-unused-properties
4374
4777
  self: p.self("upper", true),
4375
4778
  trailing_comments: printTrailingComments(path, options, print, node),
4376
4779
  name: p.child("name"),