Search in sources :

Example 1 with DefaultCross

use of org.apache.flink.api.java.operators.CrossOperator.DefaultCross in project flink by apache.

the class PythonPlanBinder method createCrossOperation.

@SuppressWarnings("unchecked")
private void createCrossOperation(DatasizeHint mode, PythonOperationInfo info) {
    DataSet op1 = (DataSet) sets.get(info.parentID);
    DataSet op2 = (DataSet) sets.get(info.otherID);
    DefaultCross defaultResult;
    switch(mode) {
        case NONE:
            defaultResult = op1.cross(op2);
            break;
        case HUGE:
            defaultResult = op1.crossWithHuge(op2);
            break;
        case TINY:
            defaultResult = op1.crossWithTiny(op2);
            break;
        default:
            throw new IllegalArgumentException("Invalid Cross mode specified: " + mode);
    }
    defaultResult.setParallelism(getParallelism(info));
    if (info.usesUDF) {
        sets.put(info.setID, defaultResult.mapPartition(new PythonMapPartition(info.setID, info.types)).setParallelism(getParallelism(info)).name(info.name));
    } else {
        sets.put(info.setID, defaultResult.name("DefaultCross"));
    }
}
Also used : DefaultCross(org.apache.flink.api.java.operators.CrossOperator.DefaultCross) DataSet(org.apache.flink.api.java.DataSet) PythonMapPartition(org.apache.flink.python.api.functions.PythonMapPartition)

Aggregations

DataSet (org.apache.flink.api.java.DataSet)1 DefaultCross (org.apache.flink.api.java.operators.CrossOperator.DefaultCross)1 PythonMapPartition (org.apache.flink.python.api.functions.PythonMapPartition)1