Skip to content
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

fix: merge into panic #16581

Merged
merged 5 commits into from
Oct 11, 2024
Merged

fix: merge into panic #16581

merged 5 commits into from
Oct 11, 2024

Conversation

zhyass
Copy link
Member

@zhyass zhyass commented Oct 9, 2024

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

Summary

The reason is that the condition is false, after RuleEliminateFilter, it is converted to ConstantTableScan, which makes the fileds in mutation invalid.

mysql> create table t(a int);
Query OK, 0 rows affected (0.05 sec)

mysql> create table s(a int);
Query OK, 0 rows affected (0.05 sec)

mysql> merge into s using t on 1 != 1 when matched and s.a>0 then update * when not matched then insert *;
+-------------------------+------------------------+
| number of rows inserted | number of rows updated |
+-------------------------+------------------------+
|                       0 |                      0 |
+-------------------------+------------------------+
1 row in set (0.15 sec)
Read 0 rows, 0.00 B in 0.067 sec., 0 rows/sec., 0.00 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

@zhyass zhyass marked this pull request as draft October 9, 2024 16:58
@zhyass zhyass changed the title fix merge into panic fix: merge into panic Oct 9, 2024
@github-actions github-actions bot added the pr-bugfix this PR patches a bug in codebase label Oct 9, 2024
@wubx
Copy link
Member

wubx commented Oct 10, 2024

merge into s using t on 1 != 1 when matched and s.a>0 then update * when not matched then insert *;

This SQL statement may cause unexpected behavior. Is it okay to make the error reports more user-friendly?

@zhyass zhyass marked this pull request as ready for review October 10, 2024 06:12
@zhyass zhyass marked this pull request as draft October 10, 2024 07:16
@zhyass zhyass marked this pull request as ready for review October 10, 2024 11:38
@Dousir9 Dousir9 added this pull request to the merge queue Oct 11, 2024
Merged via the queue into databendlabs:main with commit a59a20b Oct 11, 2024
71 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: merge into panic if condition is false
3 participants