@Override public void visit(CompareCriteria obj) { if (isNonComparable(obj.getLeftExpression())) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0027", obj, DataTypeManager.getDataTypeName(obj.getLeftExpression().getType())),obj); //$NON-NLS-1$ } }
public void visit(CompareCriteria compCrit){ if (compCrit.getOperator() == CompareCriteria.EQ && checkForInput(compCrit.getLeftExpression()) && !checkForAnyInput(compCrit.getRightExpression())) { addInputNode((Reference)compCrit.getLeftExpression()); } }
public void visit(CompareCriteria compCrit){ if (compCrit.getOperator() == CompareCriteria.EQ && checkForInput(compCrit.getLeftExpression()) && !checkForAnyInput(compCrit.getRightExpression())) { addInputNode((Reference)compCrit.getLeftExpression()); } }
public void visit(CompareCriteria compCrit){ if (compCrit.getOperator() == CompareCriteria.EQ && checkForInput(compCrit.getLeftExpression()) && !checkForAnyInput(compCrit.getRightExpression())) { addInputNode((Reference)compCrit.getLeftExpression()); } }
@Override public void visit(CompareCriteria obj) { if (isNonComparable(obj.getLeftExpression())) { handleValidationError(QueryPlugin.Util.getString("ERR.015.012.0027", obj, DataTypeManager.getDataTypeName(obj.getLeftExpression().getType())),obj); //$NON-NLS-1$ } }
/** * Deep copy of object * @return Deep copy of object */ public Object clone() { Expression leftCopy = null; if(getLeftExpression() != null) { leftCopy = (Expression) getLeftExpression().clone(); } Expression rightCopy = null; if(getRightExpression() != null) { rightCopy = (Expression) getRightExpression().clone(); } CompareCriteria result = new CompareCriteria(leftCopy, getOperator(), rightCopy); result.isOptional = isOptional; return result; }
/** * @see org.teiid.query.sql.LanguageVisitor#visit(CompareCriteria) */ public void visit(CompareCriteria obj) { obj.setLeftExpression( replaceExpression(obj.getLeftExpression()) ); obj.setRightExpression( replaceExpression(obj.getRightExpression()) ); }
/** * @see org.teiid.query.sql.LanguageVisitor#visit(CompareCriteria) */ public void visit(CompareCriteria obj) { obj.setLeftExpression( replaceExpression(obj.getLeftExpression()) ); obj.setRightExpression( replaceExpression(obj.getRightExpression()) ); }
private Criteria simplifyWithInverse(CompareCriteria criteria) throws TeiidProcessingException{ Expression leftExpr = criteria.getLeftExpression(); Function leftFunction = (Function) leftExpr; if(isSimpleMathematicalFunction(leftFunction)) { return simplifyMathematicalCriteria(criteria); } if (FunctionLibrary.isConvert(leftFunction)) { return simplifyConvertFunction(criteria); } return simplifyParseFormatFunction(criteria); }
/** * @see org.teiid.query.sql.LanguageVisitor#visit(CompareCriteria) */ public void visit(CompareCriteria obj) { obj.setLeftExpression( replaceExpression(obj.getLeftExpression()) ); obj.setRightExpression( replaceExpression(obj.getRightExpression()) ); }
public void visit(CompareCriteria obj) { preVisitVisitor(obj); visitNode(obj.getLeftExpression()); visitNode(obj.getRightExpression()); postVisitVisitor(obj); } public void visit(CompoundCriteria obj) {
public void visit(CompareCriteria obj) { preVisitVisitor(obj); visitNode(obj.getLeftExpression()); visitNode(obj.getRightExpression()); postVisitVisitor(obj); } public void visit(CompoundCriteria obj) {
private Criteria simplifyWithInverse(CompareCriteria criteria) throws TeiidProcessingException{ Expression leftExpr = criteria.getLeftExpression(); Function leftFunction = (Function) leftExpr; if(isSimpleMathematicalFunction(leftFunction)) { return simplifyMathematicalCriteria(criteria); } if (FunctionLibrary.isConvert(leftFunction)) { return simplifyConvertFunction(criteria); } return simplifyParseFormatFunction(criteria); }
private Criteria simplifyWithInverse(CompareCriteria criteria) throws TeiidProcessingException{ Expression leftExpr = criteria.getLeftExpression(); Function leftFunction = (Function) leftExpr; if(isSimpleMathematicalFunction(leftFunction)) { return simplifyMathematicalCriteria(criteria); } if (FunctionLibrary.isConvert(leftFunction)) { return simplifyConvertFunction(criteria); } return simplifyParseFormatFunction(criteria); }
public void visit(CompareCriteria obj) { preVisitVisitor(obj); visitNode(obj.getLeftExpression()); visitNode(obj.getRightExpression()); postVisitVisitor(obj); } public void visit(CompoundCriteria obj) {
/** * Get hash code. WARNING: The hash code is based on data in the criteria. * If data values are changed, the hash code will change - don't hash this * object and change values. * @return Hash code */ public int hashCode() { int hc = 0; hc = HashCodeUtil.hashCode(hc, getOperator()); //allow for semantic equivalence hc += HashCodeUtil.hashCode(0, getLeftExpression()); hc += HashCodeUtil.hashCode(0, getRightExpression()); return hc; }
/** * Get hash code. WARNING: The hash code is based on data in the criteria. * If data values are changed, the hash code will change - don't hash this * object and change values. * @return Hash code */ public int hashCode() { int hc = 0; hc = HashCodeUtil.hashCode(hc, getOperator()); //allow for semantic equivalence hc += HashCodeUtil.hashCode(0, getLeftExpression()); hc += HashCodeUtil.hashCode(0, getRightExpression()); return hc; }
/** * Get hash code. WARNING: The hash code is based on data in the criteria. * If data values are changed, the hash code will change - don't hash this * object and change values. * @return Hash code */ public int hashCode() { int hc = 0; hc = HashCodeUtil.hashCode(hc, getOperator()); //allow for semantic equivalence hc += HashCodeUtil.hashCode(0, getLeftExpression()); hc += HashCodeUtil.hashCode(0, getRightExpression()); return hc; }
@Test public void testCharCompareString() { TransformationMetadata tm = RealMetadataFactory.exampleBQTCached().getDesignTimeMetadata(); tm.setWidenComparisonToString(false); Command c = helpResolve("select * from bqt1.smalla where bqt1.smalla.charValue = 'a'", tm); Query q = (Query)c; assertTrue(((CompareCriteria)q.getCriteria()).getLeftExpression() instanceof ElementSymbol); }
@Test public void testNonAutoConversionOfLiteralIntegerToShort2() throws Exception { // parse Query command = (Query) QueryParser.getQueryParser().parseCommand("SELECT intkey FROM bqt1.smalla WHERE 5 = shortvalue"); //$NON-NLS-1$ // resolve QueryResolver.resolveCommand(command, RealMetadataFactory.exampleBQTCached()); // Check whether an implicit conversion was added on the correct side CompareCriteria crit = (CompareCriteria) command.getCriteria(); assertEquals(DataTypeManager.DefaultDataClasses.SHORT, crit.getLeftExpression().getType()); assertEquals("Sql is incorrect after resolving", "SELECT intkey FROM bqt1.smalla WHERE 5 = shortvalue", command.toString()); //$NON-NLS-1$ //$NON-NLS-2$ }