[ 
https://issues.apache.org/jira/browse/HIVE-10833?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eugene Koifman updated HIVE-10833:
----------------------------------
    Description: 
While working on HIVE-10828 I noticed that internal state of RowResolver looks 
odd when CBO is enabled.
Consider the script below.
{noformat}
set hive.enforce.bucketing=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.cbo.enable=false;

drop table if exists acid_partitioned;
create table acid_partitioned (a int, c string)
  partitioned by (p int)
  clustered by (a) into 1 buckets;
  
insert into acid_partitioned partition (p) (a,p) values(1,1);
{noformat}
(this test is part of 
ql/src/test/results/clientpositive/insert_into_with_schema2.q)
With CBO on,
if you put a break point in {noformat}SemanticAnalyzer.genSelectPlan(String 
dest, ASTNode selExprList, QB qb, Operator<?> input,
      Operator<?> inputForSelectStar, boolean outerLV){noformat} at line 

    _selectStar = selectStar && exprList.getChildCount() == posn + 1;_

(currently 3865) and examine _out_rwsch.rslvMap_ variable looks like 
{noformat}{null={values__tmp__table__1.tmp_values_col1=_col0: string, 
values__tmp__table__1.tmp_values_col2=_col1: string}}{noformat}

with CBO disabled, the same _out_rwsch.rslvMap_ looks like
{noformat}{values__tmp__table__1={tmp_values_col1=_col0: string, 
tmp_values_col2=_col1: string}}{noformat}

The _out_rwsch.invRslvMap_ also differs in the same way.

It seems that the version you get with CBO off is the correct one since
_insert into acid_partitioned partition (p) (a,p) values(1,1)_ is rewritten to
_insert into acid_partitioned partition (p) (a,p) select * from 
values__tmp__table__1_

CC [~ashutoshc]

  was:
While working on HIVE-10828 I noticed that internal state of RowResolver looks 
odd when CBO is enabled.
Consider the script below.
{noformat}
set hive.enforce.bucketing=true;
set hive.exec.dynamic.partition.mode=nonstrict;
set hive.cbo.enable=false;

drop table if exists acid_partitioned;
create table acid_partitioned (a int, c string)
  partitioned by (p int)
  clustered by (a) into 1 buckets;
  
insert into acid_partitioned partition (p) (a,p) values(1,1);
{noformat}

With CBO on,
if you put a break point in {noformat}SemanticAnalyzer.genSelectPlan(String 
dest, ASTNode selExprList, QB qb, Operator<?> input,
      Operator<?> inputForSelectStar, boolean outerLV){noformat} at line 

    _selectStar = selectStar && exprList.getChildCount() == posn + 1;_

(currently 3865) and examine _out_rwsch.rslvMap_ variable looks like 
{noformat}{null={values__tmp__table__1.tmp_values_col1=_col0: string, 
values__tmp__table__1.tmp_values_col2=_col1: string}}{noformat}

with CBO disabled, the same _out_rwsch.rslvMap_ looks like
{noformat}{values__tmp__table__1={tmp_values_col1=_col0: string, 
tmp_values_col2=_col1: string}}{noformat}

The _out_rwsch.invRslvMap_ also differs in the same way.

It seems that the version you get with CBO off is the correct one since
_insert into acid_partitioned partition (p) (a,p) values(1,1)_ is rewritten to
_insert into acid_partitioned partition (p) (a,p) select * from 
values__tmp__table__1_

CC [~ashutoshc]


> RowResolver looks mangled with CBO 
> -----------------------------------
>
>                 Key: HIVE-10833
>                 URL: https://issues.apache.org/jira/browse/HIVE-10833
>             Project: Hive
>          Issue Type: Bug
>          Components: CBO, Query Planning
>    Affects Versions: 1.3.0
>            Reporter: Eugene Koifman
>            Assignee: Laljo John Pullokkaran
>
> While working on HIVE-10828 I noticed that internal state of RowResolver 
> looks odd when CBO is enabled.
> Consider the script below.
> {noformat}
> set hive.enforce.bucketing=true;
> set hive.exec.dynamic.partition.mode=nonstrict;
> set hive.cbo.enable=false;
> drop table if exists acid_partitioned;
> create table acid_partitioned (a int, c string)
>   partitioned by (p int)
>   clustered by (a) into 1 buckets;
>   
> insert into acid_partitioned partition (p) (a,p) values(1,1);
> {noformat}
> (this test is part of 
> ql/src/test/results/clientpositive/insert_into_with_schema2.q)
> With CBO on,
> if you put a break point in {noformat}SemanticAnalyzer.genSelectPlan(String 
> dest, ASTNode selExprList, QB qb, Operator<?> input,
>       Operator<?> inputForSelectStar, boolean outerLV){noformat} at line 
>     _selectStar = selectStar && exprList.getChildCount() == posn + 1;_
> (currently 3865) and examine _out_rwsch.rslvMap_ variable looks like 
> {noformat}{null={values__tmp__table__1.tmp_values_col1=_col0: string, 
> values__tmp__table__1.tmp_values_col2=_col1: string}}{noformat}
> with CBO disabled, the same _out_rwsch.rslvMap_ looks like
> {noformat}{values__tmp__table__1={tmp_values_col1=_col0: string, 
> tmp_values_col2=_col1: string}}{noformat}
> The _out_rwsch.invRslvMap_ also differs in the same way.
> It seems that the version you get with CBO off is the correct one since
> _insert into acid_partitioned partition (p) (a,p) values(1,1)_ is rewritten to
> _insert into acid_partitioned partition (p) (a,p) select * from 
> values__tmp__table__1_
> CC [~ashutoshc]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to