解决kylin查询报错:org.apache.kylin.rest.exception.InternalErrorException

报错信息:

-- ::, ERROR [Query 12e9c054-760c---b1f06724c9b6-] service.QueryService: : Exception when execute sql
java.lang.NullPointerException
at org.apache.kylin.metadata.project.ProjectL2Cache.loadCache(ProjectL2Cache.java:)
at org.apache.kylin.metadata.project.ProjectL2Cache.getCache(ProjectL2Cache.java:)
at org.apache.kylin.metadata.project.ProjectL2Cache.listExposedTables(ProjectL2Cache.java:)
at org.apache.kylin.metadata.project.ProjectManager.listExposedTables(ProjectManager.java:)
at org.apache.kylin.query.schema.OLAPSchemaFactory.createTempOLAPJson(OLAPSchemaFactory.java:)
at org.apache.kylin.rest.service.CacheService.getOLAPDataSource(CacheService.java:)
at org.apache.kylin.rest.service.QueryService.execute(QueryService.java:)
at org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:)
at org.apache.kylin.rest.service.QueryService.query(QueryService.java:)
at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:)
at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
==========================[QUERY]===============================
Query Id: 12e9c054-760c---b1f06724c9b6
SQL: select VISIT_TYPE, count(*) from xxdb.xxtable group by VISIT_TYPE
LIMIT
User: ADMIN
Success: true
Duration: 0.0
Project: energon_dm
Realization Names: []
Cuboid Ids: []
Total scan count:
Result row count:
Accept Partial: true
Is Partial Result: false
Hit Exception Cache: false
Storage cache used: false
Message: null
==========================[QUERY]===============================
-- ::, ERROR [http-bio--exec-] controller.BasicController: :
org.apache.kylin.rest.exception.InternalErrorException
at org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:)
at org.apache.kylin.rest.controller.QueryController.query(QueryController.java:)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:)
at java.lang.reflect.Method.invoke(Method.java:)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:)

解决过程:

根据报错信息排查源码:

解决kylin查询报错:org.apache.kylin.rest.exception.InternalErrorException

193行pi不为空,那就只能是pi.getExtFilters()为空,查看对应的meta数据,此字段果然为null。正常情况下此字段没值时应该是个空数组,改为空数组后解决。原来异常meta是用户自己生成通过后台程序传入kylin的。

解决kylin查询报错:org.apache.kylin.rest.exception.InternalErrorException

ps: 上面代码位于类org.apache.kylin.metadata.project.ProjectL2Cache中,这个类对应的就是Meta中的一个project:

解决kylin查询报错:org.apache.kylin.rest.exception.InternalErrorException

上一篇:Freemarker实例教程


下一篇:1576. 替换所有的问号