@Override public WindowSpecification clone() { WindowSpecification clone = new WindowSpecification(); if (this.partition != null) { clone.setPartition(LanguageObject.Util.deepClone(this.partition, Expression.class)); } if (this.orderBy != null) { clone.setOrderBy(this.orderBy.clone()); } return clone; }
@Override public WindowSpecification clone() { WindowSpecification clone = new WindowSpecification(); if (this.partition != null) { clone.setPartition(LanguageObject.Util.deepClone(this.partition, Expression.class)); } if (this.orderBy != null) { clone.setOrderBy(this.orderBy.clone()); } if (this.windowFrame != null) { clone.setWindowFrame(this.windowFrame.clone()); } return clone; }
@Override public WindowSpecification clone() { WindowSpecification clone = new WindowSpecification(); if (this.partition != null) { clone.setPartition(LanguageObject.Util.deepClone(this.partition, Expression.class)); } if (this.orderBy != null) { clone.setOrderBy(this.orderBy.clone()); } if (this.windowFrame != null) { clone.setWindowFrame(this.windowFrame.clone()); } return clone; }
@Test public void testWindowFunction() throws Exception { String sql = "select row_number() over (partition by x order by y) from g"; Query query = new Query(); WindowFunction wf = new WindowFunction(); wf.setFunction(new AggregateSymbol("ROW_NUMBER", false, null)); WindowSpecification ws = new WindowSpecification(); ws.setPartition(new ArrayList<Expression>(Arrays.asList(new ElementSymbol("x")))); ws.setOrderBy(new OrderBy(Arrays.asList(new ElementSymbol("y")))); wf.setWindowSpecification(ws); query.setSelect(new Select(Arrays.asList(wf))); query.setFrom(new From(Arrays.asList(new UnaryFromClause(new GroupSymbol("g"))))); helpTest(sql, "SELECT ROW_NUMBER() OVER (PARTITION BY x ORDER BY y) FROM g", query); }
WindowSpecification ws = new WindowSpecification(); result.setFunction((AggregateSymbol)agg); ws.setPartition(partitionList); ws.setOrderBy(orderBy); result.setWindowSpecification(ws);
WindowSpecification ws = new WindowSpecification(); result.setFunction((AggregateSymbol)agg); ws.setPartition(partitionList); ws.setOrderBy(orderBy); ws.setWindowFrame(frame);
WindowSpecification ws = new WindowSpecification(); result.setFunction((AggregateSymbol)agg); ws.setPartition(partitionList); ws.setOrderBy(orderBy); ws.setWindowFrame(frame);