diff --git a/presto-native-execution/presto_cpp/main/SessionProperties.cpp b/presto-native-execution/presto_cpp/main/SessionProperties.cpp index fab89fda0bf7a..eec0a28c21e47 100644 --- a/presto-native-execution/presto_cpp/main/SessionProperties.cpp +++ b/presto-native-execution/presto_cpp/main/SessionProperties.cpp @@ -443,6 +443,23 @@ SessionProperties::SessionProperties() { false, QueryConfig::kScaleWriterMinProcessedBytesRebalanceThreshold, std::to_string(c.scaleWriterMinProcessedBytesRebalanceThreshold())); + + addSessionProperty( + kTableScanScaledProcessingEnabled, + "If set to true, enables scaled processing for table scans.", + BOOLEAN(), + false, + QueryConfig::kTableScanScaledProcessingEnabled, + std::to_string(c.tableScanScaledProcessingEnabled())); + + addSessionProperty( + kTableScanScaleUpMemoryUsageRatio, + "Controls the ratio of available memory that can be used for scaling up table scans. " + "The value is in the range of (0, 1].", + DOUBLE(), + false, + QueryConfig::kTableScanScaleUpMemoryUsageRatio, + std::to_string(c.tableScanScaleUpMemoryUsageRatio())); } const std::unordered_map>& diff --git a/presto-native-execution/presto_cpp/main/SessionProperties.h b/presto-native-execution/presto_cpp/main/SessionProperties.h index 6d77bb8026f33..ec3ab1cc199d0 100644 --- a/presto-native-execution/presto_cpp/main/SessionProperties.h +++ b/presto-native-execution/presto_cpp/main/SessionProperties.h @@ -287,6 +287,15 @@ class SessionProperties { static constexpr const char* kShuffleCompressionEnabled = "exchange_compression"; + /// If set to true, enables scaled processing for table scans. + static constexpr const char* kTableScanScaledProcessingEnabled = + "native_table_scan_scaled_processing_enabled"; + + /// Controls the ratio of available memory that can be used for scaling up + /// table scans. The value is in the range of (0, 1]. + static constexpr const char* kTableScanScaleUpMemoryUsageRatio = + "native_table_scan_scale_up_memory_usage_ratio"; + SessionProperties(); const std::unordered_map>& diff --git a/presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp b/presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp index 6b6ad65334660..96f9f04c4bc2c 100644 --- a/presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp +++ b/presto-native-execution/presto_cpp/main/tests/SessionPropertiesTest.cpp @@ -31,7 +31,9 @@ TEST_F(SessionPropertiesTest, validateMapping) { SessionProperties::kScaleWriterMaxPartitionsPerWriter, SessionProperties:: kScaleWriterMinPartitionProcessedBytesRebalanceThreshold, - SessionProperties::kScaleWriterMinProcessedBytesRebalanceThreshold}; + SessionProperties::kScaleWriterMinProcessedBytesRebalanceThreshold, + SessionProperties::kTableScanScaledProcessingEnabled, + SessionProperties::kTableScanScaleUpMemoryUsageRatio}; const std::vector veloxConfigNames = { core::QueryConfig::kAdjustTimestampToTimezone, core::QueryConfig::kDriverCpuTimeSliceLimitMs, @@ -40,7 +42,9 @@ TEST_F(SessionPropertiesTest, validateMapping) { core::QueryConfig::kScaleWriterMaxPartitionsPerWriter, core::QueryConfig:: kScaleWriterMinPartitionProcessedBytesRebalanceThreshold, - core::QueryConfig::kScaleWriterMinProcessedBytesRebalanceThreshold}; + core::QueryConfig::kScaleWriterMinProcessedBytesRebalanceThreshold, + core::QueryConfig::kTableScanScaledProcessingEnabled, + core::QueryConfig::kTableScanScaleUpMemoryUsageRatio}; auto sessionProperties = SessionProperties().getSessionProperties(); const auto len = names.size(); for (auto i = 0; i < len; i++) {