OpenTenBase / OpenTenBase/TXSQL
Bug: Fix sort_merge_join hint crash when used at query block level
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 337
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
Description:
SORT_MERGE_JOIN hint was incorrectly registered as a non-QB-level,
non-switch hint (false, false in opt_hint_info), and was also
incorrectly treated as a compound hint in is_compound_hint() and
get_complex_hints(). When SORT_MERGE_JOIN was used at query block
level (e.g., /+sort_merge_join()/), calling get_complex_hints()
would crash because the hint type was routed to the compound hint
path (via Opt_hints_table::get_compound_key_hint()), which
returned an invalid pointer for SORT_MERGE_JOIN_HINT_ENUM.
How to repeat:
create table t1 (c int, b int);
create table t2 (a int, b int);
create table t3 (b int, c int);
insert into t1 values (10,1);
insert into t1 values (3 ,1);
insert into t1 values (3 ,2);
insert into t2 values (2, 1);
insert into t2 values (3, 1);
insert into t3 values (1, 3);
insert into t3 values (1,10);
ANALYZE TABLE t1, t2, t3;
select /*+sort_merge_join()*/ *
from t1
inner join t2 on t1.b=t2.b
inner join t3 on t3.c = t1.c and t3.b = t2.b;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing is_compound_hint(), get_complex_hints(), and Opt_hints_table::get_compound_key_hint() for SORT_MERGE_JOIN_HINT_ENUM, then inspect its opt_hint_info registration. Re-run the supplied query-block-level SORT_MERGE_JOIN example; done means get_complex_hints() no longer crashes and the hint is classified with the intended query-block and compound-hint behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100