Skip to content

Cleanups: remove unused JOIN members. - #5964

Open
spetrunia wants to merge 10 commits into
mainfrom
main-spetrunia-cleanups
Open

spetrunia wants to merge 10 commits into
mainfrom
main-spetrunia-cleanups

Conversation

@spetrunia

Copy link
Copy Markdown
Member

No description provided.

spetrunia and others added 8 commits October 23, 2026 14:21
Last use was removed by:
commit 2cfc450
Author: Igor Babaev <igor@askmonty.org>
Date:   Tue Feb 9 12:35:59 2016 -0800

    This is the consolidated patch for mdev-8646:
    "Re-factor the code for post-join operations".
JOIN::no_field_update was added in the initial import (2000) and has
never been used.

JOIN::sum_funcs2 and JOIN::sum_funcs_end2 were last used before:
commit 2cfc450
Author: Igor Babaev <igor@askmonty.org>
Date:   Tue Feb 9 2016

    This is the consolidated patch for mdev-8646: "Re-factor the code
    for post-join operations".

Since then sum_funcs2 was only zeroed in JOIN::init() and
sum_funcs_end2 was not referenced at all.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
These were added by cf50e13 (MDEV-6080: Allowing storage engine to
shortcut group by queries) to remember the join_tab array and table_count
before the group_by_handler replaced them.

The last assignment of non-NULL values to them was removed by:
commit 2cfc450
Author: Igor Babaev <igor@askmonty.org>
Date:   Tue Feb 9 2016

    This is the consolidated patch for mdev-8646: "Re-factor the code
    for post-join operations".

Since then original_join_tab was only set to 0, so the block in
JOIN::cleanup() that restored join_tab and table_count from them never
ran. Remove the block and both members.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The member was added by:
commit 1d82e5d
Author: Monty
Date:   Mon Jun 13 2022

    Move join->emb_smj_nest setting to choose_plan()

and has never been used, neither read nor assigned.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The member was assigned in JOIN::init(), JOIN::optimize_inner() and
JOIN::optimize_stage2(), but never read. Its last reads, the arguments
of prepare_sum_aggregators() calls, were removed by:
commit 2cfc450
Author: Igor Babaev <igor@askmonty.org>
Date:   Tue Feb 9 2016

    This is the consolidated patch for mdev-8646: "Re-factor the code
    for post-join operations".

Since then the callers compute the value themselves from
is_using_agg_loose_index_scan().

JOIN::prepare_sum_aggregators() has a parameter of the same name, which
is unrelated and is kept.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The member is assigned in JOIN::prepare() but never read. Its last
reads (in the EXPLAIN code) were removed by:
commit 46a22a5
Author: bell@sanja.is.com.ua
Date:   Thu Sep 26 2002

    new EXPLAIN
    fixed bug in mysql-test/create-test-result
    fixed bug in union-subselect engine

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JOIN::select_list_used_tables is computed by
JOIN::eval_select_list_used_tables(), but never read. Its last reads
(in the code that optimizes DISTINCT on a subset of the tables, and in
JOIN_TAB::save_explain_data()) were removed by:
commit 2cfc450
Author: Igor Babaev <igor@askmonty.org>
Date:   Tue Feb 9 2016

    This is the consolidated patch for mdev-8646: "Re-factor the code
    for post-join operations".

Remove the member and the function that computes it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
JOIN_TAB::all_fields is only assigned (in JOIN::make_aggr_tables_info())
and is never read. It was added, together with JOIN_TAB::fields, by:
commit 2cfc450
Author: Igor Babaev <igor@askmonty.org>
Date:   Tue Feb 9 2016

    This is the consolidated patch for mdev-8646: "Re-factor the code
    for post-join operations".

That commit never read it, and no later commit has either, so there was
no last use to remove. JOIN_TAB::fields is read (by end_send() and
end_send_group()) and is kept. Update its comment, which also described
all_fields.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@spetrunia spetrunia changed the title Cleanups: remove unused members. Cleanups: remove unused JOIN members. Oct 24, 2026
spetrunia and others added 2 commits October 24, 2026 10:01
The member is declared but never used. Its last uses (the parser's
udf call stack and the udf_list.empty() initializers) were removed
by the fix for Bug#24736 (88ba767, also applied as 1f695db).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The member is only zeroed in init_select(), and the accessor is declared
but has no definition. The last reader and writers in the grammar were
removed by bc04ded ("Follow-up post JSON_TABLE merge,
table_join_options is not used"). d624464 had earlier removed the
member and accessor, but they came back with the JSON_TABLE merge.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant