Uniendo dos tablas en Hive usando HiveQL (Hadoop) [duplicado]

Posible duplicado:
Consulta SQL SQL con tabla

CREATE EXTERNAL TABLE IF NOT EXISTS TestingTable1   (This is the MAIN table through which comparisons need to be made)
(
BUYER_ID BIGINT,
ITEM_ID BIGINT,
CREATED_TIME STRING
)

Y estos son los datos de la primera tabla anterior.

**BUYER_ID**  |  **ITEM_ID**     |      **CREATED_TIME**   
--------------+------------------+-------------------------
 1015826235      220003038067       *2001-11-03 19:40:21*
 1015826235      300003861266        2001-11-08 18:19:59
 1015826235      140002997245        2003-08-22 09:23:17
 1015826235     *210002448035*       2001-11-11 22:21:11

Esta es la segunda tabla de Hive. También contiene información sobre los artículos que estamos comprando.

CREATE EXTERNAL TABLE IF NOT EXISTS TestingTable2
(
USER_ID BIGINT,
PURCHASED_ITEM ARRAY<STRUCT<PRODUCT_ID: BIGINT,TIMESTAMPS:STRING>>
)

Y estos son los datos en la segunda tabla anterior (TestingTable2) -

**USER_ID**    **PURCHASED_ITEM**
1015826235     [{"product_id":220003038067,"timestamps":"1004941621"},    {"product_id":300003861266,"timestamps":"1005268799"},    {"product_id":140002997245,"timestamps":"1061569397"},{"product_id":200002448035,"timestamps":"1005542471"}]

CompararTestingTable2 conTestingTable1 para que se cumpla el siguiente escenario.

Encuentra elPRODUCT_ID YTIMESTAMPS desdeTestingTable2 LO QUE NO SE ENCUENTRA CONITEM_ID YCREATED_TIME de TestingTable1 CORRESPONDIENTE ABUYER_ID(USER_ID) después de comparar deTestingTable1.

Así que si mirasTestingTable2 datos este (ultimo)ITEM_ID 210002448035 desdeTestingTable1 no coincide conTestingTable2 PRODUCT_ID- 200002448035 Datos y de forma similar con las marcas de tiempo. Así que quiero mostrar el siguiente resultado utilizando la consulta HiveQL.

**BUYER_ID**  |  **ITEM_ID**     |      **CREATED_TIME**          |  **PRODUCT_ID**    |     **TIMESTAMPS** 
--------------+------------------+--------------------------------+------------------------+----------------------
1015826235          *210002448035*           2001-11-11 22:21:11            200002448035           1005542471 
1015826235       220003038067           *2001-11-03 19:40:21*           220003038067          1004941621

Puede alguien ayudarme con esto. Como soy nuevo en HiveQL, tengo muchos problemas.

Actualizado:-

He escrito esta consulta, pero no funciona como quería.

select * from 
  (select * from 
     (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)
      prod_and_ts 
      LEFT OUTER JOIN testingtable1 
  ON ( prod_and_ts.user_id = testingtable1.buyer_id AND testingtable1.item_id =    prod_and_ts.product_id
     AND prod_and_ts.timestamps = UNIX_TIMESTAMP (testingtable1.created_time)
  )
  where testingtable1.buyer_id IS NULL) 
  set_a LEFT OUTER JOIN testingtable1 
  ON (set_a.user_id = testingtable1.buyer_id AND  
  ( set_a.product_id = testingtable1.item_id OR set_a.timestamps = UNIX_TIMESTAMP(testingtable1.created_time) )
 );

Una actualización más

Segúnuser1166147 comentarios Escribí mi consulta según su consulta. En colmena supongoINNER JOIN están escritos por simplementeJOIN.

Esta es mi siguiente consulta.

select * from (select t2.buyer_id, t2.item_id, t2.created_time as created_time, subq.user_id, subq.product_id, subq.timestamps as timestamps 
from
(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) subq JOIN testingtable1 t2 on t2.buyer_id = subq.user_id 
AND subq.timestamps = unix_timestamp(t2.created_time)
WHERE (subq.product_id <> t2.item_id)
union all
select t2.buyer_id, t2.item_id as item_id, t2.created_time, subq.user_id, subq.product_id as product_id, subq.timestamps
from 
(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) subq JOIN testingtable1 t2 on t2.buyer_id = subq.user_id 
    and subq.product_id = t2.item_id 
    WHERE (subq.timestamps <> unix_timestamp(t2.created_time))) unionall;

Y después de ejecutar la consulta anterior, obtengo un resultado cero.

Una última actualización: -

Malo, no tenía los datos precisos en las tablas, por lo que esa es la razón por la que no estaba obteniendo el resultado. Sí, está funcionando la consulta anterior anterior.

Respuestas a la pregunta(2)

Su respuesta a la pregunta