Search in sources :

Example 1 with SQLJoinRequest

use of io.cdap.cdap.etl.api.engine.sql.request.SQLJoinRequest in project cdap by caskdata.

the class BatchSQLEngineAdapter method join.

/**
 * Executes a Join operation in the SQL engine
 *
 * @param datasetName    the dataset name to use to store the result of the join operation
 * @param joinDefinition the Join Definition
 * @return Job representing this join operation
 */
@SuppressWarnings("unchecked,raw")
public SQLEngineJob<SQLDataset> join(String datasetName, JoinDefinition joinDefinition) {
    return runJob(datasetName, SQLEngineJobType.EXECUTE, () -> {
        Collection<SQLDataset> inputDatasets = getJoinInputDatasets(joinDefinition);
        SQLJoinRequest joinRequest = new SQLJoinRequest(datasetName, joinDefinition, inputDatasets);
        if (!sqlEngine.canJoin(joinRequest)) {
            throw new IllegalArgumentException("Unable to execute this join in the SQL engine");
        }
        return joinInternal(joinRequest);
    });
}
Also used : SQLDataset(io.cdap.cdap.etl.api.engine.sql.dataset.SQLDataset) SQLJoinRequest(io.cdap.cdap.etl.api.engine.sql.request.SQLJoinRequest)

Aggregations

SQLDataset (io.cdap.cdap.etl.api.engine.sql.dataset.SQLDataset)1 SQLJoinRequest (io.cdap.cdap.etl.api.engine.sql.request.SQLJoinRequest)1