public PartitionedOutputOperator(
      OperatorContext operatorContext,
      List<Type> sourceTypes,
      Function<Page, Page> pagePreprocessor,
      PartitionFunction partitionFunction,
      List<Integer> partitionChannels,
      List<Optional<NullableValue>> partitionConstants,
      OptionalInt nullChannel,
      OutputBuffer outputBuffer,
      DataSize maxMemory) {
    this.operatorContext = requireNonNull(operatorContext, "operatorContext is null");
    this.pagePreprocessor = requireNonNull(pagePreprocessor, "pagePreprocessor is null");
    this.partitionFunction =
        new PagePartitioner(
            partitionFunction,
            partitionChannels,
            partitionConstants,
            nullChannel,
            outputBuffer,
            sourceTypes,
            maxMemory);

    operatorContext.setInfoSupplier(this::getInfo);
    // TODO: We should try to make this more accurate
    // Recalculating the retained size of all the PageBuilders is somewhat expensive,
    // so we only do it once here rather than in addInput(), and assume that the size will be
    // constant.
    operatorContext
        .getSystemMemoryContext()
        .newLocalMemoryContext()
        .setBytes(this.partitionFunction.getRetainedSizeInBytes());
  }
예제 #2
0
  public ExchangeOperator(
      OperatorContext operatorContext,
      List<Type> types,
      PlanNodeId sourceId,
      ExchangeClient exchangeClient) {
    this.operatorContext = checkNotNull(operatorContext, "operatorContext is null");
    this.sourceId = checkNotNull(sourceId, "sourceId is null");
    this.exchangeClient = checkNotNull(exchangeClient, "exchangeClient is null");
    this.types = checkNotNull(types, "types is null");

    operatorContext.setInfoSupplier(exchangeClient::getStatus);
  }