use of com.thinkbiganalytics.kylo.spark.model.Statement in project kylo by Teradata.
the class TestLivyRestModelTransformer method simpleTestWithSchema.
@Test
public void simpleTestWithSchema() throws IOException {
final String json = TestUtils.getTestResourcesFileAsString("dataFrameStatementPostResponseWithSchema.json");
// JSON from String to Object
Statement statement = new ObjectMapper().readValue(json, Statement.class);
logger.info("response={}", statement);
TransformResponse response = LivyRestModelTransformer.toTransformResponse(statement, "testTableName");
assertThat(response).hasFieldOrPropertyWithValue("status", TransformResponse.Status.SUCCESS);
assertThat(response).hasFieldOrPropertyWithValue("progress", 1.0);
TransformQueryResult tqr = response.getResults();
assertThat(tqr).isNotNull();
List<QueryResultColumn> cols = tqr.getColumns();
assertThat(cols).isNotNull();
QueryResultColumn dt0 = cols.get(0);
assertThat(dt0).hasFieldOrPropertyWithValue("dataType", "integer");
List<Object> row1 = Lists.newArrayList(1, "Toyota Park", "Bridgeview", "IL", 0, "1527526048390");
assertThat(tqr.getRows()).contains(row1);
}
Aggregations