use of com.thinkbiganalytics.spark.metadata.QueryResultRowTransform in project kylo by Teradata.
the class TransformService method execute.
/**
* Executes the specified transformation and returns the name of the Hive table containing the results.
*
* @param request the transformation request
* @return the Hive table containing the results
* @throws IllegalStateException if this service is not running
* @throws ScriptException if the script cannot be executed
*/
@Nonnull
public TransformResponse execute(@Nonnull final TransformRequest request) throws ScriptException {
log.entry(request);
// Handle async request
if (request.isAsync()) {
return cacheTransform(request);
}
// Execute script
final DataSet dataSet = createShellTask(request);
final StructType schema = dataSet.schema();
TransformResponse response = submitTransformJob(new ShellTransformStage(dataSet), getPolicies(request));
// Build response
if (response.getStatus() != TransformResponse.Status.SUCCESS) {
final String table = response.getTable();
final TransformQueryResult partialResult = new TransformQueryResult();
partialResult.setColumns(Arrays.<QueryResultColumn>asList(new QueryResultRowTransform(schema, table).columns()));
response = new TransformResponse();
response.setProgress(0.0);
response.setResults(partialResult);
response.setStatus(TransformResponse.Status.PENDING);
response.setTable(table);
}
return log.exit(response);
}
Aggregations