use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testEnvelope.
@Test
public void testEnvelope() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(ST_Envelope(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 3)')))");
ClobType c = (ClobType) Evaluator.evaluate(ex);
assertEquals("POLYGON ((0 0, 0 3, 1 3, 1 0, 0 0))", ClobType.getString(c));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testStartPoint.
@Test
public void testStartPoint() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(st_startpoint(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 3)'))))");
assertEquals("POINT (0 0)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testRelate.
@Test
public void testRelate() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_Relate(ST_GeomFromText('POINT(1 2)'), ST_Buffer(ST_GeomFromText('POINT(1 2)'),2))");
assertEquals("0FFFFF212", Evaluator.evaluate(ex));
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testEwkb.
@Test(expected = ExpressionEvaluationException.class)
public void testEwkb() throws Exception {
WKBWriter writer = new WKBWriter(3, true);
GeometryFactory gf = new GeometryFactory();
Point point = gf.createPoint(new Coordinate(0, 0, 0));
point.setSRID(100);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
writer.write(point, new OutputStreamOutStream(baos));
Expression ex1 = TestFunctionResolving.getExpression("ST_GeomFromBinary(X'" + new BinaryType(baos.toByteArray()) + "', 8307)");
Evaluator.evaluate(ex1);
}
use of org.teiid.query.sql.symbol.Expression in project teiid by teiid.
the class TestGeometry method testCoordDims.
@Test
public void testCoordDims() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_CoordDim(ST_GEOMFROMTEXT('LINESTRING EMPTY'))");
assertEquals(2, Evaluator.evaluate(ex));
}
Aggregations