Skip to content

Commit

Permalink
[native] Add session property native_writer_flush_threshold_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
tanjialiang committed Oct 29, 2024
1 parent 38ca2ec commit 32d52dd
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
11 changes: 6 additions & 5 deletions presto-docs/src/main/sphinx/presto_cpp/properties-session.rst
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,14 @@ Native Execution only. Enable topN row number spilling on native engine.

Native Execution only. Enable window spilling on native engine.

``native_writer_spill_enabled``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
``native_writer_flush_threshold_bytes``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

* **Type:** ``boolean``
* **Default value:** ``true``
* **Type:** ``bigint``
* **Default value:** ``100663296``

Native Execution only. Enable writer spilling on native engine.
Minimum memory footprint size required to reclaim memory from a file writer by flushing its buffered data to disk.
Default is 96MB.

``native_max_output_buffer_size``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class NativeWorkerSessionPropertyProvider
public static final String NATIVE_JOIN_SPILL_ENABLED = "native_join_spill_enabled";
public static final String NATIVE_WINDOW_SPILL_ENABLED = "native_window_spill_enabled";
public static final String NATIVE_WRITER_SPILL_ENABLED = "native_writer_spill_enabled";
public static final String NATIVE_WRITER_FLUSH_THRESHOLD_BYTES = "native_writer_flush_threshold_bytes";
public static final String NATIVE_ROW_NUMBER_SPILL_ENABLED = "native_row_number_spill_enabled";
public static final String NATIVE_TOPN_ROW_NUMBER_SPILL_ENABLED = "native_topn_row_number_spill_enabled";
public static final String NATIVE_SPILLER_NUM_PARTITION_BITS = "native_spiller_num_partition_bits";
Expand Down Expand Up @@ -122,6 +123,12 @@ public NativeWorkerSessionPropertyProvider(FeaturesConfig featuresConfig)
"Native Execution only. Enable writer spilling on native engine",
false,
!nativeExecution),
longProperty(
NATIVE_WRITER_FLUSH_THRESHOLD_BYTES,
"Native Execution only. Minimum memory footprint size required to reclaim memory from a file " +
"writer by flushing its buffered data to disk.",
96L << 20,
false),
booleanProperty(
NATIVE_ROW_NUMBER_SPILL_ENABLED,
"Native Execution only. Enable row number spilling on native engine",
Expand Down
10 changes: 10 additions & 0 deletions presto-native-execution/presto_cpp/main/SessionProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,16 @@ SessionProperties::SessionProperties() {
QueryConfig::kWriterSpillEnabled,
boolToString(c.writerSpillEnabled()));

addSessionProperty(
kWriterFlushThresholdBytes,
"Native Execution only. Minimum memory footprint size required "
"to reclaim memory from a file writer by flushing its buffered data to "
"disk.",
BIGINT(),
false,
QueryConfig::kWriterFlushThresholdBytes,
std::to_string(c.writerFlushThresholdBytes()));

addSessionProperty(
kRowNumberSpillEnabled,
"Native Execution only. Enable row number spilling on native engine",
Expand Down
5 changes: 5 additions & 0 deletions presto-native-execution/presto_cpp/main/SessionProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ class SessionProperties {
static constexpr const char* kWriterSpillEnabled =
"native_writer_spill_enabled";

/// Minimum memory footprint size required to reclaim memory from a file
/// writer by flushing its buffered data to disk.
static constexpr const char* kWriterFlushThresholdBytes =
"native_writer_flush_threshold_bytes";

/// The number of bits (N) used to calculate the spilling partition number for
/// hash join and RowNumber: 2 ^ N
static constexpr const char* kSpillerNumPartitionBits =
Expand Down

0 comments on commit 32d52dd

Please sign in to comment.