You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/13 01:34:46 UTC

[GitHub] [shardingsphere] wj-li opened a new issue, #18320: Using sharding key query report NullPointerException

wj-li opened a new issue, #18320:
URL: https://github.com/apache/shardingsphere/issues/18320

   ## 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.1.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   
   ### Actual behavior
   Here's my config,use Oracle 11g
   ```
    T_FSN_DATA:
               actual-data-nodes: ds0.T_FSN_DATA_$->{2022..2099}$->{['01','02','03','04','05','06','07','08','09','10','11','12']}$->{['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']}
               table-strategy:
                 standard:
                   sharding-column: START_TIME
                   sharding-algorithm-name: t-fsn-interval
         #分表算法
           sharding-algorithms:
             t-fsn-interval:
               type: INTERVAL
               props:
                 datetime-pattern: yyyy-MM-dd HH:mm:ss
                 datetime-lower: 2022-01-01 00:00:00
                 #默认当前时间
                 #datetime-upper: 2022-12-31 23:59:59
                 sharding-suffix-pattern: yyyyMMdd
                 datetime-interval-amount: 1
                 datetime-interval-unit: DAYS
   ```
   ```
   ### SQL: SELECT COUNT(*) AS total FROM T_FSN_DATA a WHERE a.START_TIME >= ? AND a.START_TIME <= ?
   ### Cause: java.lang.NullPointerException
   	at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:153)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:145)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
   	... 53 more
   Caused by: java.lang.NullPointerException
   	at org.apache.shardingsphere.sharding.merge.dql.groupby.GroupByMemoryMergedResult.getValueCaseSensitiveFromTables(GroupByMemoryMergedResult.java:134)
   	at org.apache.shardingsphere.sharding.merge.dql.groupby.GroupByMemoryMergedResult.getValueCaseSensitive(GroupByMemoryMergedResult.java:124)
   	at org.apache.shardingsphere.sharding.merge.dql.groupby.GroupByMemoryMergedResult.init(GroupByMemoryMergedResult.java:73)
   	at org.apache.shardingsphere.sharding.merge.dql.groupby.GroupByMemoryMergedResult.init(GroupByMemoryMergedResult.java:53)
   	at org.apache.shardingsphere.infra.merge.result.impl.memory.MemoryMergedResult.<init>(MemoryMergedResult.java:51)
   	at org.apache.shardingsphere.sharding.merge.dql.groupby.GroupByMemoryMergedResult.<init>(GroupByMemoryMergedResult.java:56)
   	at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.getGroupByMergedResult(ShardingDQLResultMerger.java:112)
   	at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.build(ShardingDQLResultMerger.java:82)
   	at org.apache.shardingsphere.sharding.merge.dql.ShardingDQLResultMerger.merge(ShardingDQLResultMerger.java:63)
   	at org.apache.shardingsphere.infra.merge.MergeEngine.executeMerge(MergeEngine.java:90)
   	at org.apache.shardingsphere.infra.merge.MergeEngine.merge(MergeEngine.java:80)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.mergeQuery(ShardingSpherePreparedStatement.java:487)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.getResultSet(ShardingSpherePreparedStatement.java:435)
   	at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.getFirstResultSet(DefaultResultSetHandler.java:238)
   	at org.apache.ibatis.executor.resultset.DefaultResultSetHandler.handleResultSets(DefaultResultSetHandler.java:188)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:65)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64)
   	at com.sun.proxy.$Proxy262.query(Unknown Source)
   	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:63)
   	at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
   	at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
   	at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
   	at com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor.willDoQuery(PaginationInnerInterceptor.java:141)
   	at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:75)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
   	at com.sun.proxy.$Proxy261.query(Unknown Source)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)
   	... 60 more
   
   	at org.apache.dubbo.rpc.filter.ExceptionFilter.onResponse(ExceptionFilter.java:98)
   	at org.apache.dubbo.rpc.protocol.FilterNode.lambda$invoke$0(FilterNode.java:99)
   	at org.apache.dubbo.rpc.AsyncRpcResult.lambda$whenCompleteWithContext$0(AsyncRpcResult.java:197)
   	at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
   	at java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:792)
   	at java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2153)
   	at org.apache.dubbo.rpc.AsyncRpcResult.whenCompleteWithContext(AsyncRpcResult.java:195)
   	at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:81)
   	at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:192)
   	at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
   	at org.apache.dubbo.rpc.filter.ClassLoaderFilter.invoke(ClassLoaderFilter.java:38)
   	at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
   	at org.apache.dubbo.rpc.filter.EchoFilter.invoke(EchoFilter.java:41)
   	at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
   	at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:129)
   	at org.apache.dubbo.rpc.protocol.FilterNode.invoke(FilterNode.java:61)
   	at org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol$1.reply(DubboProtocol.java:148)
   	at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleRequest(HeaderExchangeHandler.java:100)
   	at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:175)
   	at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
   	at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
   	at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41)
   	at java.lang.Thread.run(Thread.java:748)
   
   
   ```
   
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   ```
   2022-06-13 09:28:40,307 INFO  DubboServerHandler-172.21.101.1:20880-thread-13 o.a.s.i.executor.sql.log.SQLLogger 74 log ---- Logic SQL: SELECT COUNT(*) AS total FROM T_FSN_DATA a WHERE a.START_TIME >= ? AND a.START_TIME <= ?
   2022-06-13 09:28:40,307 INFO  DubboServerHandler-172.21.101.1:20880-thread-13 o.a.s.i.executor.sql.log.SQLLogger 74 log ---- SQLStatement: OracleSelectStatement(lock=Optional.empty, modelSegment=Optional.empty)
   2022-06-13 09:28:40,307 INFO  DubboServerHandler-172.21.101.1:20880-thread-13 o.a.s.i.executor.sql.log.SQLLogger 74 log ---- Actual SQL: ds0 ::: SELECT COUNT(*) AS total FROM T_FSN_DATA_20220601 a WHERE a.START_TIME >= ? AND a.START_TIME <= ? UNION ALL SELECT COUNT(*) AS total FROM T_FSN_DATA_20220602 a WHERE a.START_TIME >= ? AND a.START_TIME <= ? ::: [2022-06-01 00:00:00.0, 2022-06-02 23:59:59.0, 2022-06-01 00:00:00.0, 2022-06-02 23:59:59.0]
   
   ```
   ### 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


