Search in sources :

Example 71 with Expression

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

the class TestGeometry method testX.

@Test
public void testX() throws Exception {
    Expression ex = TestFunctionResolving.getExpression("ST_X(ST_GeomFromText('POINT(1 2)'))");
    assertEquals(1.0, Evaluator.evaluate(ex));
}
Also used : Expression(org.teiid.query.sql.symbol.Expression) Test(org.junit.Test)

Example 72 with Expression

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

the class TestGeometry method testEquals.

@Test
public void testEquals() throws Exception {
    Expression ex = TestFunctionResolving.getExpression("ST_Equals (ST_GeomFromText('LINESTRING(-1 2, 0 3)'), ST_GeomFromText('LINESTRING(0 3, -1 2)'))");
    Boolean b = (Boolean) Evaluator.evaluate(ex);
    assertTrue(b);
    ex = TestFunctionResolving.getExpression("ST_Equals (ST_GeomFromText('LINESTRING(0 0, 0 1, 0 3)'), ST_GeomFromText('LINESTRING(0 3, 0 0)'))");
    b = (Boolean) Evaluator.evaluate(ex);
    assertTrue(b);
    ex = TestFunctionResolving.getExpression("ST_Equals (ST_GeomFromText('LINESTRING(0 1, 0 3)'), ST_GeomFromText('LINESTRING(0 3, 0 0)'))");
    b = (Boolean) Evaluator.evaluate(ex);
    assertFalse(b);
}
Also used : Expression(org.teiid.query.sql.symbol.Expression) Test(org.junit.Test)

Example 73 with Expression

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

the class TestGeometry method testIntersects.

@Test
public void testIntersects() throws Exception {
    Expression ex = TestFunctionResolving.getExpression("st_intersects(ST_GeomFromText('POLYGON ((40 0, 50 50, 0 50, 0 0, 40 0))'), ST_GeomFromText('POLYGON ((40 0, 50 50, 0 50, 0 0, 40 0))'))");
    Boolean b = (Boolean) Evaluator.evaluate(ex);
    assertTrue(b);
    ex = TestFunctionResolving.getExpression("st_intersects(ST_GeomFromText('POLYGON ((100 100, 200 200, 75 75, 100 100))'), ST_GeomFromText('POLYGON ((43 0, 50 50, 0 50, 0 0, 43 0))'))");
    b = (Boolean) Evaluator.evaluate(ex);
    assertFalse(b);
}
Also used : Expression(org.teiid.query.sql.symbol.Expression) Test(org.junit.Test)

Example 74 with Expression

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

the class TestGeometry method testPointN.

@Test
public void testPointN() throws Exception {
    Expression ex = TestFunctionResolving.getExpression("ST_AsText(ST_PointN(ST_GeomFromText('LINESTRING(1 2, 3 2, 1 2)'),4))");
    assertNull(Evaluator.evaluate(ex));
}
Also used : Expression(org.teiid.query.sql.symbol.Expression) Test(org.junit.Test)

Example 75 with Expression

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

the class TestGeometry method testHasArc.

@Test
public void testHasArc() throws Exception {
    Expression ex = TestFunctionResolving.getExpression("(st_hasarc(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 3)')))");
    assertFalse((Boolean) Evaluator.evaluate(ex));
}
Also used : Expression(org.teiid.query.sql.symbol.Expression) 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