use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestTextTable method testTextTableInvalidData.
@Test(expected = TeiidProcessingException.class)
public void testTextTableInvalidData() throws Exception {
// $NON-NLS-1$
String sql = "select count(*) from texttable(? COLUMNS PARTNAME string) x";
FakeDataManager dataManager = new FakeDataManager();
sampleData1(dataManager);
char[] data = new char[5000];
processPreparedStatement(sql, null, dataManager, new DefaultCapabilitiesFinder(), RealMetadataFactory.example1Cached(), Arrays.asList(new ClobType(new SerialClob(data))));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class MongoDBSelectVisitor method convertGeometryToJson.
private void convertGeometryToJson(BasicDBObjectBuilder builder, GeometryType object) throws TranslatorException {
try {
ClobType clob = GeometryUtils.geometryToGeoJson(object);
ClobToStringTransform clob2str = new ClobToStringTransform();
String geometry = (String) clob2str.transform(clob, String.class);
builder.add("$geometry", geometry);
} catch (FunctionExecutionException | TransformationException e) {
throw new TranslatorException(e);
}
}
use of org.teiid.core.types.ClobType 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));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testIntersection.
@Test
public void testIntersection() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(st_intersection(ST_GeomFromText('POLYGON ((0 50, 50 50, 40 0, 0 0, 0 50))'), ST_GeomFromText('POLYGON ((0 50, 40 50, 40 0, 0 0, 0 50))')))");
ClobType intersection = (ClobType) Evaluator.evaluate(ex);
assertEquals("POLYGON ((0 50, 40 50, 40 0, 0 0, 0 50))", ClobType.getString(intersection));
ex = TestFunctionResolving.getExpression("ST_AsText(st_intersection(ST_GeomFromText('POLYGON ((0 50, 50 50, 40 0, 0 0, 0 50))'), ST_GeomFromText('POLYGON ((150 50, 200 50, 190 0, 150 0, 150 50))')))");
intersection = (ClobType) Evaluator.evaluate(ex);
assertEquals("POLYGON EMPTY", ClobType.getString(intersection));
}
use of org.teiid.core.types.ClobType in project teiid by teiid.
the class TestGeometry method testEndPoint.
@Test
public void testEndPoint() throws Exception {
Expression ex = TestFunctionResolving.getExpression("ST_AsText(st_endpoint(ST_GEOMFROMTEXT('LINESTRING(0 0, 1 3)'))))");
assertEquals("POINT (1 3)", ClobType.getString((ClobType) Evaluator.evaluate(ex)));
}
Aggregations