What wrong I am doing with this query, I always get the error whenever I try to execute it.
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);
This is the error I get-
FAILED: Error in semantic analysis: line 13:6 Invalid Table Alias or
Column Reference prod_and_ts
I’m not sure, but Lateral View Syntax
In your case prod_and_ts it’s a columnAlias, not tableAlias and you cannot use prod_and_ts.product_id. Instead try to use just prod_and_ts.