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

   
   I have table names like kline_usdcny, kline_cnyrub, kline_cnykrw, and I want 
to do split tables by _ followed by symbol, here is my configuration:
   ```
   rules:
   - !SHARDING
       tables:
         kline:
           actualDataNodes: readwrite_ds_${0..1}.kline_${symbol}
           tableStrategy:
             standard:
               shardingColumn: symbol
               shardingAlgorithmName: kline_table_inline
           databaseStrategy:
             standard:
               shardingColumn: id
               shardingAlgorithmName: kline_db_mod
       shardingAlgorithms:
         kline_table_inline:
           type: INLINE
           props:
             algorithm-expression: kline_${symbol}
         kline_db_mod:
           type: MOD
           props:
             sharding-count: 2
       bindingTables:
         - kline
   - !READWRITE_SPLITTING
     dataSources:
       readwrite_ds_0:
         writeDataSourceName: master0
         readDataSourceNames:
           - master0
           - slave0
         loadBalancerName: round_robin
       readwrite_ds_1:
         writeDataSourceName: master1
         readDataSourceNames:
           - master1
           - slave1
         loadBalancerName: round_robin
     loadBalancers:
       round_robin:
         type: ROUND_ROBIN
   ```
    The query will report an error:
   ```
   2025-04-07 18:46:13.249 - Servlet.service() for servlet [dispatcherServlet] 
in context with path [] threw exception [Request processing failed: 
java.lang.RuntimeException: org.mybatis.spring.MyBatisSystemException] with 
root cause
   groovy.lang.MissingPropertyException: No such property: symbol for class: 
Script7
        at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:67)
        at 
org.codehaus.groovy.vmplugin.v8.IndyGuardsFiltersAndSignatures.unwrap(IndyGuardsFiltersAndSignatures.java:163)
        at 
org.codehaus.groovy.vmplugin.v8.IndyInterface.fromCache(IndyInterface.java:321)
        at Script7.run(Script7.groovy:1)
        at 
org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser.evaluate(GroovyInlineExpressionParser.java:120)
        at 
org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser.evaluate(GroovyInlineExpressionParser.java:107)
        at 
org.apache.shardingsphere.infra.expr.groovy.GroovyInlineExpressionParser.splitAndEvaluate(GroovyInlineExpressionParser.java:81)
        at 
org.apache.shardingsphere.sharding.rule.ShardingRule.getDataSourceNames(ShardingRule.java:188)
        at 
org.apache.shardingsphere.sharding.rule.ShardingRule.lambda$getDataSourceNames$9(ShardingRule.java:177)
        at java.base/java.lang.Iterable.forEach(Iterable.java:75)
        at 
org.apache.shardingsphere.sharding.rule.ShardingRule.getDataSourceNames(ShardingRule.java:177)
        at 
org.apache.shardingsphere.sharding.rule.ShardingRule.<init>(ShardingRule.java:122)
        at 
org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:43)
        at 
org.apache.shardingsphere.sharding.rule.builder.ShardingRuleBuilder.build(ShardingRuleBuilder.java:37)
        at 
org.apache.shardingsphere.infra.rule.builder.database.DatabaseRulesBuilder.build(DatabaseRulesBuilder.java:69)
        at 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase.create(ShardingSphereDatabase.java:91)
        at 
org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory.createGenericDatabases(ExternalMetaDataFactory.java:85)
        at 
org.apache.shardingsphere.metadata.factory.ExternalMetaDataFactory.create(ExternalMetaDataFactory.java:72)
        at 
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:98)
        at 
org.apache.shardingsphere.mode.metadata.MetaDataContextsFactory.create(MetaDataContextsFactory.java:72)
        at 
org.apache.shardingsphere.mode.manager.standalone.StandaloneContextManagerBuilder.build(StandaloneContextManagerBuilder.java:53)
        at 
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.createContextManager(ShardingSphereDataSource.java:79)
        at 
org.apache.shardingsphere.driver.jdbc.core.datasource.ShardingSphereDataSource.<init>(ShardingSphereDataSource.java:67)
        at 
org.apache.shardingsphere.driver.api.ShardingSphereDataSourceFactory.createDataSource(ShardingSphereDataSourceFactory.java:95)
        at 
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:135)
        at 
org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory.createDataSource(YamlShardingSphereDataSourceFactory.java:70)
        at 
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.createDataSource(DriverDataSourceCache.java:55)
        at 
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.lambda$get$0(DriverDataSourceCache.java:48)
        at 
java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
        at 
org.apache.shardingsphere.driver.jdbc.core.driver.DriverDataSourceCache.get(DriverDataSourceCache.java:48)
        at 
org.apache.shardingsphere.driver.ShardingSphereDriver.connect(ShardingSphereDriver.java:56)
        at 
com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:120)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:360)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202)
        at 
com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:461)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:550)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:98)
        at 
com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:111)
        at 
org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:160)
        at 
org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:118)
        at 
org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:81)
        at 
org.mybatis.spring.transaction.SpringManagedTransaction.openConnection(SpringManagedTransaction.java:80)
        at 
org.mybatis.spring.transaction.SpringManagedTransaction.getConnection(SpringManagedTransaction.java:67)
        at 
org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:348)
        at 
org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:89)
        at 
org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:64)
        at 
org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:336)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:158)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:110)
        at 
org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:90)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:154)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
        at 
org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:142)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at 
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:425)
        at jdk.proxy2/jdk.proxy2.$Proxy65.selectList(Unknown Source)
        at 
org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperMethod.executeForMany(MybatisMapperMethod.java:164)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:77)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:152)
        at 
com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
        at jdk.proxy2/jdk.proxy2.$Proxy67.selectBtcKlines(Unknown Source)
   ```
    If I write it like this:
   `actualDataNodes: readwrite_ds_${0..1}.kline_${0..1}`
    There will be no error and you can split the table normally


-- 
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