报错信息:
2017-06-26 20:06:58,925 ERROR [Query 12e9c054-760c-4615-9699-b1f06724c9b6-328] service.QueryService:372 : Exception when execute sql java.lang.NullPointerException at org.apache.kylin.metadata.project.ProjectL2Cache.loadCache(ProjectL2Cache.java:193) at org.apache.kylin.metadata.project.ProjectL2Cache.getCache(ProjectL2Cache.java:167) at org.apache.kylin.metadata.project.ProjectL2Cache.listExposedTables(ProjectL2Cache.java:84) at org.apache.kylin.metadata.project.ProjectManager.listExposedTables(ProjectManager.java:409) at org.apache.kylin.query.schema.OLAPSchemaFactory.createTempOLAPJson(OLAPSchemaFactory.java:83) at org.apache.kylin.rest.service.CacheService.getOLAPDataSource(CacheService.java:159) at org.apache.kylin.rest.service.QueryService.execute(QueryService.java:526) at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:452) at org.apache.kylin.rest.service.QueryService.query(QueryService.java:151) at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:354) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
==========================[QUERY]=============================== Query Id: 12e9c054-760c-4615-9699-b1f06724c9b6 SQL: select VISIT_TYPE, count(*) from xxdb.xxtable group by VISIT_TYPE LIMIT 50000 User: ADMIN Success: true Duration: 0.0 Project: energon_dm Realization Names: [] Cuboid Ids: [] Total scan count: 0 Result row count: 0 Accept Partial: true Is Partial Result: false Hit Exception Cache: false Storage cache used: false Message: null ==========================[QUERY]=============================== 2017-06-26 20:06:58,926 ERROR [http-bio-7070-exec-6] controller.BasicController:44 : org.apache.kylin.rest.exception.InternalErrorException at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:389) at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:69) 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:497) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:743) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:672) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:82) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:933) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:867) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:951) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:853)
解决过程:
根据报错信息排查源码:
193行pi不为空,那就只能是pi.getExtFilters()为空,查看对应的meta数据,此字段果然为null。正常情况下此字段没值时应该是个空数组,改为空数组后解决。原来异常meta是用户自己生成通过后台程序传入kylin的。
ps: 上面代码位于类org.apache.kylin.metadata.project.ProjectL2Cache中,这个类对应的就是Meta中的一个project: