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 25, 2024
1 parent 1640594 commit 778a89b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 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 @@ -345,6 +345,7 @@ public final class SystemSessionProperties
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 @@ -1709,6 +1710,12 @@ public SystemSessionProperties(
"Native Execution only. Enable writer spilling on native engine",
false,
false),
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
19 changes: 10 additions & 9 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 All @@ -175,15 +185,6 @@ SessionProperties::SessionProperties() {
QueryConfig::kRowNumberSpillEnabled,
boolToString(c.rowNumberSpillEnabled()));

addSessionProperty(
kJoinSpillPartitionBits,
"Native Execution only. The number of bits (N) used to calculate the "
"spilling partition number for hash join and RowNumber: 2 ^ N",
INTEGER(),
false,
QueryConfig::kJoinSpillPartitionBits,
std::to_string(c.rowNumberSpillEnabled()));

addSessionProperty(
kSpillerNumPartitionBits,
"none",
Expand Down
8 changes: 4 additions & 4 deletions presto-native-execution/presto_cpp/main/SessionProperties.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ class SessionProperties {
static constexpr const char* kWriterSpillEnabled =
"native_writer_spill_enabled";

/// The number of bits (N) used to calculate the spilling
/// partition number for hash join and RowNumber: 2 ^ N
static constexpr const char* kJoinSpillPartitionBits =
"native_join_spiller_partition_bits";
/// 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";

static constexpr const char* kSpillerNumPartitionBits =
"native_spiller_num_partition_bits";
Expand Down

0 comments on commit 778a89b

Please sign in to comment.