thineagle commented on issue #2431: when select no rows, sharding return Cannot invoke method intdiv() on null object URL: https://github.com/apache/incubator-shardingsphere/issues/2431#issuecomment-495227697 hi, i found an example the sql is "SELECT MAX(ac_seqn) FROM mdm_acct_conn WHERE Legal_Entity=? AND Ac_Id=?" the table rule is `mdm_acct_conn: actualDataNodes: ds${0..1}.mdm_acct_conn databaseStrategy: inline: shardingColumn: ac_id algorithmExpression: ds${ac_id.intdiv(10000) % 2}` the exception is `Caused by: java.lang.NullPointerException: Cannot invoke method intdiv() on null object at org.codehaus.groovy.runtime.NullObject.invokeMethod(NullObject.java:91) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.NullCallSite.call(NullCallSite.java:35) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:58) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-2.4.5-indy.jar:2.4.5] at Script7$_run_closure1.doCall(Script7.groovy:1) ~[?:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_152] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_152] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_152] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_152] at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) ~[groovy-2.4.5-indy.jar:2.4.5] at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) ~[groovy-2.4.5-indy.jar:2.4.5] at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) ~[groovy-2.4.5-indy.jar:2.4.5] at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1019) ~[groovy-2.4.5-indy.jar:2.4.5] at groovy.lang.Closure.call(Closure.java:426) ~[groovy-2.4.5-indy.jar:2.4.5] at groovy.lang.Closure.call(Closure.java:420) ~[groovy-2.4.5-indy.jar:2.4.5] at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.execute(InlineShardingStrategy.java:86) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.doSharding(InlineShardingStrategy.java:68) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.strategy.route.inline.InlineShardingStrategy.doSharding(InlineShardingStrategy.java:59) ~[sharding-core-common-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.type.standard.StandardRoutingEngine.routeDataSources(StandardRoutingEngine.java:191) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.type.standard.StandardRoutingEngine.route(StandardRoutingEngine.java:178) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.type.standard.StandardRoutingEngine.routeByShardingConditionsWithCondition(StandardRoutingEngine.java:108) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.type.standard.StandardRoutingEngine.routeByShardingConditions(StandardRoutingEngine.java:102) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.type.standard.StandardRoutingEngine.getDataNodes(StandardRoutingEngine.java:87) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.type.standard.StandardRoutingEngine.route(StandardRoutingEngine.java:69) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.router.sharding.ParsingSQLRouter.route(ParsingSQLRouter.java:106) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.route.PreparedStatementRoutingEngine.route(PreparedStatementRoutingEngine.java:66) ~[sharding-core-route-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.PreparedQueryShardingEngine.route(PreparedQueryShardingEngine.java:60) ~[sharding-core-entry-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.core.BaseShardingEngine.shard(BaseShardingEngine.java:64) ~[sharding-core-entry-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.shard(ShardingPreparedStatement.java:224) ~[sharding-jdbc-core-4.0.0-RC1.jar:4.0.0-RC1] at org.apache.shardingsphere.shardingjdbc.jdbc.core.statement.ShardingPreparedStatement.executeQuery(ShardingPreparedStatement.java:109) ~[sharding-jdbc-core-4.0.0-RC1.jar:4.0.0-RC1`
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
