我在这个查询中做错了什么,每当我尝试执行它时,我总是得到错误。
SELECT
t1.buyer_id,
t1.item_id,
t1.created_time,
t2.product_id,
t2.timestamps
FROM
TestingTable1 t1
JOIN
(
SELECT
user_id,
prod_and_ts.product_id as product_id,
prod_and_ts.timestamps as timestamps
FROM
TestingTable2
LATERAL VIEW explode(purchased_item) exploded_table as prod_and_ts
) t2
ON(t1.buyer_id = t2.user_id)
WHERE
(t1.item_id <> t2.product_id)
OR (unix_timestamp(t1.created_time) <> t2.timestamps);
这是我得到的错误-
FAILED: Error in semantic analysis: line 13:6 Invalid Table Alias or
Column Reference prod_and_ts
发布于 2012-07-11 12:59:53
我不确定,但侧视图语法
LATERAL VIEW udtf(expression) tableAlias AS columnAlias (',' columnAlias)*
在你的例子中,prod_and_ts是一个columnAlias,而不是tableAlias,而且你不能使用prod_and_ts.product_id。取而代之的是尝试只使用prod_and_ts。
https://stackoverflow.com/questions/11425364
复制相似问题