Search in sources :

Example 1 with OutputBufferInfo

use of io.prestosql.execution.buffer.OutputBufferInfo in project hetu-core by openlookeng.

the class LocalExecutionPlanner method calculateTotalCountOfTaskComponentToBeCaptured.

private static int calculateTotalCountOfTaskComponentToBeCaptured(TaskContext taskContext, LocalExecutionPlanContext context, OutputBuffer outputBuffer) {
    int totalCount = 0;
    boolean outputPipelineIsTableScan = false;
    for (DriverFactory df : context.getDriverFactories()) {
        // Don't include operators in table-scan pipelines
        if (!isTableScanPipeline(df)) {
            if (isOuterJoinFromTableScanPipeline(df, context)) {
                // See Gitee issue Checkpoint - handle LookupOuterOperator pipelines
                // https://gitee.com/open_lookeng/dashboard/issues?id=I2LMIW
                // For outer pipelines forked from table-scan, only count the lookup-outer operator
                totalCount += df.getDriverInstances().orElse(1);
            } else {
                totalCount += df.getDriverInstances().orElse(1) * df.getOperatorFactories().size();
            }
        } else if (df.isOutputDriver()) {
            outputPipelineIsTableScan = true;
        }
    }
    int stageId = taskContext.getTaskId().getStageId().getId();
    // If output pipeline is not also source pipeline, then OutputBuffer state needs to be captured
    if (stageId > 0 && !outputPipelineIsTableScan) {
        // For partitioned output buffer, each partition has its own snapshot state, so need to count all of them.
        // For other output buffers, there is a single snapshot state, so use 1.
        OutputBufferInfo info = outputBuffer.getInfo();
        if (info.getType().equals("PARTITIONED")) {
            totalCount += info.getBuffers().size();
        } else {
            totalCount++;
        }
    }
    return totalCount;
}
Also used : OutputBufferInfo(io.prestosql.execution.buffer.OutputBufferInfo) DriverFactory(io.prestosql.operator.DriverFactory)

Aggregations

OutputBufferInfo (io.prestosql.execution.buffer.OutputBufferInfo)1 DriverFactory (io.prestosql.operator.DriverFactory)1