[ 
https://issues.apache.org/jira/browse/KYLIN-4245?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17083072#comment-17083072
 ] 

ASF GitHub Bot commented on KYLIN-4245:
---------------------------------------

zhangayqian commented on pull request #1179: KYLIN-4245 SqlConverter returns 
wrong syntax SQL when SqlParser fails…
URL: https://github.com/apache/kylin/pull/1179
 
 
   … for JDBC source
   
   ## Proposed changes
   
   Describe the big picture of your changes here to communicate to the 
maintainers why we should accept this pull request. If it fixes a bug or 
resolves a feature request, be sure to link to that issue.
   
   ## Types of changes
   
   What types of changes does your code introduce to Kylin?
   _Put an `x` in the boxes that apply_
   
   - [ ] Bugfix (non-breaking change which fixes an issue)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to not work as expected)
   - [ ] Documentation Update (if none of the other choices apply)
   
   ## Checklist
   
   _Put an `x` in the boxes that apply. You can also fill these out after 
creating the PR. If you're unsure about any of them, don't hesitate to ask. 
We're here to help! This is simply a reminder of what we are going to look for 
before merging your code._
   
   - [ ] I have create an issue on [Kylin's 
jira](https://issues.apache.org/jira/browse/KYLIN), and have described the 
bug/feature there in detail
   - [ ] Commit messages in my PR start with the related jira ID, like 
"KYLIN-0000 Make Kylin project open-source"
   - [ ] Compiling and unit tests pass locally with my changes
   - [ ] I have added tests that prove my fix is effective or that my feature 
works
   - [ ] If this change need a document change, I will prepare another pr 
against the `document` branch
   - [ ] Any dependent changes have been merged
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at 
user@kylin or dev@kylin by explaining why you chose the solution you did and 
what alternatives you considered, etc...
   
 
----------------------------------------------------------------
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]


