Skip to content

fix: Add kMaxSpillBytes to system config -> velox query config mapping#27132

Merged
han-yan01 merged 1 commit intoprestodb:masterfrom
han-yan01:export-D93147231
Mar 5, 2026
Merged

fix: Add kMaxSpillBytes to system config -> velox query config mapping#27132
han-yan01 merged 1 commit intoprestodb:masterfrom
han-yan01:export-D93147231

Conversation

@han-yan01
Copy link
Copy Markdown
Contributor

@han-yan01 han-yan01 commented Feb 13, 2026

Summary:
max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

Release Notes

== NO RELEASE NOTE ==

Differential Revision: D93147231

Summary by Sourcery

Propagate the max spill bytes system configuration into the Velox query config and extend tests to cover this mapping.

Bug Fixes:

  • Ensure the configured max spill bytes value is honored instead of always using the hardcoded default spill limit.

Tests:

  • Add and update query config mapping tests to validate propagation of max spill bytes from system configs and session properties.

@han-yan01 han-yan01 requested review from a team as code owners February 13, 2026 01:15
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Feb 13, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Feb 13, 2026

Reviewer's Guide

Propagates the max spill bytes system configuration into Velox QueryConfig and extends tests to cover the new mapping and its interaction with session properties and system configs.

Sequence diagram for propagation of kMaxSpillBytes from system config to Velox QueryConfig

sequenceDiagram
    actor Admin
    participant PrestoServer
    participant SystemConfig
    participant PrestoToVeloxQueryConfig
    participant VeloxQueryConfig

    Admin->>SystemConfig: set kMaxSpillBytes
    PrestoServer->>SystemConfig: load system configs
    SystemConfig-->>PrestoServer: configs map
    PrestoServer->>PrestoToVeloxQueryConfig: updateFromSystemConfigs(configs)
    PrestoToVeloxQueryConfig->>PrestoToVeloxQueryConfig: lookup kMaxSpillBytes mapping
    PrestoToVeloxQueryConfig->>VeloxQueryConfig: set kMaxSpillBytes from SystemConfig
    VeloxQueryConfig-->>PrestoServer: effective spill limit
    PrestoServer-->>Admin: execute query with configured spill limit
Loading

Sequence diagram for precedence between session kMaxSpillBytes and system config

sequenceDiagram
    actor User
    participant Client
    participant PrestoServer
    participant SessionProperties
    participant SystemConfig
    participant PrestoToVeloxQueryConfig
    participant VeloxQueryConfig

    User->>Client: set session kMaxSpillBytes (optional)
    Client->>PrestoServer: submit query
    PrestoServer->>SessionProperties: read session kMaxSpillBytes
    SessionProperties-->>PrestoServer: value or null
    PrestoServer->>SystemConfig: read kMaxSpillBytes
    SystemConfig-->>PrestoServer: system value
    PrestoServer->>PrestoToVeloxQueryConfig: build QueryConfig
    PrestoToVeloxQueryConfig->>PrestoToVeloxQueryConfig: if session value exists use it
    PrestoToVeloxQueryConfig->>PrestoToVeloxQueryConfig: else use system kMaxSpillBytes
    PrestoToVeloxQueryConfig->>VeloxQueryConfig: set kMaxSpillBytes
    VeloxQueryConfig-->>PrestoServer: effective spill limit used for execution
Loading

Class diagram for Presto system config to Velox QueryConfig mapping of kMaxSpillBytes

classDiagram
    class SystemConfig {
        +kAggregationSpillEnabled string
        +kMaxSpillBytes string
        +kRequestDataSizesMaxWaitSec string
    }

    class QueryConfig {
        +kAggregationSpillEnabled string
        +kMaxSpillBytes string
        +kRequestDataSizesMaxWaitSec string
    }

    class ConfigMappingEntry {
        +prestoSystemConfig string
        +veloxConfig string
    }

    class PrestoToVeloxQueryConfig {
        +updateFromSystemConfigs(systemConfigValues, queryConfig)
        -veloxToPrestoConfigMapping ConfigMappingEntry[]
    }

    PrestoToVeloxQueryConfig "1" o-- "*" ConfigMappingEntry : uses
    SystemConfig <.. PrestoToVeloxQueryConfig : reads_keys
    QueryConfig <.. PrestoToVeloxQueryConfig : writes_keys

    ConfigMappingEntry <|-- MaxSpillBytesMapping
    class MaxSpillBytesMapping {
        +prestoSystemConfig = SystemConfig.kMaxSpillBytes
        +veloxConfig = QueryConfig.kMaxSpillBytes
    }
Loading

File-Level Changes

Change Details Files
Map the max spill bytes system config into Velox QueryConfig so spill limits honor configured values.
  • Add SystemConfig::kMaxSpillBytes to veloxToPrestoConfigMapping in updateFromSystemConfigs so it populates core::QueryConfig::kMaxSpillBytes
  • Ensure queries no longer rely solely on the hardcoded 100GB default spill limit when a system config is present
presto-native-execution/presto_cpp/main/PrestoToVeloxQueryConfig.cpp
Extend Presto-to-Velox query config tests to cover the new max spill bytes mapping and keep mapping count assertions in sync.
  • Add a session/system config override test case for kMaxSpillBytes with validator using QueryConfig::maxSpillBytes()
  • Include kMaxSpillBytes in the systemConfigsWithoutSessionOverride expectedMappings
  • Bump expected mapping count constants to reflect the added entry in veloxToPrestoConfigMapping
presto-native-execution/presto_cpp/main/tests/PrestoToVeloxQueryConfigTest.cpp

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 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `presto-native-execution/presto_cpp/main/tests/PrestoToVeloxQueryConfigTest.cpp:144-153` </location>
<code_context>
                  expectedValue == "true", config.aggregationSpillEnabled());
            }},

+      {.veloxConfigKey = core::QueryConfig::kMaxSpillBytes,
+       .sessionPropertyKey = std::make_optional<std::string>(
+           SessionProperties::kMaxSpillBytes),
+       .systemConfigKey = std::string(SystemConfig::kMaxSpillBytes),
+       .sessionValue = "214748364800",
+       .differentSessionValue = "107374182400",
+       .validator =
+           [](const core::QueryConfig& config,
+              const std::string& expectedValue) {
+             EXPECT_EQ(
+                 std::stoull(expectedValue), config.maxSpillBytes());
+           }},
+
</code_context>

<issue_to_address>
**suggestion (testing):** Consider adding a test that explicitly verifies the default maxSpillBytes when neither session nor system configs are set

You already cover system-only and session-overrides-system cases. To avoid regressions, please also add coverage for when neither `SystemConfig::kMaxSpillBytes` nor `SessionProperties::kMaxSpillBytes` is set (either via a new test or an extra assertion). That test should assert that the default (the 100GB hardcoded limit) is still used and not altered by this mapping.
</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.

Comment on lines +144 to +153
{.veloxConfigKey = core::QueryConfig::kMaxSpillBytes,
.sessionPropertyKey = std::make_optional<std::string>(
SessionProperties::kMaxSpillBytes),
.systemConfigKey = std::string(SystemConfig::kMaxSpillBytes),
.sessionValue = "214748364800",
.differentSessionValue = "107374182400",
.validator =
[](const core::QueryConfig& config,
const std::string& expectedValue) {
EXPECT_EQ(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion (testing): Consider adding a test that explicitly verifies the default maxSpillBytes when neither session nor system configs are set

You already cover system-only and session-overrides-system cases. To avoid regressions, please also add coverage for when neither SystemConfig::kMaxSpillBytes nor SessionProperties::kMaxSpillBytes is set (either via a new test or an extra assertion). That test should assert that the default (the 100GB hardcoded limit) is still used and not altered by this mapping.

han-yan01 added a commit to han-yan01/presto that referenced this pull request Feb 17, 2026
prestodb#27132)

Summary:

max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Differential Revision: D93147231
han-yan01 added a commit to han-yan01/presto that referenced this pull request Feb 17, 2026
prestodb#27132)

Summary:

max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Differential Revision: D93147231
han-yan01 added a commit to han-yan01/presto that referenced this pull request Feb 17, 2026
prestodb#27132)

Summary:
Pull Request resolved: prestodb#27132

max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Differential Revision: D93147231
han-yan01 added a commit to han-yan01/presto that referenced this pull request Mar 3, 2026
prestodb#27132)

Summary:

max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Reviewed By: tanjialiang

Differential Revision: D93147231
@han-yan01 han-yan01 requested a review from tanjialiang March 3, 2026 23:07
han-yan01 added a commit to han-yan01/presto that referenced this pull request Mar 3, 2026
prestodb#27132)

Summary:

max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Reviewed By: tanjialiang

Differential Revision: D93147231
prestodb#27132)

Summary:
Pull Request resolved: prestodb#27132

max-spill-bytes from config.properties was not propagated to velox QueryConfig because it was missing from veloxToPrestoConfigMapping in updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill limit regardless of the configured value, resulting in spurious "local spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Reviewed By: tanjialiang

Differential Revision: D93147231
@han-yan01 han-yan01 changed the title fix: add kMaxSpillBytes to system config -> velox query config mapping fix: Add kMaxSpillBytes to system config -> velox query config mapping Mar 4, 2026
@han-yan01 han-yan01 requested a review from shrinidhijoshi March 4, 2026 22:36
@han-yan01 han-yan01 merged commit 894f0d4 into prestodb:master Mar 5, 2026
112 of 116 checks passed
garimauttam pushed a commit to garimauttam/presto that referenced this pull request Mar 9, 2026
prestodb#27132)

Summary:
max-spill-bytes from config.properties was not propagated to velox
QueryConfig because it was missing from veloxToPrestoConfigMapping in
updateFromSystemConfigs().

this caused queries to always use the hardcoded 100GB default spill
limit regardless of the configured value, resulting in spurious "local
spill limit exceeded" exceptions.

# Release Notes
```
== NO RELEASE NOTE ==
```

Differential Revision: D93147231

## Summary by Sourcery

Propagate the max spill bytes system configuration into the Velox query
config and extend tests to cover this mapping.

Bug Fixes:
- Ensure the configured max spill bytes value is honored instead of
always using the hardcoded default spill limit.

Tests:
- Add and update query config mapping tests to validate propagation of
max spill bytes from system configs and session properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants