当我们创建没有位置属性的配置单元外部 table 时,数据将存储在哪里

where data will be stored when we create hive external table without location properties

我创建了没有任何位置的外部 table。现在,即使我们删除 table.

,数据也将存储在哪里
CREATE EXTERNAL TABLE forest(
  animal string,
  food string)

当您创建没有位置的外部 table 时,数据将存储在配置单元的默认位置。 通常 /apps/hive/warehouse/<database_name>.db/<table_name>.

如果您在测试数据库中创建 table,您的配置单元位置将为

/apps/hive/warehouse/test.db/forest

如果你放下 table ,你可以在这个位置找到数据。 使用命令 show create table forest;,如果您还没有删除它,它将为您提供位置的详细信息。

如果您没有为外部指定位置table,它将存储在默认的配置单元仓库位置。

参见下面的示例。

hive> USE ramesh;
OK
Time taken: 0.013 seconds
hive> CREATE EXTERNAL TABLE test 
    >  (col1 BIGINT, col2 STRING)
    > ROW FORMAT DELIMITED 
    > FIELDS TERMINATED BY ','
    > STORED AS TEXTFILE;
OK
Time taken: 0.056 seconds
hive> SHOW CREATE TABLE test;
OK
CREATE EXTERNAL TABLE `test`(
  `col1` bigint, 
  `col2` string)
ROW FORMAT SERDE 
  'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe' 
WITH SERDEPROPERTIES ( 
  'field.delim'=',', 
  'serialization.format'=',') 
STORED AS INPUTFORMAT 
  'org.apache.hadoop.mapred.TextInputFormat' 
OUTPUTFORMAT 
  'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
**LOCATION
  'hdfs://quickstart.cloudera:8020/user/hive/warehouse/ramesh.db/test'**
TBLPROPERTIES (
  'COLUMN_STATS_ACCURATE'='false', 
  'numFiles'='0', 
  'numRows'='-1', 
  'rawDataSize'='-1', 
  'totalSize'='0', 
  'transient_lastDdlTime'='1510257748')
Time taken: 0.044 seconds, Fetched: 21 row(s)