hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frédéric ESCANDELL (JIRA) <j...@apache.org>
Subject [jira] [Updated] (HIVE-19756) Insert request with UNION ALL and lateral view explode
Date Fri, 01 Jun 2018 05:58:00 GMT

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

Frédéric ESCANDELL updated HIVE-19756:
--------------------------------------
    Description: 
Hi,

While executing this code snippet, no data was inserted in the final table t3.

By replacing UNION ALL by UNION or removing the "lateral view explode" the code works properly.

 
{code:sql}
DROP table t1;
DROP table t2;
DROP table t3;


CREATE TABLE t1(cle string,valeur array<struct<v:string>>)
    ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
    STORED AS 
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';

INSERT INTO table t1 select * from (select "a",array(named_struct('v','x'), named_struct('v','y')))
tmp;

 CREATE TABLE t2(cle string,valeur array<struct<v:string>>)
    ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
    STORED AS 
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';

INSERT INTO table t2 select * from (select "b",array(named_struct('v','z'), named_struct('v','w')))
tmp;

DROP view v1;
DROP table t3;

CREATE VIEW v1 (cle,valeur) 
AS
select base.cle,val.v from (select cle,valeur from t1) as base
lateral view explode(base.valeur) a as val
union all
select base1.cle,val.v from (select cle,valeur from t2) as base1
lateral view explode(base1.valeur) a as val;

 CREATE TABLE t3(cle string,valeur string)
    ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
    STORED AS 
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';

insert into t3 
select * from v1;
{code}

  was:
Hi,

While executing this code snippet, no data is inserted in the final table t3.

By replacing UNION ALL by UNION or the "lateral view explode" the code works properly.

 
{code:sql}
DROP table t1;
DROP table t2;
DROP table t3;


CREATE TABLE t1(cle string,valeur array<struct<v:string>>)
    ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
    STORED AS 
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';

INSERT INTO table t1 select * from (select "a",array(named_struct('v','x'), named_struct('v','y')))
tmp;

 CREATE TABLE t2(cle string,valeur array<struct<v:string>>)
    ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
    STORED AS 
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';

INSERT INTO table t2 select * from (select "b",array(named_struct('v','z'), named_struct('v','w')))
tmp;

DROP view v1;
DROP table t3;

CREATE VIEW v1 (cle,valeur) 
AS
select base.cle,val.v from (select cle,valeur from t1) as base
lateral view explode(base.valeur) a as val
union all
select base1.cle,val.v from (select cle,valeur from t2) as base1
lateral view explode(base1.valeur) a as val;

 CREATE TABLE t3(cle string,valeur string)
    ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
    STORED AS 
      INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
      OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';

insert into t3 
select * from v1;
{code}


> Insert request with UNION ALL and lateral view explode
> ------------------------------------------------------
>
>                 Key: HIVE-19756
>                 URL: https://issues.apache.org/jira/browse/HIVE-19756
>             Project: Hive
>          Issue Type: Bug
>         Environment: HDP 2.6.4
>            Reporter: Frédéric ESCANDELL
>            Priority: Major
>
> Hi,
> While executing this code snippet, no data was inserted in the final table t3.
> By replacing UNION ALL by UNION or removing the "lateral view explode" the code works
properly.
>  
> {code:sql}
> DROP table t1;
> DROP table t2;
> DROP table t3;
> CREATE TABLE t1(cle string,valeur array<struct<v:string>>)
>     ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
>     STORED AS 
>       INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
>       OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
> INSERT INTO table t1 select * from (select "a",array(named_struct('v','x'), named_struct('v','y')))
tmp;
>  CREATE TABLE t2(cle string,valeur array<struct<v:string>>)
>     ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
>     STORED AS 
>       INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
>       OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
> INSERT INTO table t2 select * from (select "b",array(named_struct('v','z'), named_struct('v','w')))
tmp;
> DROP view v1;
> DROP table t3;
> CREATE VIEW v1 (cle,valeur) 
> AS
> select base.cle,val.v from (select cle,valeur from t1) as base
> lateral view explode(base.valeur) a as val
> union all
> select base1.cle,val.v from (select cle,valeur from t2) as base1
> lateral view explode(base1.valeur) a as val;
>  CREATE TABLE t3(cle string,valeur string)
>     ROW FORMAT SERDE  'org.apache.hadoop.hive.ql.io.orc.OrcSerde'
>     STORED AS 
>       INPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcInputFormat'
>       OUTPUTFORMAT 'org.apache.hadoop.hive.ql.io.orc.OrcOutputFormat';
> insert into t3 
> select * from v1;
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message