Skip to content

feat: Add 'native_partitioned_output_eager_flush' session property#27067

Merged
spershin merged 1 commit intoprestodb:masterfrom
spershin:Presto_native_partitioned_output_eager_flush_SessionProp
Feb 3, 2026
Merged

feat: Add 'native_partitioned_output_eager_flush' session property#27067
spershin merged 1 commit intoprestodb:masterfrom
spershin:Presto_native_partitioned_output_eager_flush_SessionProp

Conversation

@spershin
Copy link
Copy Markdown
Contributor

@spershin spershin commented Feb 2, 2026

Description

The news session property would allow Partitioned Output Velox operators to flush (return) data eagerly, as soon as it arrives.
This would match default Presto Java behavior of returning results eagerly to the caller, while the query is still running (scanning).

Motivation and Context

For "needle in a haystack" type of queries running in various UIs this early return functionality is crucial.

Test Plan

Existing session property test.
Ran the custom build in a Prestissimo cluster to ensure session property changes query behavior accordingly.

== NO RELEASE NOTE ==

Summary by Sourcery

Add a native session property to control eager flushing behavior of partitioned output operators.

New Features:

  • Introduce the native_partitioned_output_eager_flush session property to enable eager flushing of PartitionedOutput operator rows in native execution.

Documentation:

  • Document the native_partitioned_output_eager_flush session property in the Presto native session properties reference.

Tests:

  • Extend session property mapping tests to cover the new native_partitioned_output_eager_flush property.

@spershin spershin requested review from a team, elharo and steveburnett as code owners February 2, 2026 20:47
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Feb 2, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 2, 2026

Reviewer's Guide

Adds a new native session property native_partitioned_output_eager_flush that controls whether the PartitionedOutput operator flushes rows eagerly, wires it through native C++ session properties, Java native worker session property provider, and updates the session property mapping test.

Sequence diagram for native_partitioned_output_eager_flush propagation

sequenceDiagram
    actor User
    participant Coordinator as CoordinatorSession
    participant Java as NativeWorkerSessionPropertyProvider
    participant Cpp as CppSessionProperties
    participant Exec as PartitionedOutputOperator

    User->>Coordinator: Set session native_partitioned_output_eager_flush=true
    Coordinator->>Java: Build native worker session properties
    Java->>Java: booleanProperty(NATIVE_PARTITIONED_OUTPUT_EAGER_FLUSH,...)
    Java-->>Coordinator: Session property map
    Coordinator->>Cpp: Start native query with session properties
    Cpp->>Cpp: SessionProperties::addSessionProperty(kPartitionedOutputEagerFlush,...)
    Cpp-->>Exec: Construct with partitionedOutputEagerFlush=true
    Exec->>Exec: Use eager flush behavior when producing pages
Loading

Class diagram for new native_partitioned_output_eager_flush session property

classDiagram
    class NativeWorkerSessionPropertyProvider {
        +String NATIVE_MAX_EXTENDED_PARTIAL_AGGREGATION_MEMORY
        +String NATIVE_MAX_SPILL_BYTES
        +String NATIVE_MAX_PAGE_PARTITIONING_BUFFER_SIZE
        +String NATIVE_PARTITIONED_OUTPUT_EAGER_FLUSH
        +String NATIVE_MAX_OUTPUT_BUFFER_SIZE
        +String NATIVE_QUERY_TRACE_ENABLED
        +String NATIVE_QUERY_TRACE_DIR
        +NativeWorkerSessionPropertyProvider(FeaturesConfig featuresConfig)
        -booleanProperty(String name, String description, boolean defaultValue, boolean hidden)
        -integerProperty(String name, String description, int defaultValue, boolean hidden)
    }

    class SessionProperties {
        +const char* kMaxPartitionedOutputBufferSize
        +const char* kPartitionedOutputEagerFlush
        +const char* kMaxLocalExchangePartitionCount
        +SessionProperties()
        -void addSessionProperty(const char* name, const char* description, Type type, bool defaultValue, const char* configKey, const char* defaultConfigValue)
    }

    class QueryConfig {
        +const char* kMaxPartitionedOutputBufferSize
        +const char* kPartitionedOutputEagerFlush
    }

    NativeWorkerSessionPropertyProvider --> SessionProperties : defines Java property
    SessionProperties --> QueryConfig : uses config keys for mapping
Loading

File-Level Changes

Change Details Files
Introduce native session property to control eager flushing behavior of PartitionedOutput operator and wire it to query config.
  • Define kPartitionedOutputEagerFlush session property key in native C++ session properties header.
  • Register the new boolean session property in SessionProperties::SessionProperties() with default false and link it to QueryConfig::kPartitionedOutputEagerFlush.
  • Extend the session properties mapping test to validate the mapping from the new session property key to the corresponding QueryConfig key.
