Sql 在配置单元的位置字段中显式指定之前,不会创建数据库目录
我使用下面的查询创建了一个具有首选位置(/user/hive/)的数据库Sql 在配置单元的位置字段中显式指定之前,不会创建数据库目录,sql,hadoop,hive,Sql,Hadoop,Hive,我使用下面的查询创建了一个具有首选位置(/user/hive/)的数据库 create database test location "/user/hive/"; create database test2; 创建数据库后,我使用命令hadoop dfs-ls/user/hive在位置/user/hive/中检查test.db目录。没有 后来,我使用下面的查询创建了另一个具有默认位置的数据库 create database test location "/user/hive/"; crea
create database test
location "/user/hive/";
create database test2;
创建数据库后,我使用命令hadoop dfs-ls/user/hive
在位置/user/hive/
中检查test.db
目录。没有
后来,我使用下面的查询创建了另一个具有默认位置的数据库
create database test
location "/user/hive/";
create database test2;
对于数据库test2,我可以看到默认仓库目录下的test2.db
目录/user/hive/warehouse/
/user/hive/test.db
目录是在我在如下位置字段中明确指定的时候创建的
create database test
location "/user/hive/test.db";
因为我是新来的蜂巢,请任何人解释一下
为什么在我的第一次查询中将位置字段指定为/user/hive/
,而创建了test.db
目录力
指定位置字段时,配置单元将如何工作
注意:
我正在使用cloudera快速入门虚拟机
蜂巢版本:蜂巢1.1.0-cdh5.13.0这是蜂巢的预期行为
create database test location "/user/hive/";
执行上述语句意味着您正在指向/user/hive目录创建测试数据库,这就是hive没有创建测试目录的原因
我们还需要明确提到目录名,我们需要将数据库指向配置单元中的哪个位置,即createdatabasetestlocation”/user/hive/test.db”代码>然后只有配置单元创建指向test.db目录的test db
如果创建数据库test2代码>语句表示我们正在创建数据库,但没有指定位置,因此此目录是在默认配置单元仓库位置下创建的,名称与db name相同