You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "wu siqiang (Jira)" <ji...@apache.org> on 2022/01/28 04:47:00 UTC

[jira] [Updated] (HIVE-25908) Hive2.1.1 throws exception when use window function with complex type: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.lazybinary.LazyBinary*

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

wu siqiang updated HIVE-25908:
------------------------------
    Description: 
when i use window functions like last_value()  with complex type, it throws an execption during doing reducer tasks.

here are some test cases:
{code:sql}
with tmp as (
  select "a" as a, map(1, "a") as b
  union all
  select "b" as a, map(2, "b") as b
  union all
  select "c" as a, map(3, "c") as b
  union all
  select "d" as a, map(4, "d") as b
)
select a, last_value(b) over (partition by 1 order by a rows unbounded preceding )
from tmp;

-- ERROR:
with tmp as (
  select "a" as a, named_struct("c1", "a") as b
  union all
  select "b" as a, named_struct("c1", "b") as b
  union all
  select "c" as a, named_struct("c1", "c") as b
  union all
  select "d" as a, named_struct("c1", "d") as b
)
select a, last_value(b) over (partition by 1 order by a rows unbounded preceding )
from tmp;

-- ERROR:
with tmp as (
  select "a" as a, array("c1", "a") as b
  union all
  select "b" as a, array("c1", "b") as b
  union all
  select "c" as a, array("c1", "c") as b
  union all
  select "d" as a, array("c1", "d") as b
)
select a, last_value(b) over (partition by 1 order by a rows unbounded preceding )
from tmp;

-- OK
with tmp as (
  select "a" as a, `map`("c1", "a") as b
  union all
  select "b" as a, `map`("c1", "b") as b
  union all
  select "c" as a, `map`("c1", "c") as b
  union all
  select "d" as a, `map`("c1", "d") as b
)
select a, collect_list(b) over (partition by 1 order by a rows unbounded preceding )
from tmp;

-- ERROR
with tmp as (
  select "a" as a, `map`("c1", "a") as b
  union all
  select "b" as a, `map`("c1", "b") as b
  union all
  select "c" as a, `map`("c1", "c") as b
  union all
  select "d" as a, `map`("c1", "d") as b
)
select a, first_value(b) over (partition by 1 order by a rows unbounded preceding )
from tmp;

-- 
with tmp as (
  select "a" as a, "a" as b
  union all
  select "b" as a, "b" as b
  union all
  select "c" as a, "c" as b
  union all
  select "d" as a, "d" as b
)
select a, first_value(b) over (partition by 1 order by a rows unbounded preceding )
from tmp;{code}
 

 

> Hive2.1.1 throws exception when use window function with complex type: java.lang.ClassCastException: org.apache.hadoop.hive.serde2.lazybinary.LazyBinary* 
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-25908
>                 URL: https://issues.apache.org/jira/browse/HIVE-25908
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 2.1.1
>         Environment: Hive 2.1.1-cdh6.3.2
>            Reporter: wu siqiang
>            Priority: Major
>
> when i use window functions like last_value()  with complex type, it throws an execption during doing reducer tasks.
> here are some test cases:
> {code:sql}
> with tmp as (
>   select "a" as a, map(1, "a") as b
>   union all
>   select "b" as a, map(2, "b") as b
>   union all
>   select "c" as a, map(3, "c") as b
>   union all
>   select "d" as a, map(4, "d") as b
> )
> select a, last_value(b) over (partition by 1 order by a rows unbounded preceding )
> from tmp;
> -- ERROR:
> with tmp as (
>   select "a" as a, named_struct("c1", "a") as b
>   union all
>   select "b" as a, named_struct("c1", "b") as b
>   union all
>   select "c" as a, named_struct("c1", "c") as b
>   union all
>   select "d" as a, named_struct("c1", "d") as b
> )
> select a, last_value(b) over (partition by 1 order by a rows unbounded preceding )
> from tmp;
> -- ERROR:
> with tmp as (
>   select "a" as a, array("c1", "a") as b
>   union all
>   select "b" as a, array("c1", "b") as b
>   union all
>   select "c" as a, array("c1", "c") as b
>   union all
>   select "d" as a, array("c1", "d") as b
> )
> select a, last_value(b) over (partition by 1 order by a rows unbounded preceding )
> from tmp;
> -- OK
> with tmp as (
>   select "a" as a, `map`("c1", "a") as b
>   union all
>   select "b" as a, `map`("c1", "b") as b
>   union all
>   select "c" as a, `map`("c1", "c") as b
>   union all
>   select "d" as a, `map`("c1", "d") as b
> )
> select a, collect_list(b) over (partition by 1 order by a rows unbounded preceding )
> from tmp;
> -- ERROR
> with tmp as (
>   select "a" as a, `map`("c1", "a") as b
>   union all
>   select "b" as a, `map`("c1", "b") as b
>   union all
>   select "c" as a, `map`("c1", "c") as b
>   union all
>   select "d" as a, `map`("c1", "d") as b
> )
> select a, first_value(b) over (partition by 1 order by a rows unbounded preceding )
> from tmp;
> -- 
> with tmp as (
>   select "a" as a, "a" as b
>   union all
>   select "b" as a, "b" as b
>   union all
>   select "c" as a, "c" as b
>   union all
>   select "d" as a, "d" as b
> )
> select a, first_value(b) over (partition by 1 order by a rows unbounded preceding )
> from tmp;{code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)