atwanli

1、创建外表

语法

create_table \'<my_table>\', \':key:string, f:<cq1>:<datatype1>, ...\', \'[{<PROPERTY> => <value>, ...}]\'

\':key:string, f:<cq1>:<datatype1>, …​\' 定义表 <my_table> 的schema,f:<cq1> 为第一列的列名,<datatype1> 为 f:<cq1> 列的数据类型。{<PROPERTY> ⇒ <value>, …​} 用于指定一些可选参数,和建HBase表的指令create相比,create_table 的第二个参数用于定义表的schema(而 create 的第二个参数用于指定列族),其他参数(例如SPLITS)和 create 相同,用法也相同。

create_table \'htable\', \':key:string, f:c1:int, f:c2:double, f:c3:varchar(10), f:c4:boolean, f:c5:binary, f:c6:tinyint, f:c7:smallint, f:c8:bigint,
f:c9:date, f:c10:timestamp, f:c11:float, f:c12:decimal(5,22), f:c13:struct<string, int,varchar(10), decimal(9,33), boolean, float, double, bigint, tinyint, smallint, date, timestamp>\'

 

2、导出到hdfs,可以指定列分隔符:

INSERT OVERWRITE local DIRECTORY\'/tmp/out/htable\'

ROW FORMAT DELIMITED FIELDS TERMINATED BY \',\'

select * from htable ;

3、hdfs文件下载

hadoop fs -get /tmp/out/htable/* /tmp

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-12-14
  • 2022-01-31
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-07-29
相关资源
相似解决方案