/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(Function obj) { if (this.functionName == null || obj.getName().equalsIgnoreCase(this.functionName)) { this.functions.add(obj); } }
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(Function obj) { if (this.functionName == null || obj.getName().equalsIgnoreCase(this.functionName)) { this.functions.add(obj); } }
/** * Visit a language object and collect symbols. This method should <b>NOT</b> be * called directly. * @param obj Language object */ public void visit(Function obj) { if (this.functionName == null || obj.getName().equalsIgnoreCase(this.functionName)) { this.functions.add(obj); } }
private boolean isSimpleMathematicalFunction(Function function) { String funcName = function.getName(); if(funcName.equals("+") || funcName.equals("-") || funcName.equals("*") || funcName.equals("/")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Expression[] args = function.getArgs(); if(args[0] instanceof Constant || args[1] instanceof Constant) { return true; } } // fall through - not simple mathematical return false; }
public static boolean isConvert(Function function) { Expression[] args = function.getArgs(); String funcName = function.getName(); return args.length == 2 && (funcName.equalsIgnoreCase(FunctionLibrary.CONVERT) || funcName.equalsIgnoreCase(FunctionLibrary.CAST)); }
public static boolean isConvert(Function function) { Expression[] args = function.getArgs(); String funcName = function.getName(); return args.length == 2 && (funcName.equalsIgnoreCase(FunctionLibrary.CONVERT) || funcName.equalsIgnoreCase(FunctionLibrary.CAST)); }
private boolean isSimpleMathematicalFunction(Function function) { String funcName = function.getName(); if(funcName.equals("+") || funcName.equals("-") || funcName.equals("*") || funcName.equals("/")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Expression[] args = function.getArgs(); if(args[0] instanceof Constant || args[1] instanceof Constant) { return true; } } // fall through - not simple mathematical return false; }
public static boolean isConvert(Function function) { Expression[] args = function.getArgs(); String funcName = function.getName(); return args.length == 2 && (funcName.equalsIgnoreCase(FunctionLibrary.CONVERT) || funcName.equalsIgnoreCase(FunctionLibrary.CAST)); }
private boolean isSimpleMathematicalFunction(Function function) { String funcName = function.getName(); if(funcName.equals("+") || funcName.equals("-") || funcName.equals("*") || funcName.equals("/")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ Expression[] args = function.getArgs(); if(args[0] instanceof Constant || args[1] instanceof Constant) { return true; } } // fall through - not simple mathematical return false; }
/** * @see org.teiid.query.sql.visitor.ExpressionMappingVisitor#replaceExpression(org.teiid.query.sql.symbol.Expression) */ public Expression replaceExpression(Expression exp) { if (exp instanceof Function){ Function function = (Function)exp; if (function.getName().equalsIgnoreCase(FunctionLibrary.CONTEXT)){ this.contextFunctions.add(function); //return 2nd argument to 'context' return function.getArg(1); } } return exp; }
/** * Compute hash code for the object - based on name and hashcode of first arg (if there is one) * @return Hash code */ public int hashCode() { int hashCode = HashCodeUtil.hashCode(0, this.getName().toUpperCase()); Expression[] thisArgs = getArgs(); if(thisArgs != null && thisArgs.length > 0 && thisArgs[0] != null) { hashCode = HashCodeUtil.hashCode(hashCode, thisArgs[0].hashCode()); } return hashCode; }
/** * Compute hash code for the object - based on name and hashcode of first arg (if there is one) * @return Hash code */ public int hashCode() { int hashCode = HashCodeUtil.hashCode(0, this.getName().toUpperCase()); Expression[] thisArgs = getArgs(); if(thisArgs != null && thisArgs.length > 0 && thisArgs[0] != null) { hashCode = HashCodeUtil.hashCode(hashCode, thisArgs[0].hashCode()); } return hashCode; }
/** * Compute hash code for the object - based on name and hashcode of first arg (if there is one) * @return Hash code */ public int hashCode() { int hashCode = HashCodeUtil.hashCode(0, this.getName().toUpperCase()); Expression[] thisArgs = getArgs(); if(thisArgs != null && thisArgs.length > 0 && thisArgs[0] != null) { hashCode = HashCodeUtil.hashCode(hashCode, thisArgs[0].hashCode()); } return hashCode; }
public Expression replaceExpression(Expression element) { if (element instanceof Function && !(element instanceof AggregateSymbol) && ((Function) element).isAggregate()) { Function f = (Function)element; AggregateSymbol as = new AggregateSymbol(f.getName(), false, f.getArgs(), null); as.setType(f.getType()); as.setFunctionDescriptor(f.getFunctionDescriptor()); return as; } return element; } };
public Expression replaceExpression(Expression element) { if (element instanceof Function && !(element instanceof AggregateSymbol) && ((Function) element).isAggregate()) { Function f = (Function)element; AggregateSymbol as = new AggregateSymbol(f.getName(), false, f.getArgs(), null); as.setType(f.getType()); as.setFunctionDescriptor(f.getFunctionDescriptor()); return as; } return element; } };
public Expression replaceExpression(Expression element) { if (element instanceof Function && !(element instanceof AggregateSymbol) && ((Function) element).isAggregate()) { Function f = (Function)element; AggregateSymbol as = new AggregateSymbol(f.getName(), false, f.getArgs(), null); as.setType(f.getType()); as.setFunctionDescriptor(f.getFunctionDescriptor()); return as; } return element; } };
/** * Return a deep copy of this object. * @return Deep copy of the object */ public Object clone() { Expression[] copyArgs = LanguageObject.Util.deepClone(this.args); Function copy = new Function(getName(), copyArgs); copy.setType(getType()); copy.setFunctionDescriptor(getFunctionDescriptor()); if(this.isImplicit()) { copy.makeImplicit(); } copy.eval = this.eval; return copy; }
/** * Return a deep copy of this object. * @return Deep copy of the object */ public Object clone() { Expression[] copyArgs = LanguageObject.Util.deepClone(this.args); Function copy = new Function(getName(), copyArgs); copy.setType(getType()); copy.setFunctionDescriptor(getFunctionDescriptor()); if(this.isImplicit()) { copy.makeImplicit(); } copy.eval = this.eval; return copy; }
/** * Return a deep copy of this object. * @return Deep copy of the object */ public Object clone() { Expression[] copyArgs = LanguageObject.Util.deepClone(this.args); Function copy = new Function(getName(), copyArgs); copy.setType(getType()); copy.setFunctionDescriptor(getFunctionDescriptor()); if(this.isImplicit()) { copy.makeImplicit(); } copy.eval = this.eval; return copy; }
public void visit(Function obj) { FunctionDescriptor fd = obj.getFunctionDescriptor(); this.setDeterminismLevel(fd.getDeterministic()); if (fd.getDeterministic() == Determinism.NONDETERMINISTIC || fd.getPushdown() == PushDown.MUST_PUSHDOWN) { if (obj.isEval()) { evaluationNotPossible(EvaluationLevel.PROCESSING); } else { evaluationNotPossible(EvaluationLevel.PUSH_DOWN); } } else if (obj.getName().equalsIgnoreCase(FunctionLibrary.LOOKUP) //TODO: if we had the context here we could plan better for non-prepared requests || fd.getDeterministic().compareTo(Determinism.COMMAND_DETERMINISTIC) <= 0) { evaluationNotPossible(EvaluationLevel.PROCESSING); } else if (fd.getProcedure() != null) { //a function defined by a procedure evaluationNotPossible(EvaluationLevel.PROCESSING); } }