Is a new week, a cup of tea, turn on the computer to see the operation of the cluster, not a program error?
Just be happy for a while, to see a lot of results null data? ?
Another busy morning, after investigation found error '/ user / hive / tm_oil_level' path does not exist
can not ah, this is the path hive external table, even if you delete the external table does not delete the directory, do not delete the directory who secretly , and also unreasonable ah!
New External Table
create external table if not exists tm_oil_level
(
oil_code string,
oil_name string,
oil_type string,
oil_sort string
) COMMENT '机油基础表'
row format delimited fields terminated by '\t' lines terminated by '\n'
location '/user/hive/tm_oil_level'
New internal table
create table if not exists tm_oil_level_test
(
oil_code string,
oil_name string,
oil_type string,
oil_sort string
) COMMENT '机油基础表test'
row format delimited fields terminated by '\t' lines terminated by '\n'
location '/user/hive/tm_oil_level'
Inner and outer tables point to the same address
-- 清空表(直接删除&不进回收站)
truncate table tm_oil_level_test;
-- 删除表(移入回收站)
drop table if exists tm_oil_level_test;
After testing '/ user / hive / tm_oil_level' path has been deleted
recall last Friday meal operate fierce as a tiger, now repentant, and quickly view those tables are deleted by mistake
Summary:
Hive to build an internal table do not specify a path,
Hive to build an external table must specify the path (recommended)