[GitHub] [shardingsphere] github-actions[bot] closed issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #18320: Using sharding key query report NullPointerException
URL: https://github.com/apache/shardingsphere/issues/18320


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


[GitHub] [shardingsphere] linghengqian commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1153405610

   You should not configure tables that do not exist in actualdatanodes.


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


[GitHub] [shardingsphere] github-actions[bot] commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1272349625

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


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


[GitHub] [shardingsphere] wj-li commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
wj-li commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1153427321

   
   
   
   
   > You should not configure tables that do not exist in actualdatanodes.
   
   It doesn't seem to be in shardingSphereSchema.
   ![image](https://user-images.githubusercontent.com/20807065/173274632-5d0e7b21-bee0-464a-8582-56920474220f.png)
   


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


[GitHub] [shardingsphere] wj-li commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
wj-li commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1153423472

   
   
   
   
   > You should not configure tables that do not exist in actualdatanodes.
   
   Here's the actual tables.
   ![image](https://user-images.githubusercontent.com/20807065/173273984-c7c08f21-3624-4aa4-b0d3-1fa12df13b6b.png)
   


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


[GitHub] [shardingsphere] linghengqian commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1272895753

   - I think this issue can be closed.


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


[GitHub] [shardingsphere] linghengqian commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1153463215

   > 
   > 
   > 
   > 
   > > You should not configure tables that do not exist in actualdatanodes.
   > 
   > Here's the actual tables.
   > ![image](https://user-images.githubusercontent.com/20807065/173273984-c7c08f21-3624-4aa4-b0d3-1fa12df13b6b.png)
   > 
   
   Yes, you configured a table that does not exist.
   ```
   actual-data-nodes: ds0.T_FSN_DATA_$->{2022..2099}$->{['01','02','03','04','05','06','07','08','09','10','11','12']}$->{['01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']}
   
   ```


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


[GitHub] [shardingsphere] linghengqian commented on issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
linghengqian commented on issue #18320:
URL: https://github.com/apache/shardingsphere/issues/18320#issuecomment-1208561482

   It looks like this issue doesn't have any PRs that need to reach the master branch.


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


[GitHub] [shardingsphere] TeslaCN closed issue #18320: Using sharding key query report NullPointerException

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #18320: Using sharding key query report NullPointerException
URL: https://github.com/apache/shardingsphere/issues/18320


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