Drop Database Unexpected Behaviour

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Drop Database Unexpected Behaviour

anuragknoldus
Hi,

I have created a database in hive and Carbondata then dropped both
databases when I executed *show table* in hive, it gives an exception that
database does not exists but in carbon data it does not give any exception.
*Output in Hive -*

hive> CREATE DATABASE SAMPLE;
OK
hive (default)> use SAMPLE;
OK
hive (SAMPLE)> drop database SAMPLE;
OK
hive (SAMPLE)> use SAMPLE;
FAILED: SemanticException [Error 10072]: Database does not exist: SAMPLE
hive (SAMPLE)> show tables;
FAILED: SemanticException [Error 10072]: Database does not exist: SAMPLE

*Output in Carbondata :*

0: jdbc:hive2://localhost:10000> CREATE DATABASE SAMPLE;
0: jdbc:hive2://localhost:10000> USE SAMPLE;
0: jdbc:hive2://localhost:10000> DROP DATABASE SAMPLE;
0: jdbc:hive2://localhost:10000> USE SAMPLE;
Error: org.apache.spark.sql.execution.QueryExecutionException: FAILED:
SemanticException [Error 10072]: Database does not exist: SAMPLE
(state=,code=0)
0: jdbc:hive2:

0: jdbc:hive2://localhost:10000>show tables;
------------------------
tableName isTemporary

------------------------
------------------------
No rows selected (0.066 seconds)

*Proposed Solution : *

When we looked into the problem we found that it delete all the table and
information from the database and made it empty so that we could see any
record there and we find empty result on console.

We can add a flag with database because if it delete all the record, it
will quite difficult to know that we drop the database or create the
database because in both scenario we don't have any table.

So for the handle this situation we can set flag = 1 when we create a
database or set flag = 0 when we drop the database and return a message or
exception on the console when user run *show table* command.

--
*Thanks&regards*


*Anurag Srivastava**Software Consultant*
*Knoldus Software LLP*

*India - US - Canada*
* Twitter <http://www.twitter.com/anuragknoldus> | FB
<http://www.facebook.com/anuragsrivastava.06> | LinkedIn
<https://in.linkedin.com/pub/anurag-srivastava/5a/b6/441>*