我必须将我的pl/sql数据翻译成hive,主要格式如下。NVL(SELECT FROM (SELECT)),(SELECT FROM (SELECT)) AS EXPI_DATE
。
我的原始数据是这样的:
NVL(
(SELECT MIN(DATE_TIME)AS EF_DATE
FROM (SELECT C,
S,
DATE_TIME FROM(SELECT C,
S,
DATE_TIME,
CASE
WHEN lead over ( order by ) IS NULL
THEN 'Y'
ELSE 'N'
END AS flag
FROM table_1
)aihiscur
WHERE flag = 'Y') Z
AND Z.DATE_TIME > A.DATE_TIME
),
(SELECT
MIN(DATE_TIME)AS EF_DATE
FROM (SELECT C,
S,
DATE_TIME
FROM (SELECT C,
S,
DATE_TIME,
CASE
WHEN lead over ( order by ) IS NULL
THEN 'Y'
ELSE 'N'
END AS flag
FROM table_2
)aicuri
WHERE flag = 'Y') Z
WHERE CU_CODE = A.cR_CODE
AND Z.DATE_TIME > A.DATE_TIME
)aicurin
) AS EXPI_DATE
我的问题是。
既然hive禁止使用nvl(),(),有什么有效的方法可以做到这一点?
所有的帮助和想法将被感激!
1条答案
按热度按时间1sbrub3j1#
在这种情况下,"COALESCE "对你有用吗?