建表

  1. CREATE EXTERNAL TABLE `renren_bak`(
  2. `data` STRING
  3. )
  4. PARTITIONED BY (dt STRING)
  5. ROW FORMAT
  6. DELIMITED FIELDS TERMINATED BY '\u0001'
  7. LINES TERMINATED BY '\n'
  8. STORED AS TEXTFILE
  9. LOCATION '/data/renren/bak';

添加分区

  1. alter table renren_bak add IF NOT EXISTS partition (dt='2019-04-27') location '/data/renren/bak/2019-04-27';

模糊查询

  1. select count(*) from bigdata.renren_bak where dt ='2019-04-27' and instr(data, '这辆车已经卖掉') >0;

27 12

文档更新时间: 2019-06-26 18:53