使用UNION ALL的HIVE CTE正在抛出表未找到的异常

时间:2017-09-25 15:47:17

标签: hive

我的意图是只使用CTE加载表一次并重用CTE表,以避免在Hive中加载多个表和阶段。 但是,当通过cloudera 5.11版本运行时,下面的hive查询正在运行hue并抛出table cases not found异常。 查询使用中的任何错误?

WITH cases
AS (
    SELECT nbr
        ,id
        ,date_l2
        ,date_l3
        ,date_l4
        ,date_l5
        ,level_2
        ,level_3
        ,level_4
        ,level_5
    FROM volume
    )
SELECT nbr
    ,id
    ,CONCAT (
        nbr
        ,'-L2'
        ) AS enbr
    ,'L2' AS level_nm
    ,date_l2 AS dt
FROM cases
WHERE level_2 = true

UNION ALL

SELECT nbr
    ,id
    ,CONCAT (
        nbr
        ,'-L3'
        ) AS enbr
    ,'L3' AS level_nm
    ,date_l3 AS dt
FROM cases
WHERE level_3 = true

UNION ALL

SELECT nbr
    ,id
    ,CONCAT (
        nbr
        ,'-L4'
        ) AS enbr
    ,'L4' AS level_nm
    ,date_l4 AS dt
FROM cases
WHERE level_4 = true

UNION ALL

SELECT nbr
    ,id
    ,CONCAT (
        nbr
        ,'-L5'
        ) AS enbr
    ,'L5' AS level_nm
    ,date_l5 AS dt
FROM cases
WHERE level_5 = true

输出: nbr id enbr level_nm dt 00193092 84575 00193092-L2 L2 2016-10-19 00193092 84575 00193092-L3 L3 2016-10-20 00193092 84575 00193092-L4 L4 2016-10-20

1 个答案:

答案 0 :(得分:0)

import {DrawerItems, DrawerNavigation} from 'react-navigation';
export default DrawerNavigator({
// ... your screens
}, {
// define customComponent here
contentComponent: (props) =>
<View style={{flex: 1}}>
<Text>Header</Text>
<ScrollView>
<DrawerItems {...props} />
</ScrollView>
</View>
});