feat: Add 'native_partitioned_output_eager_flush' session property#27067
Conversation
Reviewer's GuideAdds a new native session property Sequence diagram for native_partitioned_output_eager_flush propagationsequenceDiagram
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
Class diagram for new native_partitioned_output_eager_flush session propertyclassDiagram
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
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues, and left some high level feedback:
- In
SessionProperties.h/SessionProperties.cpp, consider aligning the description text with the JavaNativeWorkerSessionPropertyProvider(e.g., explicitly mentioning it is Native Execution only) so that users see a consistent explanation ofnative_partitioned_output_eager_flushacross 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
607084c to
2c7f89e
Compare
steveburnett
left a comment
There was a problem hiding this comment.
Thanks for the doc! Just a single nit of formatting.
2c7f89e to
848b051
Compare
848b051 to
7753aee
Compare
steveburnett
left a comment
There was a problem hiding this comment.
LGTM! (docs)
Pull updated branch, new local doc build, looks good. Thanks!
|
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 |
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.
Summary by Sourcery
Add a native session property to control eager flushing behavior of partitioned output operators.
New Features:
Documentation:
Tests: