You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Syed Shameerur Rahman (Jira)" <ji...@apache.org> on 2021/01/28 04:27:01 UTC
[jira] [Updated] (HIVE-24690) GlobalLimitOptimizer Fails To
Identify Some Queries With LIMIT Operator
[ https://issues.apache.org/jira/browse/HIVE-24690?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Syed Shameerur Rahman updated HIVE-24690:
-----------------------------------------
Description:
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 as select * from t1 LIMIT 10;
{code}
was:
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}
> 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: 1.1.0, 2.1.0, 3.1.0
> Reporter: Syed Shameerur Rahman
> Assignee: Syed Shameerur Rahman
> Priority: Major
>
> 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 as select * from t1 LIMIT 10;
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)