if (symbol.getArgs().length != 1 || symbol.isCardinalityDependent()) { continue;
if (symbol.getArgs().length != 1 || symbol.isCardinalityDependent()) { continue;
private static boolean isCountStar(AggregateSymbol as) { return as.getAggregateFunction() == Type.COUNT && (as.getArgs().length == 0 || EvaluatableVisitor.willBecomeConstant(as.getArg(0))); }
private static boolean isCountStar(AggregateSymbol as) { return as.isCount() && (as.getArgs().length == 0 || EvaluatableVisitor.willBecomeConstant(as.getArg(0))); }
private static boolean isCountStar(AggregateSymbol as) { return as.isCount() && (as.getArgs().length == 0 || EvaluatableVisitor.willBecomeConstant(as.getArg(0))); }
public boolean canStage() { if (orderBy != null) { return false; } switch (this.aggregate) { case TEXTAGG: case ARRAY_AGG: case JSONARRAY_AGG: case STRING_AGG: return false; case USER_DEFINED: return this.getArgs().length == 1 && this.getFunctionDescriptor().getMethod().getAggregateAttributes().isDecomposable(); } return true; }
public boolean canStage() { if (orderBy != null) { return false; } switch (this.aggregate) { case TEXTAGG: case ARRAY_AGG: case JSONARRAY_AGG: case STRING_AGG: return false; case USER_DEFINED: return this.getArgs().length == 1 && this.getFunctionDescriptor().getMethod().getAggregateAttributes().isDecomposable(); } return true; }
public boolean canStage() { if (orderBy != null) { return false; } switch (this.aggregate) { case TEXTAGG: case ARRAY_AGG: case JSONARRAY_AGG: case STRING_AGG: return false; case USER_DEFINED: return this.getArgs().length == 1 && this.getFunctionDescriptor().getMethod().getAggregateAttributes().isDecomposable(); } return true; }
AggregateFunction translate(AggregateSymbol symbol) { List<org.teiid.language.Expression> params = new ArrayList<org.teiid.language.Expression>(symbol.getArgs().length); for (Expression expression : symbol.getArgs()) { params.add(translate(expression)); } String name = symbol.getAggregateFunction().name(); if (symbol.getAggregateFunction() == AggregateSymbol.Type.USER_DEFINED) { name = symbol.getName(); } AggregateFunction af = new AggregateFunction(name, symbol.isDistinct(), params, symbol.getType()); af.setCondition(translate(symbol.getCondition())); af.setOrderBy(translate(symbol.getOrderBy(), false)); return af; }
public void visit(AggregateSymbol obj) { preVisitVisitor(obj); Expression[] args = obj.getArgs(); if(args != null) { for(int i=0; i<args.length; i++) { visitNode(args[i]); } } visitNode(obj.getOrderBy()); visitNode(obj.getCondition()); postVisitVisitor(obj); } public void visit(AliasSymbol obj) {
public void visit(AggregateSymbol obj) { preVisitVisitor(obj); Expression[] args = obj.getArgs(); if(args != null) { for(int i=0; i<args.length; i++) { visitNode(args[i]); } } visitNode(obj.getOrderBy()); visitNode(obj.getCondition()); postVisitVisitor(obj); } public void visit(AliasSymbol obj) {
public void visit(AggregateSymbol obj) { preVisitVisitor(obj); Expression[] args = obj.getArgs(); if(args != null) { for(int i=0; i<args.length; i++) { visitNode(args[i]); } } visitNode(obj.getOrderBy()); visitNode(obj.getCondition()); postVisitVisitor(obj); } public void visit(AliasSymbol obj) {
AggregateFunction translate(AggregateSymbol symbol) { List<org.teiid.language.Expression> params = new ArrayList<org.teiid.language.Expression>(symbol.getArgs().length); for (Expression expression : symbol.getArgs()) { params.add(translate(expression)); } String name = symbol.getAggregateFunction().name(); if (symbol.getFunctionDescriptor() != null) { name = Symbol.getShortName(symbol.getFunctionDescriptor().getName()); } else if (symbol.getAggregateFunction() == AggregateSymbol.Type.USER_DEFINED) { name = symbol.getName(); } else if (symbol.getAggregateFunction() == Type.COUNT_BIG && !supportsCountBig) { name = Type.COUNT.name(); } AggregateFunction af = new AggregateFunction(name, symbol.isDistinct(), params, symbol.getType()); af.setCondition(translate(symbol.getCondition())); af.setOrderBy(translate(symbol.getOrderBy(), false)); if (symbol.getFunctionDescriptor() != null) { af.setMetadataObject(symbol.getFunctionDescriptor().getMethod()); } return af; }
AggregateFunction translate(AggregateSymbol symbol) { List<org.teiid.language.Expression> params = new ArrayList<org.teiid.language.Expression>(symbol.getArgs().length); for (Expression expression : symbol.getArgs()) { params.add(translate(expression)); } String name = symbol.getAggregateFunction().name(); if (symbol.getFunctionDescriptor() != null) { name = Symbol.getShortName(symbol.getFunctionDescriptor().getName()); } else if (symbol.getAggregateFunction() == AggregateSymbol.Type.USER_DEFINED) { name = symbol.getName(); } else if (symbol.getAggregateFunction() == Type.COUNT_BIG && !supportsCountBig) { name = Type.COUNT.name(); } AggregateFunction af = new AggregateFunction(name, symbol.isDistinct(), params, symbol.getType()); af.setCondition(translate(symbol.getCondition())); af.setOrderBy(translate(symbol.getOrderBy(), false)); if (symbol.getFunctionDescriptor() != null) { af.setMetadataObject(symbol.getFunctionDescriptor().getMethod()); } return af; }
/** * Return a deep copy of this object */ public Object clone() { AggregateSymbol copy = new AggregateSymbol(getName(), getAggregateFunction(), isDistinct(), LanguageObject.Util.deepClone(getArgs())); if (orderBy != null) { copy.setOrderBy(orderBy.clone()); } if (condition != null) { copy.setCondition((Expression) condition.clone()); } copy.isWindowed = this.isWindowed; copy.type = this.type; copy.setFunctionDescriptor(getFunctionDescriptor()); return copy; }
/** * Return a deep copy of this object */ public Object clone() { AggregateSymbol copy = new AggregateSymbol(getName(), getAggregateFunction(), isDistinct(), LanguageObject.Util.deepClone(getArgs())); if (orderBy != null) { copy.setOrderBy(orderBy.clone()); } if (condition != null) { copy.setCondition((Expression) condition.clone()); } copy.isWindowed = this.isWindowed; copy.type = this.type; copy.setFunctionDescriptor(getFunctionDescriptor()); return copy; }
/** * Return a deep copy of this object */ public Object clone() { AggregateSymbol copy = new AggregateSymbol(getName(), getAggregateFunction(), isDistinct(), LanguageObject.Util.deepClone(getArgs())); if (orderBy != null) { copy.setOrderBy(orderBy.clone()); } if (condition != null) { copy.setCondition((Expression) condition.clone()); } copy.isWindowed = this.isWindowed; copy.type = this.type; copy.setFunctionDescriptor(getFunctionDescriptor()); return copy; }
private WindowFunctionInfo createWindowFunctionInfo(WindowFunction wf) { WindowFunctionInfo wfi = new WindowFunctionInfo(); wfi.function = wf; //collect the agg expressions for (Expression e : wf.getFunction().getArgs()) { GroupingNode.getIndex(e, expressionIndexes); } if (wf.getFunction().getOrderBy() != null) { for (OrderByItem item : wf.getFunction().getOrderBy().getOrderByItems()) { GroupingNode.getIndex(item.getSymbol(), expressionIndexes); } } if (wf.getFunction().getCondition() != null) { GroupingNode.getIndex(wf.getFunction().getCondition(), expressionIndexes); } return wfi; }
private WindowFunctionInfo createWindowFunctionInfo(WindowFunction wf) { WindowFunctionInfo wfi = new WindowFunctionInfo(); wfi.function = wf; //collect the agg expressions for (Expression e : wf.getFunction().getArgs()) { GroupingNode.getIndex(e, expressionIndexes); } if (wf.getFunction().getOrderBy() != null) { for (OrderByItem item : wf.getFunction().getOrderBy().getOrderByItems()) { GroupingNode.getIndex(item.getSymbol(), expressionIndexes); } } if (wf.getFunction().getCondition() != null) { GroupingNode.getIndex(wf.getFunction().getCondition(), expressionIndexes); } return wfi; }