You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "shengbinxu (via GitHub)" <gi...@apache.org> on 2025/08/05 07:18:11 UTC

[I] Hint error Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'test_customer' does not exist. [shardingsphere]

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

   ## Bug Report
   
   <img width="717" height="326" alt="Image" src="https://github.com/user-attachments/assets/828d1af5-b474-4540-9134-6b86535a3d5f" />
   
   ```
   public List<TestCustomerPo> getCustomersByIdRange(Long startId, Long endId) {
           log.info("根据ID范围查询客户数据,startId: {}, endId: {}", startId, endId);
   
           try (HintManager hintManager = HintManager.getInstance()) {
               // 强制使用test_customer_1表
               hintManager.addTableShardingValue("test_customer", 1);
   
               List<TestCustomerPo> result = testCustomerMapper.selectByIdRange(startId, endId);
               log.info("查询成功,返回记录数: {}", result.size());
               return result;
   
           } catch (Exception e) {
               log.error("根据ID范围查询客户数据失败,startId: {}, endId: {}", startId, endId, e);
               throw new RuntimeException("查询客户数据失败", e);
           }
       }
   ```
   
   ```
      <!-- 根据ID范围查询 -->
       <select id="selectByIdRange" resultMap="BaseResultMap">
           SELECT
           <include refid="Base_Column_List"/>
           FROM test_customer
           WHERE id BETWEEN #{startId} AND #{endId}
           ORDER BY id ASC
       </select>
   ```
   
   ```
       tables:
         test_customer:
           actualDataNodes: ds0.test_customer_$->{0..99}
           tableStrategy:
             hint:
               shardingAlgorithmName: test_customer_hint_inline
   
   shardingAlgorithms:
         test_customer_hint_inline:
           type: table-index-hint
   ````
   
   ```
   @Component
   public class MyHintShardingAlgorithm implements HintShardingAlgorithm<Long> {
       @Override
       public Collection<String> doSharding(Collection<String> collection, HintShardingValue<Long> hintShardingValue) {
           Collection<String> result = new ArrayList<>();
           for (Long value : hintShardingValue.getValues()) {
               result.add(hintShardingValue.getLogicTableName() + "_" + value);
           }
           return result;
       }
   
       @Override
       public String getType() {
           return "table-index-hint";
       }
       
   }
   ````
   
   Why isn't it automatically routed to the table test_customer_1, but instead it prompts that the table does not exist?
   
   
   ### Which version of ShardingSphere did you use?
   5.5.2
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   
   ### Actual behavior
   
   ### Reason analyze (If you can)
   
   ### 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-unsubscribe@shardingsphere.apache.org.apache.org

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


Re: [I] Hint error Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'test_customer' does not exist. [shardingsphere]

Posted by "zafir-zhong (via GitHub)" <gi...@apache.org>.
zafir-zhong commented on issue #36183:
URL: https://github.com/apache/shardingsphere/issues/36183#issuecomment-3225051925

   https://shardingsphere.apache.org/document/current/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/single/
   maybe need config other tables like this


-- 
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-unsubscribe@shardingsphere.apache.org

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


Re: [I] Hint error Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'test_customer' does not exist. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #36183:
URL: https://github.com/apache/shardingsphere/issues/36183#issuecomment-3157170633

   The issue involves other third-party dependencies, but our focus is solely on ShardingSphere itself. Since ShardingSphere implements the JDBC interface, standard applications should be functional. We wish to allocate more effort towards enhancing the current version, and therefore will no longer handle such issues. Please read the documentation or provide more effective information when submitting an issue.


-- 
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-unsubscribe@shardingsphere.apache.org

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


Re: [I] Hint error Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'test_customer' does not exist. [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #36183: Hint error Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'test_customer' does not exist.
URL: https://github.com/apache/shardingsphere/issues/36183


-- 
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-unsubscribe@shardingsphere.apache.org

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