thswlsqls opened a new pull request, #39856:
URL: https://github.com/apache/shardingsphere/pull/39856
Ref #24982.
Changes proposed in this pull request:
- `MySQLShardingLogicTablesMergedResult.init()` (inherited by
`MySQLShardingShowCreateTableMergedResult`) and
`MySQLShardingShowIndexMergedResult.init()` resolved the logic table by
`ShardingRule.findShardingTableByActualTable()` per result row, which returns
the first match.
- With two logic tables sharing one actual table name in different storage
units (`t_order0: ds_0.t_order`, `t_order1: ds_1.t_order`, the #24982
configuration, bindable since #39157), `SHOW CREATE TABLE t_order1` and `SHOW
INDEX FROM t_order1` are routed to `ds_1` but merged as `t_order0`.
- Resolve the sharding table with `ShardingRule.findShardingTable()` from
the logic table named by the statement (`getTablesContext().getTableNames()`),
as `EncryptShowCreateTableMergedResult` does, and keep the reverse lookup only
when the statement names no table.
- SHOW TABLES and SHOW TABLE STATUS keep the reverse lookup because their
statements name no table and `QueryResult` carries no storage-unit provenance.
- Stub `getTableNames()` in the existing tests and add
`assertGetValueWithSameActualTableNameInDifferentStorageUnits` to the SHOW
CREATE TABLE and SHOW INDEX tests, which fail on master (`t_order0`) and pass
with this change (`t_order1`).
- Verification: module-scoped `./mvnw install -pl
features/sharding/dialect/mysql -am` plus repository-wide `spotless:check`,
`checkstyle:check` and `apache-rat:check` with `-Pcheck`; the full `clean
install` was not run locally.
AI assistance: Claude Code was used to draft the change and its unit tests
in `features/sharding/dialect/mysql`; I reviewed and verified every line.
---
Before committing this PR, I'm sure that I have checked the following
options:
- [x] My code follows the [code of
conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/)
of this project.
- [x] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the
pull request.
- [ ] I have passed maven check locally : `./mvnw clean install -B -T1C
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`. Ran the module-scoped equivalent
instead: `./mvnw install -pl features/sharding/dialect/mysql -am -B -T1C
-Dmaven.javadoc.skip -Dmaven.jacoco.skip -e` (BUILD SUCCESS) and
repository-wide `spotless:check`, `checkstyle:check`, `apache-rat:check` with
`-Pcheck`.
- [ ] I have made corresponding changes to the documentation. No
documentation describes this merge behavior; none needed.
- [x] I have added corresponding unit tests for my changes.
- [x] I have updated the Release Notes of the current development version.
For more details, see [Update Release
Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
- [x] I have disclosed the tool and affected files or scope for any material
AI assistance, as required by the [AI-assisted contribution policy].
[AI-assisted contribution policy]:
https://github.com/apache/shardingsphere/blob/master/AI_POLICY.md
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]