Skip to content

fix: explain update sql panic #17474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
Mar 3, 2025
Merged

fix: explain update sql panic #17474

merged 24 commits into from
Mar 3, 2025

Conversation

zhyass
Copy link
Member

@zhyass zhyass commented Feb 17, 2025

I hereby agree to the terms of the CLA available at: https://docs.databend.com/dev/policies/cla/

Summary

This PR fixes the panic bug that occurs during explain analyze update, and also refactors the bind process for the mutation MutationStrategy::Direct scenario, add RelOperator::Filter to undergo optimization.
Additionally, it enriches the explain output information for updates and deletes.
And fixed the bug where explain analyze might lead to SQL being commit for execution.

mysql> explain update t1 set a = a + 1 where a > 2;
+-----------------------------------------------------------------+
| explain                                                         |
+-----------------------------------------------------------------+
| CommitSink                                                      |
| └── MutationSource(Update)                                      |
|     ├── table: default.default.t1                               |
|     ├── output columns: [a (#0), b (#1), _predicate (#2)]       |
|     ├── filters: [is_true(t1.a (#0) > 2)]                       |
|     ├── read rows: 4                                            |
|     ├── read size: < 1 KiB                                      |
|     ├── partitions total: 1                                     |
|     └── partitions scanned: 1                                   |
+-----------------------------------------------------------------+
9 rows in set (0.16 sec)
Read 0 rows, 0.00 B in 0.026 sec., 0 rows/sec., 0.00 B/sec.


mysql> explain analyze update t1 set a = a + 1 where a > 2;
+-------------------------------------------------------------+
| explain                                                     |
+-------------------------------------------------------------+
| MutationSource(Update)                                      |
| ├── table: default.default.t1                               |
| ├── output columns: [a (#0), b (#1), _predicate (#2)]       |
| ├── filters: [is_true(t1.a (#0) > 2)]                       |
| ├── read rows: 4                                            |
| ├── read size: < 1 KiB                                      |
| ├── partitions total: 1                                     |
| ├── partitions scanned: 1                                   |
| ├── cpu time: 8.709041ms                                    |
| ├── wait time: 3.026267ms                                   |
| ├── output rows: 4                                          |
| ├── output bytes: 35.00 B                                   |
| └── partitions scanned: 1                                   |
+-------------------------------------------------------------+
13 rows in set (0.28 sec)
Read 4 rows, 34.00 B in 0.082 sec., 48.75 rows/sec., 414.42 B/sec.

Tests

  • Unit Test
  • Logic Test
  • Benchmark Test
  • No Test - Explain why

Type of change

  • Bug Fix (non-breaking change which fixes an issue)
  • New Feature (non-breaking change which adds functionality)
  • Breaking Change (fix or feature that could cause existing functionality not to work as expected)
  • Documentation Update
  • Refactoring
  • Performance Improvement
  • Other (please describe):

This change is Reviewable

@github-actions github-actions bot added the pr-bugfix this PR patches a bug in codebase label Feb 17, 2025
@zhyass zhyass marked this pull request as draft February 17, 2025 18:10
@zhyass zhyass force-pushed the feat_fix branch 3 times, most recently from e383376 to 954f91a Compare February 20, 2025 09:06
@zhyass zhyass marked this pull request as ready for review February 20, 2025 13:27
@zhyass zhyass marked this pull request as draft February 21, 2025 03:12
@zhyass zhyass marked this pull request as ready for review February 24, 2025 06:06
@zhyass zhyass merged commit 369a635 into databendlabs:main Mar 3, 2025
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-bugfix this PR patches a bug in codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: explain update sql panic
4 participants