[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-13 Thread Chaoyu Tang (JIRA)

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

Chaoyu Tang updated HIVE-8448:
--
Description: 
create table t1 (val date);
insert overwrite table t1 select '2014-10-10' from src limit 1;

create table t2 (val varchar(10));
insert overwrite table t2 select '2014-10-10' from src limit 1; 
==
Query:
select t.val from
(select val from t1
union all
select val from t1
union all
select val from t2
union all
select val from t1) t;
==
Will throw exception: 
{code}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible types 
for union operator
at 
org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
... 22 more
{code}

It was because at this query parse step, getCommonClassForUnionAll is used, but 
at execution getCommonClass is used. They are not used consistently in union. 
The later one does not support the implicit conversion from date to string, 
which is the problem cause.

The change might be simple to fix this particular union issue but I noticed 
that there are three versions of getCommonClass: getCommonClass, 
getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they need 
refactoring.

  was:
create table t1 (val date);
insert overwrite table t1 select '2014-10-10' from src limit 1;

create table t2 (val varchar(10));
insert overwrite table t2 select '2014-10-10' from src limit 1; 
==
Query:
select t.val from
(select val from t1
union all
select val from t1
union all
select val from t2
union all
select val from t1) t;
==
Will throw exception: 
{code}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible types 
for union operator
at 
org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
... 22 more
{code}

It was because at this query parse step, getCommonClassForUnionAll is used, but 
at execution getCommonClass is used. They are not used consistently in union. 
The later one does not support the implicit conversion from date to string, 
which is the problem cause.

The change might be simple 


> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Reporter: Chaoyu Tang
>Assignee: Chaoyu Tang
>Priority: Minor
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val fr

[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-13 Thread Chaoyu Tang (JIRA)

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

Chaoyu Tang updated HIVE-8448:
--
Description: 
create table t1 (val date);
insert overwrite table t1 select '2014-10-10' from src limit 1;

create table t2 (val varchar(10));
insert overwrite table t2 select '2014-10-10' from src limit 1; 
==
Query:
select t.val from
(select val from t1
union all
select val from t1
union all
select val from t2
union all
select val from t1) t;
==
Will throw exception: 
{code}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible types 
for union operator
at 
org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
... 22 more
{code}

It was because at this query parse step, getCommonClassForUnionAll is used, but 
at execution getCommonClass is used. They are not used consistently in union. 
The later one does not support the implicit conversion from date to string, 
which is the problem cause.

The change might be simple to fix this particular union issue but I noticed 
that there are three versions of getCommonClass: getCommonClass, 
getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they need 
to be cleaned and refactored.

  was:
create table t1 (val date);
insert overwrite table t1 select '2014-10-10' from src limit 1;

create table t2 (val varchar(10));
insert overwrite table t2 select '2014-10-10' from src limit 1; 
==
Query:
select t.val from
(select val from t1
union all
select val from t1
union all
select val from t2
union all
select val from t1) t;
==
Will throw exception: 
{code}
Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible types 
for union operator
at 
org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
at 
org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
at 
org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
at 
org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
... 22 more
{code}

It was because at this query parse step, getCommonClassForUnionAll is used, but 
at execution getCommonClass is used. They are not used consistently in union. 
The later one does not support the implicit conversion from date to string, 
which is the problem cause.

The change might be simple to fix this particular union issue but I noticed 
that there are three versions of getCommonClass: getCommonClass, 
getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they need 
refactoring.


> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Reporter: Chaoyu Tang
>Assignee: Chaoyu Tang
>Priority: Minor
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varc

[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: HIVE-8448.1.patch

Need code review. 

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.1.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Affects Version/s: 0.13.1
   Status: Patch Available  (was: Open)

when SemanticAnalyzer check union plan, it use getCommonClassForUnionAll, but 
when evaluate union operator it uses getCommonClass. The inconsistency cause 
some queries with multiple union all on date type column can pass the analyzer 
but fail with HiveException: Incompatible types at execute time.
Fixed by use new updateForUnionAll method which use getCommonClassForUnionAll 
to update column for union operator.

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.1.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: HIVE-8448.2.patch

fixes after review

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.1.patch, HIVE-8448.2.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Status: Open  (was: Patch Available)

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.1.patch, HIVE-8448.2.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: HIVE-8448.3.patch

need review

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.1.patch, HIVE-8448.2.patch, HIVE-8448.3.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Status: Patch Available  (was: Open)

Fixed code style after review

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.1.patch, HIVE-8448.2.patch, HIVE-8448.3.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: (was: HIVE-8448.3.patch)

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: (was: HIVE-8448.2.patch)

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: (was: HIVE-8448.1.patch)

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Attachment: HIVE-8448.4.patch

need code review

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.4.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Status: Open  (was: Patch Available)

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-15 Thread Yongzhi Chen (JIRA)

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

Yongzhi Chen updated HIVE-8448:
---
Status: Patch Available  (was: Open)

Fixed code style after review

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Attachments: HIVE-8448.4.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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


[jira] [Updated] (HIVE-8448) Union All might not work due to the type conversion issue

2014-10-16 Thread Szehon Ho (JIRA)

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

Szehon Ho updated HIVE-8448:

   Resolution: Fixed
Fix Version/s: 0.15.0
   Status: Resolved  (was: Patch Available)

Makes sense.  Committed to trunk, thanks Yongzhi for the contribution and Jason 
for additional review !

> Union All might not work due to the type conversion issue
> -
>
> Key: HIVE-8448
> URL: https://issues.apache.org/jira/browse/HIVE-8448
> Project: Hive
>  Issue Type: Bug
>Affects Versions: 0.13.1
>Reporter: Chaoyu Tang
>Assignee: Yongzhi Chen
>Priority: Minor
> Fix For: 0.15.0
>
> Attachments: HIVE-8448.4.patch
>
>
> create table t1 (val date);
> insert overwrite table t1 select '2014-10-10' from src limit 1;
> create table t2 (val varchar(10));
> insert overwrite table t2 select '2014-10-10' from src limit 1; 
> ==
> Query:
> select t.val from
> (select val from t1
> union all
> select val from t1
> union all
> select val from t2
> union all
> select val from t1) t;
> ==
> Will throw exception: 
> {code}
> Caused by: org.apache.hadoop.hive.ql.metadata.HiveException: Incompatible 
> types for union operator
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:86)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.SelectOperator.initializeOp(SelectOperator.java:65)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:464)
>   at 
> org.apache.hadoop.hive.ql.exec.Operator.initializeChildren(Operator.java:420)
>   at 
> org.apache.hadoop.hive.ql.exec.TableScanOperator.initializeOp(TableScanOperator.java:193)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:443)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:380)
>   at 
> org.apache.hadoop.hive.ql.exec.mr.ExecMapper.configure(ExecMapper.java:133)
>   ... 22 more
> {code}
> It was because at this query parse step, getCommonClassForUnionAll is used, 
> but at execution getCommonClass is used. They are not used consistently in 
> union. The later one does not support the implicit conversion from date to 
> string, which is the problem cause.
> The change might be simple to fix this particular union issue but I noticed 
> that there are three versions of getCommonClass: getCommonClass, 
> getCommonClassForComparison, getCommonClassForUnionAll, and wonder if they 
> need to be cleaned and refactored.



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