Search in sources :

Example 1 with ExecuteSelectSqlData

use of com.dtstack.taier.develop.dto.devlop.ExecuteSelectSqlData in project Taier by DTStack.

the class BatchSelectSqlService method beforeGetResult.

/**
 * sql查询前置处理
 *
 * @param jobId
 * @param taskId
 * @param tenantId
 * @param type
 * @param sqlId
 * @return
 */
private ExecuteSelectSqlData beforeGetResult(String jobId, Long taskId, Long tenantId, Integer type, String sqlId) {
    BatchSelectSql batchHiveSelectSql = developHiveSelectSqlDao.getByJobId(StringUtils.isNotEmpty(sqlId) ? sqlId : jobId, tenantId, null);
    Preconditions.checkNotNull(batchHiveSelectSql, "不存在该临时查询");
    if (StringUtils.isNotEmpty(sqlId)) {
        batchHiveSelectSql.setFatherJobId(jobId);
        batchHiveSelectSql.setJobId(sqlId);
    }
    IBatchSelectSqlService selectSqlService = multiEngineServiceFactory.getBatchSelectSqlService(batchHiveSelectSql.getTaskType());
    Preconditions.checkNotNull(selectSqlService, String.format("不支持此任务类型 %d", batchHiveSelectSql.getTaskType()));
    BatchTask batchTask = batchTaskService.getOneWithError(taskId);
    ;
    Integer taskType = null;
    if (Objects.nonNull(batchTask)) {
        taskType = batchTask.getTaskType();
    }
    if (Objects.isNull(taskType)) {
        throw new DtCenterDefException("任务类型为空");
    }
    return new ExecuteSelectSqlData(batchHiveSelectSql, batchTask, taskType, selectSqlService);
}
Also used : IBatchSelectSqlService(com.dtstack.taier.develop.service.develop.IBatchSelectSqlService) ExecuteSelectSqlData(com.dtstack.taier.develop.dto.devlop.ExecuteSelectSqlData) BatchTask(com.dtstack.taier.dao.domain.BatchTask) DtCenterDefException(com.dtstack.taier.common.exception.DtCenterDefException) BatchSelectSql(com.dtstack.taier.dao.domain.BatchSelectSql)

Aggregations

DtCenterDefException (com.dtstack.taier.common.exception.DtCenterDefException)1 BatchSelectSql (com.dtstack.taier.dao.domain.BatchSelectSql)1 BatchTask (com.dtstack.taier.dao.domain.BatchTask)1 ExecuteSelectSqlData (com.dtstack.taier.develop.dto.devlop.ExecuteSelectSqlData)1 IBatchSelectSqlService (com.dtstack.taier.develop.service.develop.IBatchSelectSqlService)1