use of com.thinkbiganalytics.spark.rest.model.TransformRequest in project kylo by Teradata.
the class TransformServiceTest method toScriptWithParent.
/**
* Verify converting a transformation request with a parent to a Scala script.
*/
@Test
public void toScriptWithParent() throws Exception {
// Build the request
final TransformRequest.Parent parent = new TransformRequest.Parent();
parent.setScript("sqlContext.range(1,10)");
parent.setTable("parent_table");
final TransformRequest request = new TransformRequest();
request.setParent(parent);
request.setScript("parent.withColumn(functions.expr(\"id+1\")");
// Test converting request to script
final TransformService service = new TransformService(TransformScript.class, Mockito.mock(SparkScriptEngine.class), Mockito.mock(SparkContextService.class), Mockito.mock(JobTrackerService.class));
InputStream inputStream = getClass().getResourceAsStream("transform-service-script2.scala");
final String expected = IOUtils.toString(inputStream, "UTF-8");
Assert.assertEquals(expected, service.toScript(request));
}
use of com.thinkbiganalytics.spark.rest.model.TransformRequest in project kylo by Teradata.
the class SparkFileSchemaParserService method createTransformRequest.
// Port: 8450
private TransformRequest createTransformRequest(File localFile, SparkFileType fileType) {
TransformRequest transformRequest = new TransformRequest();
transformRequest.setScript(toScript(localFile, fileType));
return transformRequest;
}
Aggregations