Created on 06-04-2017 06:43 AM - edited 09-16-2022 04:42 AM
Hi Hive Users,
I have created a Hive database by overrrinding the defailt path as follows,
SQL:
Create database diff location '/user/cloudera/sat';
After creating this databse, I tried to access this path to see wether it's created a .db folder , but I don't see anything with this name there. Even I created a table in this database and I only see the new folder with name as test.
Not sure why its not crated diff.db folder in this path. Please refer the attached screen shots for more details. Please let me know if i am missing anything here.
Created on 06-12-2017 02:14 AM - edited 06-12-2017 03:15 AM
>> why don't it it creates folder with <dbname>.db folder when you pass the location to create a database(overriding the default path) ?
Because that is how hive works when you provide the path.
When you specify the path it uses this path. It's not adding a sub folder to the path you have provided.
It assumes you have provided the path you want to use exactly.
Created 06-09-2017 03:28 AM
Hi,
Could anyone please let me know on this? Thanks.
Created on 06-09-2017 07:47 AM - edited 06-09-2017 07:48 AM
Why do you expect to see a *.db folder if you don't specify it yourself ? This is not "how it works".
The following command sets the root dir of the database "diff" to "/user/cloudera/sat" :
Create database diff location '/user/cloudera/sat';
This will not create a folder "diff.db" inside "sat".
If this is what you want then use the following command :
Create database diff location '/user/cloudera/sat/diff.db';
Created 06-09-2017 03:00 PM
When I create a database without passing the location, then it will create that database in default location with <dbname>/db
ex:
hive> CREATE DATABASE Override1; OK Time taken: 0.06 seconds
it will create a Override1.db folder in the default path as
[cloudera@quickstart ~]$ hadoop fs -ls /user/hive/warehouse Found 1item drwxrwxrwx - cloudera supergroup 0 2017-06-09 14:46 /user/hive/warehouse/override1.db [cloudera@quickstart ~]$
why don't it it creates folder with <dbname>.db folder when you pass the location to create a database(overriding the default path) ?
Created on 06-12-2017 02:14 AM - edited 06-12-2017 03:15 AM
>> why don't it it creates folder with <dbname>.db folder when you pass the location to create a database(overriding the default path) ?
Because that is how hive works when you provide the path.
When you specify the path it uses this path. It's not adding a sub folder to the path you have provided.
It assumes you have provided the path you want to use exactly.