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/07/06 10:20:51 UTC

[GitHub] [shardingsphere] zodostffaa opened a new issue, #18902: Caused by: java.lang.NullPointerException: null at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)

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

   ## 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.2
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   Spring Boot、MyBtatis、ShardingSphere-JDBC
   ### Expected behavior
   return two tables union query result.
   ### Actual behavior
   Caused by: java.lang.NullPointerException: null at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)
   ### Reason analyze (If you can)
   First select is ok
   ![image](https://user-images.githubusercontent.com/10627887/177528262-9c429e1f-6b02-4fe0-a224-06127b6b0cbf.png)
   Here throws the NullPointerException
   ![image](https://user-images.githubusercontent.com/10627887/177528296-ad4daaab-9ba8-4cd1-b7ce-ec4040a15403.png)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   `18:16:28.789 [http-nio-8500-exec-7] DEBUG c.s.f.m.I.selectJoinOrUnionBySqlString - [debug,137] - ==>  Preparing: ( SELECT i.id, i.image_id, i.shard_time, i.image_url, i.video_url, i.camera_id, i.create_time FROM image AS i INNER JOIN ( SELECT shard_time , cameraId FROM human WHERE type = 'person' AND shard_time BETWEEN '2022-07-05 18:14:00' AND '2022-07-06 18:14:00' GROUP BY shard_time, cameraId ORDER BY shard_time DESC LIMIT 1000 ) AS m7 ON m7.shard_time = i.shard_time AND m7.cameraId = i.camera_id WHERE 1 = 1 ) UNION ( SELECT i.id, i.image_id, i.shard_time, i.image_url, i.video_url, i.camera_id, i.create_time FROM image AS i INNER JOIN ( SELECT shard_time , cameraId FROM vehicle WHERE type = 'bus' AND shard_time BETWEEN '2022-07-05 18:14:00' AND '2022-07-06 18:14:00' GROUP BY shard_time, cameraId ORDER BY shard_time DESC LIMIT 1000 ) AS m1 ON m1.shard_time = i.shard_time AND m1.cameraId = i.camera_id WHERE 1 = 1 ) LIMIT 0,30
   org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorException: Error preparing statement.  Cause: java.lang.NullPointerException
   	at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96)
   	at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
   	at com.sun.proxy.$Proxy247.selectList(Unknown Source)
   	at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:224)
   	at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
   	at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
   	at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145)
   	at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86)
   	at com.sun.proxy.$Proxy310.selectJoinOrUnionBySqlString(Unknown Source)
   	at com.senturian.facial.service.impl.ImageServiceImpl.init(ImageServiceImpl.java:155)
   	at com.senturian.facial.service.impl.ImageServiceImpl$$FastClassBySpringCGLIB$$9d8b4587.invoke(<generated>)
   	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
   	at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
   	at com.senturian.framework.aspectj.DataSourceAspect.around(DataSourceAspect.java:49)
   	at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
   	at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
   	at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:175)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
   	at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
   	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
   	at com.senturian.facial.service.impl.ImageServiceImpl$$EnhancerBySpringCGLIB$$bfaf7413.init(<generated>)
   	at com.senturian.facial.controller.ImageController.search(ImageController.java:72)
   	at com.senturian.facial.controller.ImageController$$FastClassBySpringCGLIB$$1069e02d.invoke(<generated>)
   	at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
   	at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor$1.proceed(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:82)
   	at org.apache.shiro.authz.aop.AuthorizingMethodInterceptor.invoke(AuthorizingMethodInterceptor.java:39)
   	at org.apache.shiro.spring.security.interceptor.AopAllianceAnnotationsAuthorizingMethodInterceptor.invoke(AopAllianceAnnotationsAuthorizingMethodInterceptor.java:115)
   	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
   	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
   	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:698)
   	at com.senturian.facial.controller.ImageController$$EnhancerBySpringCGLIB$$3a6843c1.search(<generated>)
   	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.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
   	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
   	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
   	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
   	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
   	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
   	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1067)
   	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
   	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
   	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:681)
   	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
   	at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
   	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
   	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
   	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
   	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
   	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
   	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
   	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
   	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
   	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
   	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
   	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
   	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
   	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
   	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
   	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
   	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:450)
   	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
   	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
   	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
   	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:387)
   	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
   	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:124)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
   	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)
   	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
   	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
   	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)
   	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)
   	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
   	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)
   	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
   	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
   	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)
   	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)
   	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
   	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)
   	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)
   	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
   	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
   	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
   	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
   	at java.lang.Thread.run(Thread.java:748)
   Caused by: org.apache.ibatis.executor.ExecutorException: Error preparing statement.  Cause: java.lang.NullPointerException
   	at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:97)
   	at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59)
   	at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:87)
   	at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
   	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.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:132)
   	at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
   	at com.sun.proxy.$Proxy375.query(Unknown Source)
   	at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:151)
   	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.GeneratedMethodAccessor73.invoke(Unknown Source)
   	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)
   	... 124 common frames omitted
   Caused by: java.lang.NullPointerException: null
   	at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)
   	at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.createSubqueryTables(TablesContext.java:99)
   	at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.<init>(TablesContext.java:86)
   	at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:110)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:158)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:141)
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:126)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:180)
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:148)
   	at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:86)
   	at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.apache.ibatis.logging.jdbc.ConnectionLogger.invoke(ConnectionLogger.java:55)
   	at com.sun.proxy.$Proxy260.prepareStatement(Unknown Source)
   	at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:86)
   	at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88)
   	... 140 common frames omitted`
   
   ### 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] strongduanmu commented on issue #18902: Caused by: java.lang.NullPointerException: null at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)

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

   @zodostffaa Thank you for your feedback, this bug has been fixed by #18840.


-- 
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] strongduanmu closed issue #18902: Caused by: java.lang.NullPointerException: null at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #18902: Caused by: java.lang.NullPointerException: null 	at org.apache.shardingsphere.infra.binder.segment.select.subquery.engine.SubqueryTableContextEngine.createSubqueryTableContexts(SubqueryTableContextEngine.java:43)
URL: https://github.com/apache/shardingsphere/issues/18902


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