Search in sources :

Example 1 with DEFAULT_MAX_PAGE_SIZE_IN_BYTES

use of io.prestosql.spi.block.PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES in project hetu-core by openlookeng.

the class TaskOutputOperator method addInput.

@Override
public void addInput(Page page) {
    requireNonNull(page, "page is null");
    Page inputPage = page;
    if (snapshotState != null) {
        if (snapshotState.processPage(inputPage)) {
            inputPage = snapshotState.nextMarker();
        }
    }
    if (inputPage.getPositionCount() == 0) {
        return;
    }
    if (!(inputPage instanceof MarkerPage)) {
        inputPage = pagePreprocessor.apply(inputPage);
    } else if (isStage0) {
        // Do not add marker to final output.
        return;
    }
    List<SerializedPage> serializedPages = splitPage(inputPage, DEFAULT_MAX_PAGE_SIZE_IN_BYTES).stream().map(p -> serde.serialize(p)).collect(toImmutableList());
    if (inputPage instanceof MarkerPage) {
        // The result is that for buffer #2, it receives marker 2 before marker 1.
        synchronized (outputBuffer) {
            outputBuffer.enqueue(serializedPages, id);
        }
    } else {
        outputBuffer.enqueue(serializedPages, id);
    }
    operatorContext.recordOutput(inputPage.getSizeInBytes(), inputPage.getPositionCount());
}
Also used : OutputBuffer(io.prestosql.execution.buffer.OutputBuffer) PlanNodeId(io.prestosql.spi.plan.PlanNodeId) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) MarkerPage(io.prestosql.spi.snapshot.MarkerPage) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) SingleInputSnapshotState(io.prestosql.snapshot.SingleInputSnapshotState) Page(io.prestosql.spi.Page) RestorableConfig(io.prestosql.spi.snapshot.RestorableConfig) Function(java.util.function.Function) Serializable(java.io.Serializable) Preconditions.checkState(com.google.common.base.Preconditions.checkState) PageSplitterUtil.splitPage(io.prestosql.execution.buffer.PageSplitterUtil.splitPage) List(java.util.List) SerializedPage(io.hetu.core.transport.execution.buffer.SerializedPage) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PagesSerde(io.hetu.core.transport.execution.buffer.PagesSerde) Objects.requireNonNull(java.util.Objects.requireNonNull) Type(io.prestosql.spi.type.Type) BlockEncodingSerdeProvider(io.prestosql.spi.snapshot.BlockEncodingSerdeProvider) DEFAULT_MAX_PAGE_SIZE_IN_BYTES(io.prestosql.spi.block.PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES) MarkerPage(io.prestosql.spi.snapshot.MarkerPage) MarkerPage(io.prestosql.spi.snapshot.MarkerPage) Page(io.prestosql.spi.Page) PageSplitterUtil.splitPage(io.prestosql.execution.buffer.PageSplitterUtil.splitPage) SerializedPage(io.hetu.core.transport.execution.buffer.SerializedPage) SerializedPage(io.hetu.core.transport.execution.buffer.SerializedPage)

Aggregations

Preconditions.checkState (com.google.common.base.Preconditions.checkState)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 PagesSerde (io.hetu.core.transport.execution.buffer.PagesSerde)1 SerializedPage (io.hetu.core.transport.execution.buffer.SerializedPage)1 OutputBuffer (io.prestosql.execution.buffer.OutputBuffer)1 PageSplitterUtil.splitPage (io.prestosql.execution.buffer.PageSplitterUtil.splitPage)1 SingleInputSnapshotState (io.prestosql.snapshot.SingleInputSnapshotState)1 Page (io.prestosql.spi.Page)1 DEFAULT_MAX_PAGE_SIZE_IN_BYTES (io.prestosql.spi.block.PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES)1 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)1 BlockEncodingSerdeProvider (io.prestosql.spi.snapshot.BlockEncodingSerdeProvider)1 MarkerPage (io.prestosql.spi.snapshot.MarkerPage)1 RestorableConfig (io.prestosql.spi.snapshot.RestorableConfig)1 Type (io.prestosql.spi.type.Type)1 Serializable (java.io.Serializable)1 List (java.util.List)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Function (java.util.function.Function)1