starrocks
starrocks copied to clipboard
[BugFix] fix Duplicate key exception when get table statistics
Why I'm doing:
CREATE TABLE `ptbl5` (
`dt` date NULL COMMENT "",
`id` int(11) NULL COMMENT "",
`name` varchar(65533) NULL COMMENT ""
) ENGINE=OLAP
DUPLICATE KEY(`dt`, `id`, `name`)
PARTITION BY RANGE(`dt`)
(PARTITION p20250428 VALUES [("2025-04-28"), ("2025-04-29")),
PARTITION p20250429 VALUES [("2025-04-29"), ("2025-04-30")))
DISTRIBUTED BY HASH(`id`, `name`)
PROPERTIES (
"compression" = "LZ4",
"fast_schema_evolution" = "true",
"replicated_storage" = "true",
"replication_num" = "1"
);
insert into ptbl5 values("2025-04-29",1,'a');
-- ERROR 1064 (HY000): Duplicate key 5031178 (attempted merging values Optional.empty and Optional.empty)
select min(dt),max(dt) from ptbl5;
What I'm doing:
Fixes #issue
What type of PR is this:
- [x] BugFix
- [ ] Feature
- [ ] Enhancement
- [ ] Refactor
- [ ] UT
- [ ] Doc
- [ ] Tool
Does this PR entail a change in behavior?
- [ ] Yes, this PR will result in a change in behavior.
- [x] No, this PR will not result in a change in behavior.
Bugfix cherry-pick branch check:
- [x] I have checked the version labels which the pr will be auto-backported to the target branch
- [x] 3.5
- [x] 3.4
- [x] 3.3
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
please add test cases for it
[Java-Extensions Incremental Coverage Report]
:white_check_mark: pass : 0 / 0 (0%)
[FE Incremental Coverage Report]
:white_check_mark: pass : 5 / 5 (100.00%)
file detail
| path | covered_line | new_line | coverage | not_covered_line_detail | |
|---|---|---|---|---|---|
| :large_blue_circle: | com/starrocks/sql/optimizer/statistics/CachedStatisticStorage.java | 5 | 5 | 100.00% | [] |
[BE Incremental Coverage Report]
:white_check_mark: pass : 0 / 0 (0%)
This PR is replaced by #60162 , close this one for now.