Search in sources :

Example 61 with Expression

use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.

the class CompareCriteria method clone.

/**
 * 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;
}
Also used : Expression(org.teiid.query.sql.symbol.Expression)

Example 62 with Expression

use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.

the class DependentSetCriteria method clone.

/**
 * Deep copy of object.  The values iterator source of this object
 * will not be cloned - it will be passed over as is and shared with
 * the original object, just like Reference.
 * @return Deep copy of object
 */
public DependentSetCriteria clone() {
    Expression copy = null;
    if (getExpression() != null) {
        copy = (Expression) getExpression().clone();
    }
    DependentSetCriteria criteriaCopy = new DependentSetCriteria(copy, id);
    if (this.valueExpression != null) {
        criteriaCopy.setValueExpression((Expression) getValueExpression().clone());
    }
    criteriaCopy.id = this.id;
    criteriaCopy.ndv = this.ndv;
    criteriaCopy.maxNdv = this.maxNdv;
    criteriaCopy.maxNdvs = this.maxNdvs;
    criteriaCopy.ndvs = this.ndvs;
    criteriaCopy.makeDepOptions = this.makeDepOptions;
    return criteriaCopy;
}
Also used : Expression(org.teiid.query.sql.symbol.Expression)

Example 63 with Expression

use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.

the class MatchCriteria method clone.

/**
 * 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();
    }
    MatchCriteria criteriaCopy = new MatchCriteria(leftCopy, rightCopy, getEscapeChar());
    criteriaCopy.setNegated(isNegated());
    criteriaCopy.mode = mode;
    return criteriaCopy;
}
Also used : Expression(org.teiid.query.sql.symbol.Expression)

Example 64 with Expression

use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.

the class TestGeometry method testSimplify.

@Test
public void testSimplify() throws Exception {
    Expression ex = TestFunctionResolving.getExpression("ST_AsText(ST_SIMPLIFY(ST_GeomFromText('LINESTRING(1 1,2 2,2 3.5,1 3,1 2,2 1)'), 1))");
    assertEquals("LINESTRING (1 1, 2 3.5, 2 1)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
    // ensure it creates an empty geometry
    ex = TestFunctionResolving.getExpression("ST_ISEmpty(ST_Simplify(ST_GeomFromText('POLYGON((6 3,1 -2,-4 3,1 8,6 3))'),5))");
    assertTrue((Boolean) Evaluator.evaluate(ex));
}
Also used : ClobType(org.teiid.core.types.ClobType) Expression(org.teiid.query.sql.symbol.Expression) Test(org.junit.Test)

Example 65 with Expression

use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.

the class TestGeometry method testAsText.

@Test
public void testAsText() throws Exception {
    Expression ex2 = TestFunctionResolving.getExpression("st_astext(ST_GeomFromText('POLYGON ((40 0, 50 50, 0 50, 0 0, 40 0))'))");
    Clob val = (Clob) Evaluator.evaluate(ex2);
    assertEquals("POLYGON ((40 0, 50 50, 0 50, 0 0, 40 0))", ClobType.getString(val));
}
Also used : Expression(org.teiid.query.sql.symbol.Expression) Clob(java.sql.Clob) Test(org.junit.Test)

Aggregations

Expression (org.teiid.query.sql.symbol.Expression)257 ElementSymbol (org.teiid.query.sql.symbol.ElementSymbol)104 ArrayList (java.util.ArrayList)74 GroupSymbol (org.teiid.query.sql.symbol.GroupSymbol)54 Test (org.junit.Test)53 PlanNode (org.teiid.query.optimizer.relational.plantree.PlanNode)50 List (java.util.List)49 Constant (org.teiid.query.sql.symbol.Constant)38 SymbolMap (org.teiid.query.sql.util.SymbolMap)37 HashMap (java.util.HashMap)22 LinkedList (java.util.LinkedList)22 Criteria (org.teiid.query.sql.lang.Criteria)22 Map (java.util.Map)21 ClobType (org.teiid.core.types.ClobType)16 CompareCriteria (org.teiid.query.sql.lang.CompareCriteria)16 HashSet (java.util.HashSet)13 LinkedHashSet (java.util.LinkedHashSet)13 AliasSymbol (org.teiid.query.sql.symbol.AliasSymbol)13 SearchedCaseExpression (org.teiid.query.sql.symbol.SearchedCaseExpression)13 OrderBy (org.teiid.query.sql.lang.OrderBy)12