gxgmy521 opened a new issue, #34096:
URL: https://github.com/apache/shardingsphere/issues/34096

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   5.5.0
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC 
   
   ### Expected behavior
   I use the sharding datasource to direct access the [actual 
table](https://shardingsphere.apache.org/document/current/en/features/sharding/concept/#actual-table)
 with the help of [single 
table](https://shardingsphere.apache.org/document/current/en/features/sharding/concept/#single-table),
 here is the config example
   ```
   rules:
   - !SHARDING
       tables:
         t_order:
           actualDataNodes: ds_1.t_order_$->{0..1}
           tableStrategy:
             standard:
               shardingColumn: order_id
               shardingAlgorithmName: t_order_inline
   - !SINGLE
       tables:
         - ds_1.t_order_1
   ```
   I use the single table "ds_1.t_order1" In the SQL Due to the Sharding JDBC 
have some limitations 
(https://shardingsphere.apache.org/document/current/en/features/sharding/limitation/#sub-query-1)(for
 example do not support sub query without sharding key)
   ```SQL
    SELECT * FROM t_order_1;
   ```
   In version `5.1.2` it works well , however when I use `5.5.0` version, it 
throws TableNotFoundException. My problem is:
   
   1. Is this a bug or new feature?
   2. What is the suggest solution when encountering unsupported SQL?
   
   ### Actual behavior
   In 5.5.0 version, it throw TableNotFoundException
   ```
   Caused by: 
org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException:
 Table or view 't_order_1' does not exist.
        at 
org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.lambda$checkTableExists$4(SimpleTableSegmentBinder.java:151)
        at 
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:41)
        at 
org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.checkTableExists(SimpleTableSegmentBinder.java:148)
        at 
org.apache.shardingsphere.infra.binder.segment.from.impl.SimpleTableSegmentBinder.bind(SimpleTableSegmentBinder.java:84)
        at 
org.apache.shardingsphere.infra.binder.segment.from.TableSegmentBinder.bind(TableSegmentBinder.java:55)
        at 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder.lambda$bind$1(SelectStatementBinder.java:60)
        at java.base/java.util.Optional.map(Optional.java:260)
        at 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder.bind(SelectStatementBinder.java:60)
        at 
org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementBinder.bind(SelectStatementBinder.java:48)
        at 
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bindDMLStatement(SQLBindEngine.java:82)
        at 
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:72)
        at 
org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:63)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:207)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:172)
        at 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:94)
        at 
com.zaxxer.hikari.pool.ProxyConnection.prepareStatement(ProxyConnection.java:316)
        at 
com.zaxxer.hikari.pool.HikariProxyConnection.prepareStatement(HikariProxyConnection.java)
        at 
org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:86)
        at 
org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
        ... 23 more
   
   ```
   ### Reason analyze (If you can)
   The ShardingSphereDatabase class only save the logic table's metadata not 
the actual table ,so when I use the actual table directly,It can not find the 
table metadata and throw the exception.
   
![image](https://github.com/user-attachments/assets/32056b2e-cc80-4488-916a-24b0fafaa702)
   
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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: 
notifications-unsubscr...@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to