Impala DROP View Statement – Dropping a View using Hue
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.
Stay updated with latest technology trends
Join DataFlair on Telegram!!
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.
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.
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
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.
-- 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.
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.