Support Questions
Find answers, ask questions, and share your expertise

Lateral view fails after HDP 3.1.4 upgrade.

Lateral view fails after HDP 3.1.4 upgrade.

Expert Contributor

Hello,

I upgraded from HDP 3.1.0 to 3.1.4. it went relatively well, except for a few queries with lateral views. An example would be:

 

with j as (
    select 1 as d, '{"relatienummer": 42, "notrelevant": 1}' as rn
    union  all
    select 2, null
    union all
    select 3, '{"notrelevant": 1}' as rn
    union all 
    select 4, '{"relatienummer": 42, "notrelevant": 1}' as rn
)
select
    d
from  j
lateral view json_tuple(rn, 'relatienummer') cv as `relatienummer`

 

But this example is a bit small and actually works. The same type of query based on a few joined orc  tables fails.

 

The query actually succeeds according to hive, but returns 0 rows. If I remove the `lateral view` (`outer` or not) I got all the rows, If I add the lateral view (even if I do not use it in the select part) I have 0 rows.

 

There is nothing in the logs, and the query worked perfectly before the upgrade.

If instead of using a CTE (or a subquery) I were to make a temporary table, and then use this temporary table, then the lateral view would work.

 

Any idea what could happen and how to fix this?