001package gudusoft.gsqlparser.nodes; 002 003import gudusoft.gsqlparser.ETokenType; 004import gudusoft.gsqlparser.TSourceToken; 005import gudusoft.gsqlparser.nodes.hana.TTimeTravel; 006import gudusoft.gsqlparser.nodes.mssql.TForXMLClause; 007import gudusoft.gsqlparser.nodes.mssql.TOptionClause; 008import gudusoft.gsqlparser.nodes.teradata.TExpandOnClause; 009import gudusoft.gsqlparser.nodes.hive.*; 010import gudusoft.gsqlparser.nodes.teradata.THashByClause; 011import gudusoft.gsqlparser.nodes.vertica.TTimeSeries; 012import gudusoft.gsqlparser.stmt.TSelectSqlStatement; 013 014import java.util.ArrayList; 015 016/** 017 * Internal used by parser, reprsents raw parse tree node of select statement. 018*/ 019public class TSelectSqlNode extends TParseTreeNode{ 020 021 private TForXMLClause forXMLClause; 022 023 public void setForXMLClause(TForXMLClause forXMLClause) { 024 this.forXMLClause = forXMLClause; 025 } 026 027 public TForXMLClause getForXMLClause() { 028 return forXMLClause; 029 } 030 031 public void setRelationExpr(TRelationExpr relationExpr) { 032 this.relationExpr = relationExpr; 033 } 034 035 /** 036 * The relation of a {@code TABLE t} query (the SQL-standard shorthand for 037 * {@code SELECT * FROM t}), or null when this node is not such a query. 038 * 039 * @return the relation named after the TABLE keyword 040 */ 041 public TRelationExpr getRelationExpr() { 042 return relationExpr; 043 } 044 045 private TRelationExpr relationExpr = null; 046 047 /** 048 * Give a {@code TABLE t} node the FROM list and select list of 049 * {@code SELECT * FROM t}, which is what the SQL standard defines it to be, 050 * so every consumer of a select (statement tables, resolver, lineage) sees 051 * the relation and a wildcard result column instead of an empty select. 052 * <p> 053 * The wildcard is synthesized: its part token is typed 054 * {@link ETokenType#ttasterisk} (wildcard identity comes from the token 055 * type, never from the text) and placed at the TABLE keyword, but it is 056 * not linked into the source token chain, so the text of this node and of 057 * the statement still reads {@code TABLE t}. 058 * <p> 059 * Does nothing unless this node is a {@code TABLE t} query that has not 060 * been expanded yet, so calling it again is harmless. 061 */ 062 public void expandTableQuery() { 063 if (relationExpr == null || resultColumnList != null || fromTableList != null 064 || isCombinedQuery() || valueClause != null) { 065 return; 066 } 067 068 TNodeFactory nf = new TNodeFactory(dbvendor); 069 nf.setGsqlParser(getGsqlparser()); 070 071 TFromTable fromTable = (TFromTable) nf.createNode(ENodeType.T_FromTable.getId(), relationExpr); 072 fromTable.setStartToken(relationExpr.getStartToken()); 073 fromTable.setEndToken(relationExpr.getEndToken()); 074 TFromTableList fromList = (TFromTableList) nf.createNode(ENodeType.T_FromTableList.getId(), fromTable); 075 fromList.setStartToken(relationExpr.getStartToken()); 076 fromList.setEndToken(relationExpr.getEndToken()); 077 this.fromTableList = fromList; 078 079 TSourceToken tableKeyword = tableQueryKeyword(); 080 TSourceToken star = new TSourceToken("*"); 081 star.tokentype = ETokenType.ttasterisk; 082 star.tokencode = '*'; 083 if (tableKeyword != null) { 084 star.lineNo = tableKeyword.lineNo; 085 star.columnNo = tableKeyword.columnNo; 086 star.offset = tableKeyword.offset; 087 star.posinlist = tableKeyword.posinlist; 088 } 089 TObjectName starName = nf.createObjectName(null, null, star); 090 TExpression starExpr = nf.createSimpleExpression(starName); 091 TResultColumn starColumn = (TResultColumn) nf.createNode(ENodeType.T_ResultColumn.getId(), starExpr); 092 starColumn.setStartToken(star); 093 starColumn.setEndToken(star); 094 TResultColumnList columns = (TResultColumnList) nf.createNode(ENodeType.T_ResultColumnList.getId(), starColumn); 095 columns.setStartToken(star); 096 columns.setEndToken(star); 097 this.resultColumnList = columns; 098 } 099 100 /** 101 * The TABLE keyword of a {@code TABLE t} query: every grammar builds it as 102 * {@code RW_TABLE relation}, so it is the solid token right before the relation. 103 */ 104 private TSourceToken tableQueryKeyword() { 105 TSourceToken relationStart = relationExpr.getStartToken(); 106 if (relationStart == null) { 107 return null; 108 } 109 TSourceToken keyword = relationStart.prevSolidToken(); 110 if (keyword != null && "TABLE".equalsIgnoreCase(keyword.toString())) { // non-identifier-compare: SQL keyword 111 return keyword; 112 } 113 return relationStart; 114 } 115 116 private TClusterBy clusterBy; 117 118 public void setClusterBy(TClusterBy clusterBy) { 119 this.clusterBy = clusterBy; 120 } 121 122 public TClusterBy getClusterBy() { 123 return clusterBy; 124 } 125 126 private boolean isConsume; 127 128 public void setConsume(boolean consume) { 129 isConsume = consume; 130 } 131 132 public boolean isConsume() { 133 return isConsume; 134 } 135 136 public void setHiveFromQuery(boolean hiveFromQuery) { 137 isHiveFromQuery = hiveFromQuery; 138 } 139 140 private boolean isHiveFromQuery = false; 141 142 public boolean isHiveFromQuery() { 143 return isHiveFromQuery; 144 } 145 146 public void setHiveBodyList(ArrayList<TParseTreeNode> hiveBodyList) { 147 this.hiveBodyList = hiveBodyList; 148 } 149 150 /** 151 * @deprecated since 2.6.3.5, insert and select statement after from query 152 * is represented by {@link TSelectSqlNode#getSelectSqlNodes()} or {@link TInsertSqlNode#getInsertSqlNodes()} 153 * 154 * @return 155 */ 156 public ArrayList<TParseTreeNode> getHiveBodyList() { 157 return hiveBodyList; 158 } 159 160 private ArrayList<TParseTreeNode> hiveBodyList; 161 162 163 164// private TExpression skipOffset; 165// private TExpression firstMax; 166// private TExpression limitMax; 167// 168// public void setSkipOffset(TExpression skipOffset) { 169// this.skipOffset = skipOffset; 170// } 171// 172// public void setFirstMax(TExpression firstMax) { 173// this.firstMax = firstMax; 174// } 175// 176// public void setLimitMax(TExpression limitMax) { 177// this.limitMax = limitMax; 178// } 179// 180// /** 181// * Informix skip offset 182// * @return skip offset 183// */ 184// public TExpression getSkipOffset() { 185// 186// return skipOffset; 187// } 188// 189// /** 190// * Informix first Max 191// * @return first Max 192// */ 193// public TExpression getFirstMax() { 194// return firstMax; 195// } 196// 197// /** 198// * Informix limit max 199// * @return limit max 200// */ 201// public TExpression getLimitMax() { 202// return limitMax; 203// } 204 205 private THashByClause hashByClause; 206 207 public void setHashByClause(THashByClause hashByClause) { 208 this.hashByClause = hashByClause; 209 } 210 211 public THashByClause getHashByClause() { 212 return hashByClause; 213 } 214 215 private THavingClause havingClause; 216 217 public void setHavingClause(THavingClause havingClause) { 218 this.havingClause = havingClause; 219 if (this.groupByClause != null){ 220 this.groupByClause.setHavingClause(havingClause.getCondition()); 221 }else{ 222 this.groupByClause = new TGroupBy(); 223 this.groupByClause.setHavingClause(havingClause.getCondition()); 224 } 225 } 226 227 public THavingClause getHavingClause() { 228 return havingClause; 229 } 230 231 private TPTNodeList<TParseTreeNode> queryClauseList; 232 233 public void setQueryClauseList(TPTNodeList<TParseTreeNode> queryClauseList) { 234 this.queryClauseList = queryClauseList; 235 for(int i=0;i<this.queryClauseList.size();i++){ 236 TParseTreeNode parseTreeNode = this.queryClauseList.getElement(i); 237 if (parseTreeNode instanceof TFromTableList){ 238 //from clause 239 this.setFromTableList((TFromTableList)parseTreeNode); 240 }else if (parseTreeNode instanceof THashByClause){ 241 this.setHashByClause((THashByClause)parseTreeNode); 242 }else if (parseTreeNode instanceof TWhereClause){ 243 this.setWhereCondition((TWhereClause)parseTreeNode); 244 }else if (parseTreeNode instanceof TGroupBy){ 245 this.setGroupByClause((TGroupBy)parseTreeNode); 246 }else if (parseTreeNode instanceof THavingClause){ 247 this.setHavingClause((THavingClause)parseTreeNode); 248 }else if (parseTreeNode instanceof TQualifyClause){ 249 this.setQualifyClause((TQualifyClause)parseTreeNode); 250 }else if (parseTreeNode instanceof TSampleClause){ 251 this.setSampleClause((TSampleClause)parseTreeNode); 252 }else if (parseTreeNode instanceof TExpandOnClause){ 253 this.setExpandOnClause((TExpandOnClause)parseTreeNode); 254 }else if (parseTreeNode instanceof TTeradataWithClause){ 255 this.setWithClause((TTeradataWithClause)parseTreeNode); 256 }else if (parseTreeNode instanceof TOrderBy){ 257 this.setOrderbyClause((TOrderBy)parseTreeNode); 258 }else if (parseTreeNode instanceof TIntoClause){ 259 this.setIntoClause((TIntoClause)parseTreeNode); 260 }else if (parseTreeNode instanceof TClusterBy){ 261 this.setClusterBy((TClusterBy)parseTreeNode); 262 }else if (parseTreeNode instanceof TDistributeBy){ 263 this.setDistributeBy((TDistributeBy)parseTreeNode); 264 }else if (parseTreeNode instanceof TSortBy){ 265 this.setSortBy((TSortBy)parseTreeNode); 266 } 267 } 268 } 269 270 public void setSelectModifiers(ArrayList<TSelectModifier> selectModifiers) { 271 this.selectModifiers = selectModifiers; 272 } 273 274 public ArrayList<TSelectModifier> getSelectModifiers() { 275 return selectModifiers; 276 } 277 278 private ArrayList<TSelectModifier> selectModifiers; 279 280 private TWithTableLock withTableLock; 281 282 public void setWithTableLock(TWithTableLock withTableLock) { 283 this.withTableLock = withTableLock; 284 } 285 286 public TWithTableLock getWithTableLock() { 287 288 return withTableLock; 289 } 290 291 private TTimeSeries timeSeries; 292 293 public void setTimeSeries(TTimeSeries timeSeries) { 294 this.timeSeries = timeSeries; 295 } 296 297 public TTimeSeries getTimeSeries() { 298 299 return timeSeries; 300 } 301 302 private TTimeTravel timeTravel; // hana 303 private THintClause hintClause; //hana 304 305 public TTimeTravel getTimeTravel() { 306 return timeTravel; 307 } 308 309 public void setClauses(TPTNodeList<TParseTreeNode> clauses){ 310 for(int i=0;i<clauses.size();i++){ 311 TParseTreeNode node = clauses.getElement(i); 312 if (node instanceof TForUpdate){ 313 this.forupdateClause = (TForUpdate)node; 314 }else if (node instanceof TOrderBy){ 315 this.orderbyClause = (TOrderBy)node; 316 }else if (node instanceof TLimitClause){ 317 this.limitClause = (TLimitClause)node; 318 }else if (node instanceof TTimeTravel){ 319 this.timeTravel = (TTimeTravel)node; 320 } 321 } 322 } 323 324 325 public void setHintClause(THintClause hintClause) { 326 this.hintClause = hintClause; 327 } 328 329 public THintClause getHintClause() { 330 331 return hintClause; 332 } 333 334 public int getParenthesisCount() { 335 return parenthesisCount; 336 } 337 338 public void incParenthesisCount() { 339 this.parenthesisCount++; 340 } 341 342 private int parenthesisCount = 0; 343 private int parenthissisCountBeforeOrder = 0; 344 345 346 public void setParenthesisCount(int parenthesisCount) { 347 this.parenthesisCount = parenthesisCount; 348 } 349 350 public void setParenthissisCountBeforeOrder() { 351 352 this.parenthissisCountBeforeOrder = parenthesisCount; 353 parenthesisCount = 0; 354 } 355 356 public int getParenthissisCountBeforeOrder() { 357 358 return parenthissisCountBeforeOrder; 359 } 360 361 private TOffsetClause offsetClause; 362 363 public void setOffsetClause(TOffsetClause offsetClause) { 364 this.offsetClause = offsetClause; 365 } 366 367 public TOffsetClause getOffsetClause() { 368 369 return offsetClause; 370 } 371 372 public void setOptionClause(TOptionClause optionClause) { 373 this.optionClause = optionClause; 374 } 375 376 public TOptionClause getOptionClause() { 377 378 return optionClause; 379 } 380 381 /** 382 * sql server option clause 383 * @see gudusoft.gsqlparser.nodes.mssql.TOptionClause 384 */ 385 private TOptionClause optionClause; 386 387 private TLateralView lateralView; 388 389 public void setLateralView(TLateralView lateralView) { 390 this.lateralView = lateralView; 391 } 392 393 public TLateralView getLateralView() { 394 395 return lateralView; 396 } 397 398 private TSortBy sortBy; 399 400 public void setSortBy(TSortBy sortBy) { 401 this.sortBy = sortBy; 402 } 403 404 public TSortBy getSortBy() { 405 406 return sortBy; 407 } 408 409 private TDistributeBy distributeBy; 410 411 public void setDistributeBy(TDistributeBy distributeBy) { 412 this.distributeBy = distributeBy; 413 } 414 415 public TDistributeBy getDistributeBy() { 416 417 return distributeBy; 418 } 419 420// private THiveClusterBy hiveClusterBy; 421// 422// public void setHiveClusterBy(THiveClusterBy hiveClusterBy) { 423// this.hiveClusterBy = hiveClusterBy; 424// } 425// 426// public THiveClusterBy getHiveClusterBy() { 427// 428// return hiveClusterBy; 429// } 430 431 private THiveTransformClause transformClause; 432 433 public THiveTransformClause getTransformClause() { 434 return transformClause; 435 } 436 437 public void setTransformClause(THiveTransformClause transformClause) { 438 this.transformClause = transformClause; 439 } 440 441 public void setHiveHintClause(THiveHintClause hiveHintClause) { 442 this.hiveHintClause = hiveHintClause; 443 } 444 445 public THiveHintClause getHiveHintClause() { 446 return hiveHintClause; 447 } 448 449 private THiveHintClause hiveHintClause; 450 451 private TIntoTableClause intoTableClause; 452 453 public void setIntoTableClause(TIntoTableClause intoTableClause) { 454 this.intoTableClause = intoTableClause; 455 } 456 457 public TIntoTableClause getIntoTableClause() { 458 459 return intoTableClause; 460 } 461 462 public void setSelectToken(TSourceToken selectToken) { 463 this.selectToken = selectToken; 464 } 465 466 public TSourceToken getSelectToken() { 467 468 return selectToken; 469 } 470 471 private TSourceToken selectToken = null; 472 473 private TResultColumnList resultColumnList; 474 475 public TSelectDistinct getSelectDistinct() { 476 return selectDistinct; 477 } 478 479 public void setSelectDistinct(TSelectDistinct selectDistinct) { 480 481 this.selectDistinct = selectDistinct; 482 } 483 484 private TSelectDistinct selectDistinct = null; 485 486 public void setTopClause(TTopClause topClause) { 487 this.topClause = topClause; 488 } 489 490 public TTopClause getTopClause() { 491 492 return topClause; 493 } 494 495 private TTopClause topClause = null; 496 497 public void setComputeClause(TComputeClause computeClause) { 498 499 this.computeClause = computeClause; 500 } 501 502 public TComputeClause getComputeClause() { 503 return computeClause; 504 } 505 506 private TComputeClause computeClause = null; 507 508 public TResultColumnList getResultColumnList() { 509 return resultColumnList; 510 } 511 512 public TFromTableList getFromTableList() { 513 return fromTableList; 514 } 515 516 public TWhereClause getWhereCondition() { 517 return whereCondition; 518 } 519 520 private TFromTableList fromTableList; 521 522 public void setResultColumnList(TResultColumnList resultColumnList) { 523 this.resultColumnList = resultColumnList; 524 } 525 526 public void setFromTableList(TFromTableList fromTableList) { 527 this.fromTableList = fromTableList; 528 } 529 530 public void setWhereCondition(TWhereClause whereCondition) { 531 this.whereCondition = whereCondition; 532 } 533 534 private TWhereClause whereCondition; 535 536 private TSelectSqlNode leftNode,rightNode; 537 538 public TCTEList cteList; 539 540 public TCTEList getCteList() { 541 return cteList; 542 } 543 544 // Oracle 12c WITH FUNCTION/PROCEDURE support - inline PL/SQL definitions 545 private TStatementListSqlNode withPlsqlItems; 546 547 public TStatementListSqlNode getWithPlsqlItems() { 548 return withPlsqlItems; 549 } 550 551 public void setWithPlsqlItems(TStatementListSqlNode withPlsqlItems) { 552 this.withPlsqlItems = withPlsqlItems; 553 } 554 555 public int getSetOperator() { 556 return setOperator; 557 } 558 559 private int setOperator = 0; 560 private boolean setOperatorByName = false; 561 562 public void setSetOperator(int setOperator) { 563 this.setOperator = setOperator; 564 } 565 566 /** 567 * Returns true if the set operator uses BY NAME matching (Snowflake). 568 * When BY NAME is used, columns are matched by their names rather than positions. 569 */ 570 public boolean isSetOperatorByName() { 571 return setOperatorByName; 572 } 573 574 /** 575 * Sets whether the set operator uses BY NAME matching. 576 */ 577 public void setSetOperatorByName(boolean byName) { 578 this.setOperatorByName = byName; 579 } 580 581 public void setSetOperator(TSourceToken st1, TSourceToken st2) 582 { 583 if (st1.toString().equalsIgnoreCase("union")){ 584 if (st2 == null){ 585 this.setOperator = TSelectSqlStatement.setOperator_union; 586 }else if (st2.toString().equalsIgnoreCase("all")){ 587 this.setOperator = TSelectSqlStatement.setOperator_unionall; 588 }else if (st2.toString().equalsIgnoreCase("distinct")){ 589 this.setOperator = TSelectSqlStatement.SET_OPERATOR_UNIONDISTINCT; 590 } 591 } 592 else if (st1.toString().equalsIgnoreCase("intersect")){ 593 if (st2 == null){ 594 this.setOperator = TSelectSqlStatement.setOperator_intersect; 595 }else if (st2.toString().equalsIgnoreCase("all")){ 596 this.setOperator = TSelectSqlStatement.setOperator_intersectall; 597 }else if (st2.toString().equalsIgnoreCase("distinct")){ 598 this.setOperator = TSelectSqlStatement.SET_OPERATOR_INTERSECTDISTINCT; 599 } 600 } 601 else if (st1.toString().equalsIgnoreCase("minus")){ 602 if (st2 == null){ 603 this.setOperator = TSelectSqlStatement.setOperator_minus; 604 }else if (st2.toString().equalsIgnoreCase("all")){ 605 this.setOperator = TSelectSqlStatement.setOperator_minusall; 606 }else if (st2.toString().equalsIgnoreCase("distinct")){ 607 this.setOperator = TSelectSqlStatement.SET_OPERATOR_MINUSDISTINCT; 608 } 609 } 610 else if (st1.toString().equalsIgnoreCase("except")){ 611 if (st2 == null){ 612 this.setOperator = TSelectSqlStatement.setOperator_except; 613 }else if (st2.toString().equalsIgnoreCase("all")){ 614 this.setOperator = TSelectSqlStatement.setOperator_exceptall; 615 }else if (st2.toString().equalsIgnoreCase("distinct")){ 616 this.setOperator = TSelectSqlStatement.SET_OPERATOR_EXCEPTDISTINCT; 617 } 618 } 619 } 620 621 public TSelectSqlNode getLeftNode() { 622 return leftNode; 623 } 624 625 public TSelectSqlNode getRightNode() { 626 return rightNode; 627 } 628 629 public void init(Object arg1, Object arg2) 630 { 631 leftNode = (TSelectSqlNode)arg1; 632 rightNode = (TSelectSqlNode)arg2; 633 } 634 635 public boolean isCombinedQuery(){ 636 // combine multiple queries using the set operators UNION, UNION ALL, INTERSECT, and MINUS. 637 return (setOperator > 0); 638 } 639 640 public TOrderBy getOrderbyClause() { 641 return orderbyClause; 642 } 643 644 private TOrderBy orderbyClause; 645 646 public void setOrderbyClause(TOrderBy orderbyClause) { 647 this.orderbyClause = orderbyClause; 648 if (orderbyClause == null) return; 649 650 if (orderbyClause.getOffsetClause() != null ){ // 在 sqlserver yacc rule中, offset clause 先被挂在了order by clause 下 651 this.setOffsetClause(orderbyClause.getOffsetClause()); 652 } 653 if (orderbyClause.getFetchFirstClause() != null){ 654 this.setFetchFirstClause(orderbyClause.getFetchFirstClause()); 655 } 656 657 } 658 659 public TForUpdate getForupdateClause() { 660 return forupdateClause; 661 } 662 663 private TForUpdate forupdateClause; 664 665 public void setForupdateClause(TParseTreeNode forupdateClause) { 666 if (forupdateClause instanceof TForUpdate){ 667 this.forupdateClause = (TForUpdate) forupdateClause; 668 }else if (forupdateClause instanceof TForXMLClause){ 669 this.forXMLClause = (TForXMLClause)forupdateClause; 670 } 671 } 672 673 public THierarchical getHierarchicalClause() { 674 return hierarchicalClause; 675 } 676 677 private THierarchical hierarchicalClause; 678 679 public void setHierarchicalClause(THierarchical hierarchicalClause) { 680 this.hierarchicalClause = hierarchicalClause; 681 } 682 683 public TGroupBy getGroupByClause() { 684 return groupByClause; 685 } 686 687 private TGroupBy groupByClause; 688 689 public void setGroupByClause(TGroupBy groupByClause) { 690 this.groupByClause = groupByClause; 691 if (groupByClause != null){ 692 if ((groupByClause.getQualifyClause() != null)&&(this.getQualifyClause() == null)){ 693 this.setQualifyClause(groupByClause.getQualifyClause()); 694 } 695 if ((this.getHavingClause() != null)&&(this.groupByClause.getHavingClause() == null)){ 696 this.groupByClause.setHavingClause(this.getHavingClause().getCondition()); 697 } 698 } 699 } 700 701 private TIntoClause intoClause = null; 702 703 public void setIntoClause(TIntoClause intoClause) { 704 if (intoClause == null) return; 705 this.intoClause = intoClause; 706 } 707 708 public TIntoClause getIntoClause() { 709 710 return intoClause; 711 } 712 713 private TQualifyClause qualifyClause = null; 714 715 public void setQualifyClause(TQualifyClause qualifyClause) { 716 if (qualifyClause == null) return; 717 this.qualifyClause = qualifyClause; 718 } 719 720 public TQualifyClause getQualifyClause() { 721 722 return qualifyClause; 723 } 724 725 private TSampleClause sampleClause = null; 726 727 public void setSampleClause(TSampleClause sampleClause) { 728 this.sampleClause = sampleClause; 729 } 730 731 public TSampleClause getSampleClause() { 732 733 return sampleClause; 734 } 735 736 private TTeradataWithClause withClause = null; 737 738 public TTeradataWithClause getWithClause() { 739 return withClause; 740 } 741 742 public void setWithClause(TTeradataWithClause withClause) { 743 744 this.withClause = withClause; 745 } 746 747 private TLimitClause limitClause = null; 748 749 public void setLimitClause(TLimitClause limitClause) { 750 this.limitClause = limitClause; 751 } 752 753 public TLimitClause getLimitClause() { 754 755 return limitClause; 756 } 757 758 private TFetchFirstClause fetchFirstClause = null; 759 760 public void setFetchFirstClause(TFetchFirstClause fetchFirstClause) { 761 this.fetchFirstClause = fetchFirstClause; 762 } 763 764 public TFetchFirstClause getFetchFirstClause() { 765 766 return fetchFirstClause; 767 } 768 769 private TOptimizeForClause optimizeForClause = null; 770 771 public void setOptimizeForClause(TOptimizeForClause optimizeForClause) { 772 this.optimizeForClause = optimizeForClause; 773 } 774 775 public TOptimizeForClause getOptimizeForClause() { 776 777 return optimizeForClause; 778 } 779 780 private TIsolationClause isolationClause = null; 781 782 public void setIsolationClause(TIsolationClause isolationClause) { 783 this.isolationClause = isolationClause; 784 } 785 786 public TIsolationClause getIsolationClause() { 787 return isolationClause; 788 } 789 790 public void setValueClause(TValueClause valueClause) { 791 this.valueClause = valueClause; 792 this.setStartToken(valueClause); 793 this.setEndToken(valueClause); 794 } 795 796 public TValueClause getValueClause() { 797 798 return valueClause; 799 } 800 801 private TValueClause valueClause = null; 802 803 private TPTNodeList <TLockingClause> lockingClauses; 804 805 public TPTNodeList<TLockingClause> getLockingClauses() { 806 return lockingClauses; 807 } 808 809 public void setLockingClauses(TPTNodeList<TLockingClause> lockingClauses) { 810 this.lockingClauses = lockingClauses; 811 } 812 813// private TSelectLimit selectLimit; 814// 815// public void setSelectLimit(TSelectLimit selectLimit) { 816// this.selectLimit = selectLimit; 817// } 818// 819// public TSelectLimit getSelectLimit() { 820// 821// return selectLimit; 822// } 823 824 private TWindowClause windowClause; 825 826 public void setWindowClause(TWindowClause windowClause) { 827 this.windowClause = windowClause; 828 } 829 830 public TWindowClause getWindowClause() { 831 832 return windowClause; 833 } 834 835 private TExpandOnClause expandOnClause; 836 837 public TExpandOnClause getExpandOnClause() { 838 return expandOnClause; 839 } 840 841 public void setExpandOnClause(TExpandOnClause expandOnClause) { 842 843 this.expandOnClause = expandOnClause; 844 } 845 846 public static void setFromList(ArrayList<TSelectSqlNode> selectSqlNode, TFromTableList fromTables){ 847 for(int i=0;i<selectSqlNode.size();i++){ 848 TSelectSqlNode select = selectSqlNode.get(i); 849 select.setFromTableList(fromTables); 850 } 851 } 852 853 private ArrayList<TSelectSqlNode> selectSqlNodes; 854 855 public ArrayList<TSelectSqlNode> getSelectSqlNodes() { 856 return selectSqlNodes; 857 } 858 859 public void setSelectSqlNodes(ArrayList<TSelectSqlNode> selectSqlNodes){ 860 this.selectSqlNodes = selectSqlNodes; 861 } 862 863 public static TSelectSqlNode getFirstSelectSqlNode(ArrayList<TSelectSqlNode> selectSqlNodes){ 864 return selectSqlNodes.get(0); 865 } 866 867 // StarRocks pipe operator support 868 private TPTNodeList<TParseTreeNode> pipeOperators; 869 private boolean isPipeQuery = false; 870 871 public TPTNodeList<TParseTreeNode> getPipeOperators() { 872 return pipeOperators; 873 } 874 875 public void setPipeOperators(TPTNodeList<TParseTreeNode> pipeOperators) { 876 this.pipeOperators = pipeOperators; 877 } 878 879 public boolean isPipeQuery() { 880 return isPipeQuery; 881 } 882 883 public void setIsPipeQuery(boolean isPipeQuery) { 884 this.isPipeQuery = isPipeQuery; 885 } 886 887} 888