Search in sources :

Example 1 with JobUpdateEvent

use of com.airbnb.airpal.api.event.JobUpdateEvent in project airpal by airbnb.

the class Execution method updateJobInfo.

protected void updateJobInfo(Set<Table> usedTables, List<Column> columns, QueryStats queryStats, JobState state, QueryError error, List<List<Object>> outputPreview, boolean postUpdate) {
    if ((usedTables != null) && (usedTables.size() > 0)) {
        job.getTablesUsed().addAll(usedTables);
    }
    if ((columns != null) && (columns.size() > 0)) {
        job.setColumns(columns);
    }
    if (queryStats != null) {
        job.setQueryStats(queryStats);
    }
    if ((state != null) && (job.getState() != JobState.FINISHED) && (job.getState() != JobState.FAILED)) {
        job.setState(state);
    }
    if (error != null) {
        FailureInfo failureInfo = new FailureInfo(error.getFailureInfo().getType(), error.getFailureInfo().getMessage(), null, Collections.<FailureInfo>emptyList(), Collections.<String>emptyList(), error.getFailureInfo().getErrorLocation());
        QueryError queryError = new QueryError(error.getMessage(), error.getSqlState(), error.getErrorCode(), error.getErrorName(), error.getErrorType(), error.getErrorLocation(), failureInfo);
        job.setError(queryError);
    }
    if (postUpdate) {
        eventBus.post(new JobUpdateEvent(job, outputPreview));
    }
}
Also used : FailureInfo(com.facebook.presto.client.FailureInfo) QueryError(com.facebook.presto.client.QueryError) JobUpdateEvent(com.airbnb.airpal.api.event.JobUpdateEvent)

Aggregations

JobUpdateEvent (com.airbnb.airpal.api.event.JobUpdateEvent)1 FailureInfo (com.facebook.presto.client.FailureInfo)1 QueryError (com.facebook.presto.client.QueryError)1