You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "eschutho (via GitHub)" <gi...@apache.org> on 2026/06/20 16:21:58 UTC
[PR] fix(schemas): rename deprecated query fields regardless of falsy values [superset]
eschutho opened a new pull request, #41263:
URL: https://github.com/apache/superset/pull/41263
### What's the change?
`ChartDataQueryObjectSchema.rename_deprecated_fields()` is a Marshmallow `@post_load` hook that renames legacy query field names to their modern equivalents:
| Old (deprecated) | New |
|---|---|
| `timeseries_limit` | `series_limit` |
| `timeseries_limit_metric` | `series_limit_metric` |
| `granularity_sqla` | `granularity` |
| `groupby` | `columns` |
The original implementation used the walrus operator with a truthiness check:
```python
if value := data.pop(old, None):
data[new] = value
```
**Bug:** `data.pop(old, None)` always removes the old key, but when the value is falsy, the new key is never set. Real-world cases silently affected:
- `timeseries_limit=0` — the default for most charts meaning "no series limit"
- `groupby=[]` — explicit empty groupby (`fields.List(...)`, empty list is falsy)
- `timeseries_limit_metric=None` or `granularity_sqla=None` (all four deprecated fields carry `allow_none=True`)
Result: the renamed field (`series_limit`) is silently absent from the `data` dict passed to `QueryObject`. `QueryObject.__init__` falls back to its `series_limit: int = 0` default — numerically the same but semantically wrong; the caller's explicit `0` or `None` is discarded.
**Fix:**
```python
for old, new in _renames:
if old in data:
data.setdefault(new, data.pop(old))
```
- `old in data` — checks key presence, not value truthiness
- `data.pop(old)` — always removes the deprecated key
- `data.setdefault(new, ...)` — sets the new key only if it isn't already present (an explicit `series_limit` from the caller is never silently clobbered by a coexisting deprecated `timeseries_limit`)
### No behavior change for truthy values
For any truthy value the behavior is identical to the old code.
### Test plan
- Unit tests for `ChartDataQueryObjectSchema`: verify that `timeseries_limit=0` is renamed to `series_limit=0` after deserialization (was silently discarded before).
- Integration test: run the existing `query_context_tests.py` tests that set deprecated fields to ensure they still pass.
### Follow-up (non-blocking)
`QueryObject._rename_deprecated_fields` (`query_object.py:232`) has the same `if value:` guard for the `setattr` path. The deprecation *warning* still fires there regardless (the log line precedes the `if`), and the functional outcome is identical since `series_limit` defaults to `0`. A follow-up fix there would make both rename paths consistent.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(schemas): rename deprecated query fields regardless of falsy values [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41263:
URL: https://github.com/apache/superset/pull/41263#issuecomment-4758987286
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(schemas): rename deprecated query fields regardless of falsy values [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #41263:
URL: https://github.com/apache/superset/pull/41263#issuecomment-4758995165
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | 0be66d4f6044820321247e44ef3fa9d2d838f302 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a36be27aaa634000844286d |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-41263--superset-docs-preview.netlify.app](https://deploy-preview-41263--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DctNCoAgEEDhu8w6SUxMukHHGHWiwr-sIInunru3-N4LuaSQL5gAOjAFo11bL9vTHzeVypLZyV7stCsFZIUiBmIL-rM27yj7VGfXDoWDMiRGRFSD5JxrKYVWDr4f) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-41263--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(schemas): rename deprecated query fields regardless of falsy values [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #41263:
URL: https://github.com/apache/superset/pull/41263#issuecomment-4759007261
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/41263?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 55.66%. Comparing base ([`382a094`](https://app.codecov.io/gh/apache/superset/commit/382a094795ae419a515b08c15de88b7e843662f6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`0be66d4`](https://app.codecov.io/gh/apache/superset/commit/0be66d4f6044820321247e44ef3fa9d2d838f302?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 8 commits behind head on master.
> :exclamation: There is a different number of reports uploaded between BASE (382a094) and HEAD (0be66d4). Click for more details.
>
> <details><summary>HEAD has 36 uploads less than BASE</summary>
>
>| Flag | BASE (382a094) | HEAD (0be66d4) |
>|------|------|------|
>|hive|5|1|
>|python|30|2|
>|presto|5|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #41263 +/- ##
==========================================
- Coverage 64.36% 55.66% -8.70%
==========================================
Files 2653 2653
Lines 144864 144867 +3
Branches 33421 33421
==========================================
- Hits 93242 80647 -12595
- Misses 49949 63486 +13537
+ Partials 1673 734 -939
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `39.33% <0.00%> (+<0.01%)` | :arrow_up: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.92% <100.00%> (+<0.01%)` | :arrow_up: |
| [python](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.99% <100.00%> (-18.58%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/41263/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/41263?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(schemas): rename deprecated query fields regardless of falsy values [superset]
Posted by "durgaprasadml (via GitHub)" <gi...@apache.org>.
durgaprasadml commented on PR #41263:
URL: https://github.com/apache/superset/pull/41263#issuecomment-4761690890
Thanks for the fix. The previous implementation relied on truthiness checks and could unintentionally drop valid falsy values such as 0, [], or None during field renaming. Checking key presence instead of value truthiness looks correct and preserves the intended behavior.
One thing that may be worth adding is a test covering the case where both the deprecated and modern field names are supplied simultaneously (e.g. timeseries_limit and series_limit) to explicitly document the expected precedence behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org