“Is Distinct From” Operator Apache Impala

Impala is a SQL database engine that uses MPP (Massive Parallel Processing) to process large amounts of data contained in a Hadoop cluster. It’s a free, open-source program written in C++ and Java. It outperforms other Hadoop SQL engines in terms of speed and latency.

Almost all the functions, operators and clauses of SQL can be used in Impala. In addition, there are a few new functions and alternatives to some of the regular SQL expressions available in Apache Impala.

IS DISTINCT FROM is an operator that is available in Impala which is equal to “<>” or “!=”.

Let’s see how to use it.

SELECT 1<>0:
The same can be written as below.
SELECT 1!=0;
or
SELECT 1 IS DISTINCT FROM 0;
All three of the above will return “TRUE” since 1 is not equal to 0.

SELECT * FROM datetest;
+——————————-+——————————-+
| date1                           | date2                           |
+——————————-+——————————-+
| 2021-01-23 19:14:20 | 2020-11-23 15:14:11 |
+——————————-+——————————-+

SELECT date1 IS DISTINCT FROM date2 FROM datetest;

IsDistinctFrom

Hope you find this article helpful.

Stay in touch for more interesting updates.

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