[fix](nereids) Fix NPE in ADMIN COMPACT TABLE without PARTITION clause #70288
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 296 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.341
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #70288"
general
weight: 0.35
morrySnow
Background
ADMIN COMPACT TABLE db.tbl PARTITION p WHERE type = 'BASE/CUMULATIVE/FULL'sends a compaction task for every replica of one partition. The command requires exactly one partition; for a non-partitioned table the single partition has the same name as the table.What problem does this PR solve?
Issue Number: None
Related PR: #44861 (introduced the bug)
PR Type: Bugfix
Problem Summary:
When the
PARTITIONclause is omitted,AdminCompactTableCommand.validate()throws aNullPointerExceptionand the user seesCannot invoke "PartitionNamesInfo.getPartitionNames()" because the return value of "TableRefInfo.getPartitionNamesInfo()" is nullinstead ofNo partition selected for compaction. This PR checks thePartitionNamesInfoitself for null, so the command returns the intended error again.Details
ADMIN COMPACT TABLEwithout aPARTITIONclause, on both partitioned and non-partitioned tables.AdminCompactTableStmtwas ported to Nereids in #44861, the null check moved from thePartitionNamesobject to the inner list. The parser passes a nullPartitionNamesInfowhen there is noPARTITIONclause, and the inner list of a non-nullPartitionNamesInfois never null, so the check could never fire.tableRefInfo.getPartitionNamesInfo()for null, matching the legacy statement.run()reads the partition names only aftervalidate()passes, so it needs no change.AdminCompactTableStmtare not affected.Testing
Added
AdminCompactTableCommandTest(FE UT): noPARTITIONclause on a partitioned and a non-partitioned table, multiple partitions, missingWHERE, and an invalidtype. The no-partition case fails with the NPE before this fix and passes after it. Ran locally withmvn -pl fe-core -am test -Dtest=AdminCompactTableCommandTest.Release note
Fix a NullPointerException when
ADMIN COMPACT TABLEis run without aPARTITIONclause; it now returns "No partition selected for compaction".Check List (For Author)
AI Disclosure