[ https://issues.apache.org/jira/browse/KYLIN-5016?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17369199#comment-17369199 ]
rongchuan.jin commented on KYLIN-5016: -------------------------------------- *[Root Cause]* I found SqlDialect.CALCITE may be null in my debug env, this may be the root cause of above npe issue which also is empty dialect. So I try to replace SqlDialect.CALCITE with SqlDialect.DatabaseProduct.CALCITE.getDialect() which will be initialed for sure. As SqlDialect.CALCITE is a static field in SqlDialect which might not be initialize at that time. > Avoid potential NPE issue in RDBMS Pushdown case > ------------------------------------------------ > > Key: KYLIN-5016 > URL: https://issues.apache.org/jira/browse/KYLIN-5016 > Project: Kylin > Issue Type: Improvement > Components: RDBMS Source > Affects Versions: v2.6.5, v3.1.2 > Reporter: rongchuan.jin > Assignee: rongchuan.jin > Priority: Minor > > When I use pushdown with RDBMS source, I encounter some error when convert > sql which leads to pushdown failing. > I find below stacktrace like > {code:java} > 2020-12-23 13:14:10,212 ERROR [Query a1bf28bb-de28-433e-ab96-28ce234a1a4a-76] > conv.SqlConverter : Failed to default convert sql, will use the origin input: > select 1 from `MOVIES_10M`.`DIM_MOVIES_10M` 2LIMIT 500 > 3java.lang.NullPointerException 4 at > org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:103) 5 at > org.apache.calcite.sql.pretty.SqlPrettyWriter.format(SqlPrettyWriter.java:806) > 6 at > org.apache.kylin.sdk.datasource.framework.conv.SqlConverter.convertSql(SqlConverter.java:69) > 7 at > org.apache.kylin.sdk.datasource.framework.JdbcConnector.convertSql(JdbcConnector.java:91) > 8 at > org.apache.kylin.sdk.datasource.PushDownRunnerSDKImpl.executeQuery(PushDownRunnerSDKImpl.java:55) > 9 at > org.apache.kylin.query.util.PushDownUtil.tryPushDownQuery(PushDownUtil.java:173) > 10 at > org.apache.kylin.query.util.PushDownUtil.tryPushDownSelectQuery(PushDownUtil.java:103) > 11 at > org.apache.kylin.rest.service.QueryService.tryPushDownSelectQuery(QueryService.java:773) > 12 at > org.apache.kylin.rest.service.QueryService.pushDownQuery(QueryService.java:709) > 13 at > org.apache.kylin.rest.service.QueryService.queryWithSqlMassage(QueryService.java:700) > 14 at > org.apache.kylin.rest.service.QueryService.query(QueryService.java:231) 15 at > org.apache.kylin.rest.service.QueryService.queryAndUpdateCache(QueryService.java:577) > 16 at > org.apache.kylin.rest.service.QueryService.queryWithCache(QueryService.java:512) > 17 at > org.apache.kylin.rest.service.QueryService.doQueryWithCache(QueryService.java:395){code} > -- This message was sent by Atlassian Jira (v8.3.4#803005)