I'm trying to update a Hive table from subquery and I know hive doesn't support such updates. Is there any work-around for this?
My update looks like this
UPDATE tmp_aka
SET guid = (SELECT mguid FROM tmp_maxs
WHERE tmp_maxs.guid = tmp_aka.guid);
Hive supports subqueries in FROM clauses and in WHERE clauses of SQL statements. A subquery is a SQL expression that is evaluated and returns a result set. Then that result set is used to evaluate the parent query. The parent query is the outer query that contains the child subquery.
You can create a new table and drop the old one thereafter as updating tables isn't possible unless the table has transactional properties set.
A Hive WITH Clause can be added before a SELECT statement of you query, to define aliases for complex and complicated expressions that are referenced multiple times within the body of the SELECT statements.
May be you can create a table for your select statement result and insert a new value with insert into table select values from newly created table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With