When you login to Hive shell, by default you will be in default database. Whatever you created in default database will be created in the folder ‘/user/hive/warehouse’ directly.
Open terminal and execute the command hive.
[cloudera@quickstart conf]$ hive
Logging initialized using configuration in file:/etc/hive/conf.dist/hive-log4j.properties
WARNING: Hive CLI is deprecated and migration to Beeline is recommended.
Execute the command ‘SHOW DATABASE’ to print all the databases in Hive.
hive> SHOW DATABASES; OK default demo_db1 demo_db2 Time taken: 0.384 seconds, Fetched: 3 row(s)
Execute below statement to print the database that you are in.
set hive.cli.print.current.db=true
hive> set hive.cli.print.current.db=true; hive (default)>
Let’s create employee table in the default database.
create table employee(id int, name string);
hive (default)> create table employee(id int, name string); OK Time taken: 0.105 seconds hive (default)> ; hive (default)> ; hive (default)> SHOW TABLES; OK employee Time taken: 0.009 seconds, Fetched: 1 row(s)
Let’s query the folder ‘/user/hive/warehouse’ and confirm whether employee table is created or not.
[cloudera@quickstart ~]$ hadoop fs -ls /user/hive/warehouse
Found 1 items
drwxrwxrwx - cloudera supergroup 0 2022-04-11 23:34 /user/hive/warehouse/employee
Previous Next Home
No comments:
Post a Comment