UPDATE Statement in Apache Impala

In OLTP databases, UPDATE is one of the most commonly used DML commands. When it comes to OLAP databases, however, UPDATE is used less frequently. Apache Hive is mostly used as an OLAP database. Despite the fact that Apache Impala is a massively parallel processing SQL query engine for data stored in an Apache Hadoop computer cluster, it still uses Apache Hive’s OLAP databases.

Updates an arbitrary number of rows in a Kudu table. This statement only works for Impala tables that use the Kudu storage engine. And, UPDATE command is available in Impala 2.8 or higher only.

Syntaxes/Examples:

— The below command helps in updating the column value for all the rows.
UPDATE tbEmployee SET isActive = ‘True’;

— Update only the rows that match the condition.
UPDATE tbEmployee SET salary = 3000 WHERE salary < 3000 AND DeptNo = 10;

— Does not update any rows, because the WHERE condition is always false.
UPDATE tbEmployee SET salary = 20000 WHERE 1 = 0;

— Change the values of multiple columns in a single UPDATE statement.
UPDATE tbEmployee SET lastName = ‘Simpsons’, salary = 3000, DeptNo = 10 WHERE EmpID =100;

Hope you find this article helpful.

One comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s