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

ASF GitHub Bot commented on NIFI-5095:
--------------------------------------

Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/2645
  
    @pvillard31 Thanks for pointing that. Yes, it's indirectly related to 
NIFI-5044. If pre/post query statement is added to SelectHiveQuery, then 
statements such as 'set x=y' or 'add jar..' would be written there and will not 
be passed to findTableNames method I assume.
    
    However, for PutHiveQL, such queries can be bundled in the same FlowFile 
content. I filtered out only 'set x=y' statement, but it's not enough. 'add jar 
...' fails similarly. Moreover, if we're going to filter out those commands, we 
need to care all commands in this wiki page I guess.
    https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli
    It requires something like CommandProcessorFactory.
    
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/processors/CommandProcessorFactory.java#L51
    
    That will be overkill for this JIRA and findTableNames purpose. I will 
update this PR to simply lower the log level to INFO. Thanks!


> PutHiveQL should not log warning message when it fails to parse SET property 
> command
> ------------------------------------------------------------------------------------
>
>                 Key: NIFI-5095
>                 URL: https://issues.apache.org/jira/browse/NIFI-5095
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.5.0
>            Reporter: Koji Kawamura
>            Assignee: Koji Kawamura
>            Priority: Minor
>
> PutHiveQL can accept multiple queries separated by a specified delimiter 
> string, ';' by default. It supports users to specify Hive parameters by 'SET' 
> statement. E.g. set 'hive.exec.dynamic.partition.mode'=nonstrict
> PutHiveQL also parses each query string with Hive ParseDriver, in order to 
> find input/output table names within queries. However, the aforementioned 
> 'SET' command is not a valid Hive query. The only query can start with 'SET' 
> is 'SET ROLE'. 
> [https://raw.githubusercontent.com/apache/hive/master/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g]
>  When set property statement is parsed, following warning message is logged 
> and shown in the NiFi UI:
> {code:java}
> 2018-04-19 05:34:05,616 WARN [Timer-Driven Process Thread-8] 
> o.apache.nifi.processors.hive.PutHiveQL 
> PutHiveQL[id=db408703-0162-1000-0000-000073ad3455] Failed to parse hiveQL: 
> set hive.exec.dynamic.partition.mode=nonstrict due to 
> org.apache.hadoop.hive.ql.parse.ParseException: line 1:4 missing KW_ROLE at 
> 'hive' near 'hive' line 1:8 missing EOF at '.' near 'hive':
> {code}
> In case there are other DML statements such as 'INSERT ...' in the same 
> FlowFile content, those queries are performed successfully regardless of 
> having above parse failure. However, the warning message is mis-leading, it 
> looks as if queries have failed. We should not show such warning message for 
> set property commands.
> We can short-circuit query parse logic if statement starts with 'set', since 
> 'set role' does not have any target table. As a reference Hive HCatCli.java 
> has the similar filtering logic.
>  
> [https://github.com/apache/hive/blob/master/hcatalog/core/src/main/java/org/apache/hive/hcatalog/cli/HCatCli.java#L283]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to