You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sadpandajoe (via GitHub)" <gi...@apache.org> on 2026/10/20 08:56:13 UTC
[PR] fix(tests): narrow Optional StatementResult.data in async result tests [superset]
sadpandajoe opened a new pull request, #45517:
URL: https://github.com/apache/superset/pull/45517
### SUMMARY
The nightly `pre-commit` run on master fails `mypy (main)` with two errors in `tests/unit_tests/sql/execution/test_async_results.py`:
tests/unit_tests/sql/execution/test_async_results.py:755: error: Value of type "Any | None" is not indexable [index]
tests/unit_tests/sql/execution/test_async_results.py:894: error: Value of type "Any | None" is not indexable [index]
Root cause: #45348 (f0cfaff78, "fix(sql): decode async SQLExecutor results from the results backend") added these two assertions. They index `result.statements[0].data[...]` on a `QueryResult` returned directly by `SQLExecutor.execute()` / `execute_async().get_result()`. `StatementResult.data` is typed `pd.DataFrame | None` in `superset-core/src/superset_core/queries/types.py`, and `None` is the intended value for DML statements. The other index sites in this module go through helpers that return `Any`, so they are unaffected.
The error only shows up when superset-core's sources are part of the mypy run, as they are in the nightly `--all-files` job. In a per-PR run that checks only changed files, the `superset_core.*` `follow_imports = "skip"` override makes `QueryResult` resolve to `Any`, so the error was not visible when #45348 was reviewed.
This adds an `assert result.statements[0].data is not None` before each of the two indexes, matching the narrowing pattern already used elsewhere in this module. This is a typing-only change in tests; runtime behaviour is unchanged.
### TESTING INSTRUCTIONS
1. Check out this branch and run mypy the way the nightly job does, with superset-core sources on the command line:
`pre-commit run mypy --files tests/unit_tests/sql/execution/test_async_results.py $(git ls-files 'superset-core/src/*.py')`
`mypy (main)` should pass. On master, the same command reports the two errors above.
2. Run `pre-commit run mypy --files tests/unit_tests/sql/execution/test_async_results.py`; it should also pass.
3. Run `pytest tests/unit_tests/sql/execution/test_async_results.py`; all tests should pass.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #45516
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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(tests): narrow Optional StatementResult.data in async result tests [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #45517:
URL: https://github.com/apache/superset/pull/45517#issuecomment-6291345867
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/45517?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 65.10%. Comparing base ([`7b23dde`](https://app.codecov.io/gh/apache/superset/commit/7b23ddea9f6679701a348a0ee46ae5f4ebc9dae5?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`766dde0`](https://app.codecov.io/gh/apache/superset/commit/766dde075427fd6d0690de02ab1581831ff5e646?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 2 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #45517 +/- ##
==========================================
- Coverage 65.15% 65.10% -0.05%
==========================================
Files 3053 3053
Lines 200640 200640
Branches 46820 46820
==========================================
- Hits 130723 130634 -89
- Misses 66977 67066 +89
Partials 2940 2940
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/45517/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/45517/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/45517/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/45517/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.88% <ø> (+<0.01%)` | :arrow_up: |
| [presto](https://app.codecov.io/gh/apache/superset/pull/45517/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.66% <ø> (ø)` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/45517/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `53.08% <ø> (-0.08%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/45517/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `52.64% <ø> (ø)` | |
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/45517?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(tests): narrow Optional StatementResult.data in async result tests [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on PR #45517:
URL: https://github.com/apache/superset/pull/45517#issuecomment-6287390610
## CodeAnt PR Risk: Low Risk
- The PR appears safe to merge; it adds non-null assertions to tests for cached and uncached query results.
- No production code changes are shown.
**Assessed commit:** `766dde075427`
--
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(tests): narrow Optional StatementResult.data in async result tests [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #45517:
URL: https://github.com/apache/superset/pull/45517
--
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