Impala DROP View Statement – Dropping a View using Hue

Boost your career with Free Big Data Courses!!

In our last Impala Tutorial, we studied Impala create view statements. While we need to remove an Impala View, we use Impala DROP View Statement. However, there is much more to know about  Impala DROP View  Statement.

So, in this article, we will learn all about Impala DROP View  Statement in depth. Also, we will cover its syntax, usage as well as the example to understand well.

So, let’s start Impala Drop View Statements.

How to use Impala DROP View Statement?

Basically, the view which was originally created by the CREATE VIEW statement, we use Impala DROP View Statement to remove that specified view. However, DROP VIEW only involves changes to metadata in the Metastore database, not any data files in HDFS.

In other words, to delete an existing view we use the Drop View query of Impala. Also, we can ensure that no physical data will be affected by the drop view query because a view is a logical construct.

a. Syntax

So, the syntax for using Impala DROP View Statement is-

DROP VIEW [database_name.]view_name

b. Statement type

Impala DROP View Statement is of DDL Type.

c. Cancellation

It is not possible to cancel it. That implies it Cannot be canceled.

d. HDFS permissions

Here, we do not need any HDFS permissions, because, this statement does not touch any HDFS files or directories.

Examples of Drop View Statements in Impala

Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!

Let us understand it with an example. Here it creates a series of views and then drops them. So, how views are associated with a particular database, these examples will illustrate well.

Also, make sure both the view definitions and the view names for CREATE VIEW and DROP VIEW can refer to a view in the current database or a fully qualified view name.

For Example,

-- Create and drop a view in the current database.
CREATE VIEW few_rows_from_t1 AS SELECT * FROM t1 LIMIT 10;
DROP VIEW few_rows_from_t1;
-- Create and drop a view referencing a table in a different database.
CREATE VIEW table_from_other_db AS SELECT x FROM db1.foo WHERE x IS NOT NULL;
DROP VIEW table_from_other_db;
USE db1;
-- Create a view in a different database.
CREATE VIEW db2.v1 AS SELECT * FROM db2.foo;
-- Switch to the other database and drop the view.
USE db2;
DROP VIEW v1;
USE db1;
-- Create a view in a different database.
CREATE VIEW db2.v1 AS SELECT * FROM db2.foo;
-- Drop a view in the other database.
DROP VIEW db2.v1;

Dropping a View Using Hue

There are several steps we can follow, in order to drop a view using hue browser, such as;

  • At first, select the context as my_db, and type the Drop view statement in Impala Query editor. Then click on the execute button.
  • Further, on scrolling down just after executing the query we can see a list named TABLES. Basically, that list contains all the tables and views in the current database. Hence, we can find that the specified view was deleted from this list.

So, this was all about Impala Drop View Statements. Hope you like our explanation.

Conclusion

As a result, we have seen the whole concept of Impala DROP View  Statement. Still, if any doubt occurs in how to DROP View in Impala, feel free to ask in the comment section.

Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

follow dataflair on YouTube

Leave a Reply

Your email address will not be published. Required fields are marked *