> SqlConverter returns wrong syntax SQL when SqlParser fails for JDBC source
> --------------------------------------------------------------------------
>
>                 Key: KYLIN-4245
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4245
>             Project: Kylin
>          Issue Type: Bug
>          Components: Others
>    Affects Versions: v2.6.4
>            Reporter: Cheng Zhong
>            Priority: Critical
>
> Last year ( 28 Nov 2018) a 
> [change|https://github.com/apache/kylin/commit/4158d7b3b56cbeb3c10ec5c091c23334131616a5]
>  have been made to SqlConverter, that replace backtick to double qoute when 
> converting sql. sqlWriter is responsible to format it back to backtick after 
> parsing.
> However, if something failed in during parsing or formating, the SQL 
> (backtick replaced with double qoute) will be returned instead. This will 
> cause failure in following Sqoop execution.
> Information:
> SQL of Cube:
> {code:sql}
> SELECT
> `COM_BASIC_INFO`.`COM_NAME` as `COM_BASIC_INFO_COM_NAME`
> ,`COM_BASIC_INFO`.`COM_ENAME` as `COM_BASIC_INFO_COM_ENAME`
> ,`COM_BASIC_INFO`.`SNAME` as `COM_BASIC_INFO_SNAME`
> ,`COM_BASIC_INFO`.`FIN_REPO_TYPE` as `COM_BASIC_INFO_FIN_REPO_TYPE`
>  FROM `COM_DS`.`COM_BASIC_INFO` as `COM_BASIC_INFO`
> WHERE 1=1
> {code}
> SQL Submitted to Sqoop (Exactly the one after replace backtick with double 
> qoute):
> {code:sql}
> SELECT "COM_BASIC_INFO"."COM_NAME" as "COM_BASIC_INFO_COM_NAME" 
> ,"COM_BASIC_INFO"."COM_ENAME" as "COM_BASIC_INFO_COM_ENAME" 
> ,"COM_BASIC_INFO"."SNAME" as "COM_BASIC_INFO_SNAME" 
> ,"COM_BASIC_INFO"."FIN_REPO_TYPE" as "COM_BASIC_INFO_FIN_REPO_TYPE"  FROM 
> "COM_DS"."COM_BASIC_INFO" as "COM_BASIC_INFO" WHERE 1=1 AND  (1 = 0)
> {code}
> Error Logs:
> {code}
> 2019-11-08 15:17:49,609 ERROR [http-bio-7070-exec-29] conv.SqlConverter:60 : 
> Failed to default convert sql, will use the input: SELECT 
> `COM_BASIC_INFO`.`COM_NAME` as `COM_BASIC_INFO_COM_NAME` 
> ,`COM_BASIC_INFO`.`COM_ENAME` as `COM_BASIC_INFO_COM_ENAME` 
> ,`COM_BASIC_INFO`.`SNAME` as `COM_BASIC_INFO_SNAME` 
> ,`COM_BASIC_INFO`.`FIN_REPO_TYPE` as `COM_BASIC_INFO_FIN_REPO_TYPE`  FROM 
> `COM_DS`.`COM_BASIC_INFO` as `COM_BASIC_INFO` WHERE 1=1
> java.lang.IllegalStateException: java.sql.SQLSyntaxErrorException: SELECT 
> command denied to user 'dbuser'@'db.ip.addr.1' for table 'tablename'
>       at 
> org.apache.kylin.sdk.datasource.adaptor.DefaultAdaptor.fixIdentifierCaseSensitve(DefaultAdaptor.java:277)
>       at 
> org.apache.kylin.sdk.datasource.framework.conv.DefaultConfiguer.fixIdentifierCaseSensitve(DefaultConfiguer.java:131)
>       at 
> org.apache.kylin.sdk.datasource.framework.conv.ConvSqlWriter.identifier(ConvSqlWriter.java:145)
>       at org.apache.calcite.sql.SqlIdentifier.unparse(SqlIdentifier.java:298)
>       at org.apache.calcite.sql.SqlAsOperator.unparse(SqlAsOperator.java:76)
>       at org.apache.calcite.sql.SqlDialect.unparseCall(SqlDialect.java:333)
>       at 
> org.apache.calcite.sql.dialect.MysqlSqlDialect.unparseCall(MysqlSqlDialect.java:155)
>       at org.apache.calcite.sql.SqlCall.unparse(SqlCall.java:103)
>       at org.apache.calcite.sql.SqlNodeList.commaList(SqlNodeList.java:121)
>       at 
> org.apache.calcite.sql.SqlOperator.unparseListClause(SqlOperator.java:349)
>       at 
> org.apache.calcite.sql.SqlOperator.unparseListClause(SqlOperator.java:338)
>       at 
> org.apache.calcite.sql.SqlSelectOperator.unparse(SqlSelectOperator.java:152)
>       at org.apache.calcite.sql.SqlSelect.unparse(SqlSelect.java:237)
>       at 
> org.apache.calcite.sql.pretty.SqlPrettyWriter.format(SqlPrettyWriter.java:806)
>       at 
> org.apache.kylin.sdk.datasource.framework.conv.SqlConverter.convertSql(SqlConverter.java:58)
>       at 
> org.apache.kylin.sdk.datasource.framework.JdbcConnector.convertSql(JdbcConnector.java:84)
>       at 
> org.apache.kylin.source.jdbc.extensible.JdbcHiveInputBase$JDBCBaseBatchCubingInputSide.createSqoopToFlatHiveStep(JdbcHiveInputBase.java:79)
>       at 
> org.apache.kylin.source.jdbc.JdbcHiveInputBase$JdbcBaseBatchCubingInputSide.addStepPhase1_DoCreateFlatTable(JdbcHiveInputBase.java:65)
>       at 
> org.apache.kylin.source.hive.HiveInputBase$BaseBatchCubingInputSide.addStepPhase1_CreateFlatTable(HiveInputBase.java:83)
>       at 
> org.apache.kylin.engine.mr.BatchCubingJobBuilder2.build(BatchCubingJobBuilder2.java:59)
>       at 
> org.apache.kylin.engine.mr.MRBatchCubingEngine2.createBatchCubingJob(MRBatchCubingEngine2.java:42)
>       at 
> org.apache.kylin.engine.EngineFactory.createBatchCubingJob(EngineFactory.java:60)
>       at 
> org.apache.kylin.rest.service.JobService.submitJobInternal(JobService.java:234)
>       at 
> org.apache.kylin.rest.service.JobService.submitJob(JobService.java:202)
>       at 
> org.apache.kylin.rest.controller.CubeController.buildInternal(CubeController.java:395)
>       at 
> org.apache.kylin.rest.controller.CubeController.rebuild(CubeController.java:355)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to