There’s a functionality in Apache Hive that allows you to take the table offline. We won’t be able to query the table because of it. In other words, by offlining a table, we can restrict it from being queried. This, however, does not prevent another table from accessing the same data.
Let’s look at how to change a table in Hive to prevent it from being queried in practice:
Syntax:
ALTER TABLE <tablename> ENABLE OFFLINE;
Example:
Hive> ALTER TABLE emp ENABLE OFFLINE;
Now, let’s issue the SELECT statement.
Hive> SELECT * FROM emp;
Now, this returns the error as we expected.
FAILED: SemanticException [Error 10113]: Query against an offline table or partition Table emp
Bringing back the table to ONLINE.
Hive> ALTER TABLE emp DISABLE OFFLINE;
Hope you find this article helpful.
Please subscribe for more interesting updates.
One comment