[ https://issues.apache.org/jira/browse/HIVE-14519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15418053#comment-15418053 ]
Yongzhi Chen commented on HIVE-14519: ------------------------------------- The issue is related to constant propagation optimizer, after set hive.optimize.constant.propagation=false; The query works fine. The constant optimizer makes where 1=2 a filter always return false, which trigger WhereFalseProcessor in NullScanOptimizer. The WhereFalseProcessor checks the filter's ancestors, if there is an TableScanOperator, change the TableScanOperator to read MetadataOnly. Reading only metadata means no rows will be fetched, it works fine if the TableScanOperator only works with the filter always returns false (where 1=2). But in the multi insert case, this TableScanOperator also an ancestor for two other operators: filter( key = 100) and a filesinkoperator. No rows returned in the TableScanOperator causes issues to the other two inserts. Fix it by do not use the NullScanOptimizer when the false filter has peers. > Multi insert query bug > ---------------------- > > Key: HIVE-14519 > URL: https://issues.apache.org/jira/browse/HIVE-14519 > Project: Hive > Issue Type: Bug > Components: Logical Optimizer > Reporter: Yongzhi Chen > Assignee: Yongzhi Chen > > When running multi-insert queries, when one of the query is not returning > results, the other query is not returning the right result. > For example: > After following query, there is no value in /tmp/emp/dir3/000000_0 > {noformat} > From (select * from src) a > insert overwrite directory '/tmp/emp/dir1/' > select key, value > insert overwrite directory '/tmp/emp/dir2/' > select 'header' > where 1=2 > insert overwrite directory '/tmp/emp/dir3/' > select key, value > where key = 100; > {noformat} > where clause in the second insert should not affect the third insert. -- This message was sent by Atlassian JIRA (v6.3.4#6332)