Syed Shameerur Rahman created HIVE-24690:
--------------------------------------------
Summary: GlobalLimitOptimizer Fails To Identify Some Queries With
LIMIT Operator
Key: HIVE-24690
URL: https://issues.apache.org/jira/browse/HIVE-24690
Project: Hive
Issue Type: Bug
Components: Query Planning
Affects Versions: 3.1.0, 2.1.0, 1.1.0
Reporter: Syed Shameerur Rahman
Assignee: Syed Shameerur Rahman
As per
[https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GlobalLimitOptimizer.java#L88]
queries like
{code:java}
CREATE TABLE ... AS SELECT col1, col2 FROM tbl LIMIT ..
INSERT OVERWRITE TABLE ... SELECT col1, hash(col2), split(col1) FROM ...
LIMIT...
{code}
falls under the category of qualified list, But after HIVE-9444 it is not.
On investigating this issue, It is found that for
{code:java}
CREATE TABLE ... AS SELECT col1, col2 FROM tbl LIMIT
{code}
query the operator tree looks like *TS -> SEL -> LIM -> RS -> SEL -> LIM -> FS*
Since only only LIMIT operator is allowed as per
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/GlobalLimitOptimizer.java#L196
, The *GlobalLimitOptimizer* fails to identify such queries.
*Steps To Reproduce*
{code:java}
set hive.limit.optimize.enable=true;
create table t1 (a int);
create table t2 select * from t1 LIMIT 10;
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)