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));
}
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);
}
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);
}
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));
}
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));
}
Aggregations