public boolean isCardinalityDependent() { if (isDistinct()) { return false; } switch (getAggregateFunction()) { case MAX: case MIN: case ANY: case SOME: case EVERY: return false; case USER_DEFINED: return !getFunctionDescriptor().getMethod().getAggregateAttributes().usesDistinctRows(); } return true; }
public boolean isCardinalityDependent() { if (isDistinct()) { return false; } switch (getAggregateFunction()) { case MAX: case MIN: case ANY: case SOME: case EVERY: return false; case USER_DEFINED: return !getFunctionDescriptor().getMethod().getAggregateAttributes().usesDistinctRows(); } return true; }
public boolean isCardinalityDependent() { if (isDistinct()) { return false; } switch (getAggregateFunction()) { case MAX: case MIN: case ANY: case SOME: case EVERY: return false; case USER_DEFINED: return !getFunctionDescriptor().getMethod().getAggregateAttributes().usesDistinctRows(); } 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; }
/** * 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; }
if (expression.isDistinct()) { expression.setDistinct(false); if (expression.isDistinct() && expression.getAggregateFunction() == Type.USER_DEFINED && expression.getFunctionDescriptor().getMethod().getAggregateAttributes().usesDistinctRows()) { expression.setDistinct(false);
if (expression.getAggregateFunction() != Type.AVG && expression.isDistinct()) { expression.setDistinct(false); if (expression.isDistinct() && expression.getAggregateFunction() == Type.USER_DEFINED && expression.getFunctionDescriptor().getMethod().getAggregateAttributes().usesDistinctRows()) { expression.setDistinct(false);
if (expression.getAggregateFunction() != Type.AVG && expression.isDistinct()) { expression.setDistinct(false); if (expression.isDistinct() && expression.getAggregateFunction() == Type.USER_DEFINED && expression.getFunctionDescriptor().getMethod().getAggregateAttributes().usesDistinctRows()) { expression.setDistinct(false);
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; }
handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_one_argument", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getFunction().isDistinct() || windowFunction.getFunction().getCondition() != null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.analytic_restriction", windowFunction), windowFunction); //$NON-NLS-1$ handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.value_three_arguments", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getFunction().isDistinct() || windowFunction.getFunction().getCondition() != null) { handleValidationError(QueryPlugin.Util.getString("ValidationVisitor.analytic_restriction", windowFunction), windowFunction); //$NON-NLS-1$ if (windowFunction.getFunction().getOrderBy() != null || (windowFunction.getFunction().isDistinct() && windowFunction.getWindowSpecification().getOrderBy() != null)) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0042", new Object[] {windowFunction.getFunction(), windowFunction}), windowFunction); //$NON-NLS-1$
if (aggregateSymbol.isDistinct()) { if (distinct == null) { distinct = aggregateSymbol;
append("("); //$NON-NLS-1$ if (obj.isDistinct()) { append(DISTINCT); append(" "); //$NON-NLS-1$
&& windowFunction.getFunction().isDistinct()) { markInvalid(windowFunction, "Window function distinct aggregate not supported by source"); //$NON-NLS-1$ return;
append("("); //$NON-NLS-1$ if (obj.isDistinct()) { append(DISTINCT); append(" "); //$NON-NLS-1$
append("("); //$NON-NLS-1$ if (obj.isDistinct()) { append(DISTINCT); append(" "); //$NON-NLS-1$
&& windowFunction.getFunction().isDistinct()) { markInvalid(windowFunction, "Window function distinct aggregate not supported by source"); //$NON-NLS-1$ return;
&& windowFunction.getFunction().isDistinct()) { markInvalid(windowFunction, "Window function distinct aggregate not supported by source"); //$NON-NLS-1$ return;