Search in sources :

Example 6 with RuntimeFilterDef

use of org.apache.drill.exec.work.filter.RuntimeFilterDef in project drill by apache.

the class HashJoinBatch method initializeRuntimeFilter.

/**
 * Note: This method can not be called again as part of recursive call of
 * executeBuildPhase() to handle spilled build partitions.
 */
private void initializeRuntimeFilter() {
    if (!enableRuntimeFilter || bloomFiltersGenerated) {
        return;
    }
    runtimeFilterReporter = new RuntimeFilterReporter((ExecutorFragmentContext) context);
    RuntimeFilterDef runtimeFilterDef = popConfig.getRuntimeFilterDef();
    // RuntimeFilterRouter's judgement will have the RuntimeFilterDef.
    if (runtimeFilterDef != null) {
        List<BloomFilterDef> bloomFilterDefs = runtimeFilterDef.getBloomFilterDefs();
        for (BloomFilterDef bloomFilterDef : bloomFilterDefs) {
            int buildFieldId = bloomFilterDef2buildId.get(bloomFilterDef);
            int numBytes = bloomFilterDef.getNumBytes();
            String probeField = bloomFilterDef.getProbeField();
            probeFields.add(probeField);
            BloomFilter bloomFilter = new BloomFilter(numBytes, context.getAllocator());
            bloomFilters.add(bloomFilter);
            bloomFilter2buildId.put(bloomFilter, buildFieldId);
        }
    }
    bloomFiltersGenerated = true;
}
Also used : ExecutorFragmentContext(org.apache.drill.exec.ops.ExecutorFragmentContext) BloomFilterDef(org.apache.drill.exec.work.filter.BloomFilterDef) RuntimeFilterReporter(org.apache.drill.exec.work.filter.RuntimeFilterReporter) RuntimeFilterDef(org.apache.drill.exec.work.filter.RuntimeFilterDef) BloomFilter(org.apache.drill.exec.work.filter.BloomFilter)

Example 7 with RuntimeFilterDef

use of org.apache.drill.exec.work.filter.RuntimeFilterDef in project drill by apache.

the class RuntimeFilterVisitor method visitJoin.

@Override
public Prel visitJoin(JoinPrel prel, Void value) throws RuntimeException {
    if (prel instanceof HashJoinPrel) {
        HashJoinPrel hashJoinPrel = (HashJoinPrel) prel;
        // Generate possible RuntimeFilterDef to the HashJoinPrel, identify the corresponding
        // probe side ScanPrel.
        RuntimeFilterDef runtimeFilterDef = generateRuntimeFilter(hashJoinPrel);
        hashJoinPrel.setRuntimeFilterDef(runtimeFilterDef);
    }
    return visitPrel(prel, value);
}
Also used : HashJoinPrel(org.apache.drill.exec.planner.physical.HashJoinPrel) RuntimeFilterDef(org.apache.drill.exec.work.filter.RuntimeFilterDef)

Aggregations

RuntimeFilterDef (org.apache.drill.exec.work.filter.RuntimeFilterDef)7 BloomFilterDef (org.apache.drill.exec.work.filter.BloomFilterDef)5 ArrayList (java.util.ArrayList)3 HashJoinPOP (org.apache.drill.exec.physical.config.HashJoinPOP)3 JoinRelType (org.apache.calcite.rel.core.JoinRelType)2 OperatorTest (org.apache.drill.categories.OperatorTest)2 SlowTest (org.apache.drill.categories.SlowTest)2 Test (org.junit.Test)2 IOException (java.io.IOException)1 RelNode (org.apache.calcite.rel.RelNode)1 JoinInfo (org.apache.calcite.rel.core.JoinInfo)1 RelMetadataQuery (org.apache.calcite.rel.metadata.RelMetadataQuery)1 RelDataType (org.apache.calcite.rel.type.RelDataType)1 RelDataTypeField (org.apache.calcite.rel.type.RelDataTypeField)1 UserException (org.apache.drill.common.exceptions.UserException)1 ErrorCollector (org.apache.drill.common.expression.ErrorCollector)1 ErrorCollectorImpl (org.apache.drill.common.expression.ErrorCollectorImpl)1 LogicalExpression (org.apache.drill.common.expression.LogicalExpression)1 PathSegment (org.apache.drill.common.expression.PathSegment)1 SchemaPath (org.apache.drill.common.expression.SchemaPath)1