[jira] [Commented] (HIVE-2747) UNION ALL with subquery which selects NULL and performs group by fails

2012-02-02 Thread Namit Jain (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HIVE-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13199099#comment-13199099
 ] 

Namit Jain commented on HIVE-2747:
--

create table tmp_tx1 (key string, value string);

insert overwrite table tmp_tx1 select * from src where key < 10;

create table tmp_tx2 (key int, value string);

insert overwrite table tmp_tx2 select * from src where key < 10;

select * from
(
  select key, count(1) from tmp_tx1 group by key
union all
  select key, count(1) from tmp_tx2 group by key
)
u;


The above also fails. Basically, if the types of the union dont match, we get a 
run-time error.


The query:


select * from
(
  select key, count(1) from tmp_tx1 group by key
union all
  select cast(key as string) as key, count(1) from tmp_tx2 group by key
)
u;



works fine

> UNION ALL with subquery which selects NULL and performs group by fails
> --
>
> Key: HIVE-2747
> URL: https://issues.apache.org/jira/browse/HIVE-2747
> Project: Hive
>  Issue Type: Bug
>Reporter: Kevin Wilfong
>Assignee: Kevin Wilfong
>
> Queries like the following
> from (select key, value, count(1) as count from src group by key, value union 
> all select NULL as key, value, count(1) as count from src group by value) a 
> select count(*);
> fail with the exception
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector.toString(StructObjectInspector.java:60)
>   at java.lang.String.valueOf(String.java:2826)
>   at java.lang.StringBuilder.append(StringBuilder.java:115)
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:110)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:427)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:98)
>   ... 18 more
> This should at least provide a more informative error message if not work.
> It works without the group by.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (HIVE-2747) UNION ALL with subquery which selects NULL and performs group by fails

2012-02-02 Thread Kevin Wilfong (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HIVE-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13199153#comment-13199153
 ] 

Kevin Wilfong commented on HIVE-2747:
-

Namit, that looks like the issue in the JIRA
https://issues.apache.org/jira/browse/HIVE-2305

> UNION ALL with subquery which selects NULL and performs group by fails
> --
>
> Key: HIVE-2747
> URL: https://issues.apache.org/jira/browse/HIVE-2747
> Project: Hive
>  Issue Type: Bug
>Reporter: Kevin Wilfong
>Assignee: Kevin Wilfong
>
> Queries like the following
> from (select key, value, count(1) as count from src group by key, value union 
> all select NULL as key, value, count(1) as count from src group by value) a 
> select count(*);
> fail with the exception
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector.toString(StructObjectInspector.java:60)
>   at java.lang.String.valueOf(String.java:2826)
>   at java.lang.StringBuilder.append(StringBuilder.java:115)
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:110)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:427)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:98)
>   ... 18 more
> This should at least provide a more informative error message if not work.
> It works without the group by.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (HIVE-2747) UNION ALL with subquery which selects NULL and performs group by fails

2012-02-02 Thread Namit Jain (Commented) (JIRA)

[ 
https://issues.apache.org/jira/browse/HIVE-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13199166#comment-13199166
 ] 

Namit Jain commented on HIVE-2747:
--

Even a error message for now is fine.
The implicit type conversion can be done later.

> UNION ALL with subquery which selects NULL and performs group by fails
> --
>
> Key: HIVE-2747
> URL: https://issues.apache.org/jira/browse/HIVE-2747
> Project: Hive
>  Issue Type: Bug
>Reporter: Kevin Wilfong
>
> Queries like the following
> from (select key, value, count(1) as count from src group by key, value union 
> all select NULL as key, value, count(1) as count from src group by value) a 
> select count(*);
> fail with the exception
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector.toString(StructObjectInspector.java:60)
>   at java.lang.String.valueOf(String.java:2826)
>   at java.lang.StringBuilder.append(StringBuilder.java:115)
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:110)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:427)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:98)
>   ... 18 more
> This should at least provide a more informative error message if not work.
> It works without the group by.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (HIVE-2747) UNION ALL with subquery which selects NULL and performs group by fails

2013-10-23 Thread jeff little (JIRA)

[ 
https://issues.apache.org/jira/browse/HIVE-2747?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13802729#comment-13802729
 ] 

jeff little commented on HIVE-2747:
---

Hi, Kevin Wilfong.
You can try the hql: "from (select key, value, cast( count(1) as int) count 
from src group by key, value union all select NULL as key, value,cast( count(1) 
as int) count from src group by value) a select count;". You should modify the 
data type of ’count‘, otherwise the data type of  'count' in the  intermediate 
result  is void type, so it will cause "java.lang.NullPointerException". In 
addition, if the hql sentences have union all operator, you should use 'AS' as 
the column's alias.

> UNION ALL with subquery which selects NULL and performs group by fails
> --
>
> Key: HIVE-2747
> URL: https://issues.apache.org/jira/browse/HIVE-2747
> Project: Hive
>  Issue Type: Bug
>Reporter: Kevin Wilfong
>
> Queries like the following
> from (select key, value, count(1) as count from src group by key, value union 
> all select NULL as key, value, count(1) as count from src group by value) a 
> select count(*);
> fail with the exception
> java.lang.NullPointerException
>   at 
> org.apache.hadoop.hive.serde2.objectinspector.StructObjectInspector.toString(StructObjectInspector.java:60)
>   at java.lang.String.valueOf(String.java:2826)
>   at java.lang.StringBuilder.append(StringBuilder.java:115)
>   at 
> org.apache.hadoop.hive.ql.exec.UnionOperator.initializeOp(UnionOperator.java:110)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at 
> org.apache.hadoop.hive.ql.exec.MapOperator.initializeOp(MapOperator.java:427)
>   at org.apache.hadoop.hive.ql.exec.Operator.initialize(Operator.java:357)
>   at org.apache.hadoop.hive.ql.exec.ExecMapper.configure(ExecMapper.java:98)
>   ... 18 more
> This should at least provide a more informative error message if not work.
> It works without the group by.



--
This message was sent by Atlassian JIRA
(v6.1#6144)