create table hive_local_table(c1 int, c2 string, c3 int, c4 string);insert into hive_local_table values(1001, 'c2', 99, 'c4'),(1002, 'c2', 100, 'c4'),(1003, 'c2', 101, 'c4'),(1004, 'c2', 100, 'c4'),(1005, 'c2', 101, 'c4')
create table hive_cos_table(c1 int, c2 string, c3 int, c4 string)row format delimited fields terminated by ','LINES TERMINATED BY '\\n'stored as textfile location 'cosn://{bucket_name}/{dir_name}';
insert into hive_cos_table select * from hive_local_table;
CREATE READABLE EXTERNAL TABLE snova_cos_table (c1 int, c2 varchar(32), c3 int, c4 varchar(32))LOCATION('cos:// {BUCKET}-{APPID}.cos.{REGION}.myqcloud.com/{PREFIX} secretKey=**** secretId=***')FORMAT 'csv';
create table snova_local_table(c1 int, c2 text, c3 int, c4 text);insert into snova_local_table select * from snova_cos_table;
Was this page helpful?