Search in sources :

Example 1 with Projection

use of com.hortonworks.streamline.streams.catalog.Projection in project streamline by hortonworks.

the class StreamCatalogServiceTest method testgetSqlString.

@Test
public void testgetSqlString() {
    List<String> streams = Collections.singletonList("kafka_stream_1");
    List<String> gbk = Collections.singletonList("a.b.c");
    List<Projection> projections = Collections.singletonList(new Projection("f1.g.h", null, null, null));
    String sql = streamCatalogService.getSqlString(streams, projections, "f1.a.b = kafka_stream_1.g.h", gbk);
    assertEquals("SELECT f1['g']['h'] FROM kafka_stream_1 WHERE f1['a']['b'] = kafka_stream_1.g['h'] GROUP BY a['b']['c']", sql);
    projections = Collections.singletonList(new Projection(null, "foo", Arrays.asList("a.b", "kafka_stream_1.c.d"), "res"));
    sql = streamCatalogService.getSqlString(streams, projections, "f1.a.b = kafka_stream_1.g.h", gbk);
    assertEquals("SELECT foo(a['b'],kafka_stream_1.c['d']) AS \"res\" FROM kafka_stream_1 WHERE f1['a']['b'] = kafka_stream_1.g['h'] GROUP BY a['b']['c']", sql);
}
Also used : Projection(com.hortonworks.streamline.streams.catalog.Projection) Test(org.junit.Test)

Aggregations

Projection (com.hortonworks.streamline.streams.catalog.Projection)1 Test (org.junit.Test)1