@@ -36,6 +36,7 @@ public class AnalyticExpression extends ASTNodeAccessImpl implements Expression
3636 private boolean distinct = false ;
3737 private boolean ignoreNulls = false ;
3838 private Expression filterExpression = null ;
39+ private WindowElement windowElement = null ;
3940
4041 public AnalyticExpression () {
4142 }
@@ -83,8 +84,6 @@ public KeepExpression getKeep() {
8384 public void setKeep (KeepExpression keep ) {
8485 this .keep = keep ;
8586 }
86-
87-
8887
8988 public ExpressionList getPartitionExpressionList () {
9089 return partitionBy .getPartitionExpressionList ();
@@ -93,10 +92,11 @@ public ExpressionList getPartitionExpressionList() {
9392 public void setPartitionExpressionList (ExpressionList partitionExpressionList ) {
9493 setPartitionExpressionList (partitionExpressionList , false );
9594 }
95+
9696 public void setPartitionExpressionList (ExpressionList partitionExpressionList , boolean brackets ) {
9797 partitionBy .setPartitionExpressionList (partitionExpressionList , brackets );
9898 }
99-
99+
100100 public boolean isPartitionByBrackets () {
101101 return partitionBy .isBrackets ();
102102 }
@@ -134,11 +134,11 @@ public void setDefaultValue(Expression defaultValue) {
134134 }
135135
136136 public WindowElement getWindowElement () {
137- return orderBy . getWindowElement () ;
137+ return windowElement ;
138138 }
139139
140140 public void setWindowElement (WindowElement windowElement ) {
141- orderBy . setWindowElement ( windowElement ) ;
141+ this . windowElement = windowElement ;
142142 }
143143
144144 public AnalyticType getType () {
@@ -197,7 +197,7 @@ public String toString() {
197197 b .append (filterExpression .toString ());
198198 b .append (") " );
199199 }
200-
200+
201201 switch (type ) {
202202 case WITHIN_GROUP :
203203 b .append ("WITHIN GROUP" );
@@ -210,6 +210,13 @@ public String toString() {
210210 partitionBy .toStringPartitionBy (b );
211211 orderBy .toStringOrderByElements (b );
212212
213+ if (windowElement != null ) {
214+ if (orderBy != null && orderBy .getOrderByElements ()!=null ) {
215+ b .append (' ' );
216+ }
217+ b .append (windowElement );
218+ }
219+
213220 b .append (")" );
214221
215222 return b .toString ();
0 commit comments