presto-native-execution/presto_cpp/main/SessionProperties.h
presto-native-execution/presto_cpp/main/SessionProperties.cpp
presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp
Expose the eager flush behavior as a Java-level native worker session property for configuration.
  • Add the NATIVE_PARTITIONED_OUTPUT_EAGER_FLUSH constant in NativeWorkerSessionPropertyProvider.
  • Register a new boolean session property, documented as native-execution-only, with default false and disabled when nativeExecution is false.
presto-main-base/src/main/java/com/facebook/presto/sessionpropertyproviders/NativeWorkerSessionPropertyProvider.java

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • In SessionProperties.h/SessionProperties.cpp, consider aligning the description text with the Java NativeWorkerSessionPropertyProvider (e.g., explicitly mentioning it is Native Execution only) so that users see a consistent explanation of native_partitioned_output_eager_flush across codepaths.
  • If there are still any minimum batching constraints or other conditions under which rows might not be flushed immediately, consider tightening the property description (both Java and C++) so that "flush rows eagerly" doesn’t oversell semantics that depend on internal buffering.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `SessionProperties.h`/`SessionProperties.cpp`, consider aligning the description text with the Java `NativeWorkerSessionPropertyProvider` (e.g., explicitly mentioning it is Native Execution only) so that users see a consistent explanation of `native_partitioned_output_eager_flush` across codepaths.
- If there are still any minimum batching constraints or other conditions under which rows might not be flushed immediately, consider tightening the property description (both Java and C++) so that "flush rows eagerly" doesn’t oversell semantics that depend on internal buffering.

## Individual Comments

### Comment 1
<location> `presto-native-execution/presto_cpp/main/SessionProperties.cpp:354-361` </location>
<code_context>

+  addSessionProperty(
+      kPartitionedOutputEagerFlush,
+      "If true, the PartitionedOutput operator will flush rows eagerly, without"
+      "waiting until buffers reach certain size. Default is false.",
+      BOOLEAN(),
+      false,
</code_context>

<issue_to_address>
**issue (typo):** Add a space at the join between the two string literals so the description doesn’t render as 'withoutwaiting'.

Since C++ concatenates adjacent string literals directly, the current two-literal form produces "withoutwaiting" in the output; adding a space to either literal avoids this.

```suggestion
  addSessionProperty(
      kPartitionedOutputEagerFlush,
      "If true, the PartitionedOutput operator will flush rows eagerly, without "
      "waiting until buffers reach certain size. Default is false.",
      BOOLEAN(),
      false,
      QueryConfig::kPartitionedOutputEagerFlush,
      "false");
```
</issue_to_address>

### Comment 2
<location> `presto-docs/src/main/sphinx/presto_cpp/properties-session.rst:309-310` </location>
<code_context>
+* **Default value:** ``false``
+
+Native Execution only. If true, the PartitionedOutput operator will flush rows eagerly, without
+waiting until buffers reach certain size. Default is false.
+
 ``native_max_local_exchange_partition_count``
</code_context>

<issue_to_address>
**issue (typo):** Consider adding an article: "waiting until buffers reach a certain size."

```suggestion
Native Execution only. If true, the PartitionedOutput operator will flush rows eagerly, without
waiting until buffers reach a certain size. Default is false.
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@spershin spershin force-pushed the Presto_native_partitioned_output_eager_flush_SessionProp branch from 607084c to 2c7f89e Compare February 2, 2026 20:52
Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the doc! Just a single nit of formatting.

@spershin spershin force-pushed the Presto_native_partitioned_output_eager_flush_SessionProp branch from 2c7f89e to 848b051 Compare February 2, 2026 22:01
@spershin spershin requested a review from steveburnett February 2, 2026 22:01
@spershin spershin force-pushed the Presto_native_partitioned_output_eager_flush_SessionProp branch from 848b051 to 7753aee Compare February 3, 2026 01:37
Copy link
Copy Markdown
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! (docs)

Pull updated branch, new local doc build, looks good. Thanks!

@steveburnett
Copy link
Copy Markdown
Contributor

When you have time, edit the PR title to pass the required failing test.

Maybe something like:

feat(native): Add 'native_partitioned_output_eager_flush' session property

@spershin spershin changed the title Add 'native_partitioned_output_eager_flush' session property feat: add 'native_partitioned_output_eager_flush' session property Feb 3, 2026
@spershin spershin changed the title feat: add 'native_partitioned_output_eager_flush' session property feat: Add 'native_partitioned_output_eager_flush' session property Feb 3, 2026
Copy link
Copy Markdown
Contributor

@kaikalur kaikalur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@spershin spershin requested a review from feilong-liu February 3, 2026 17:35
Copy link
Copy Markdown
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @spershin

@spershin spershin merged commit e300b7d into prestodb:master Feb 3, 2026
85 of 89 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:Meta PR from Meta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants