赞
踩
- CREATE [EXTERNAL] TABLE <table_name>
- (<col_name> <data_type> [, <col_name> <data_type> ...])]
- [PARTITIONED BY ...]
- CLUSTERED BY (<col_name>)
- [SORTED BY (<col_name> [ASC|DESC] [, <col_name> [ASC|DESC]...])]
- INTO <num_buckets> BUCKETS
- [ROW FORMAT <row_format>]
- [STORED AS TEXTFILE|ORC|CSVFILE]
- [LOCATION '<file_path>']
- [TBLPROPERTIES ('<property_name>'='<property_value>', ...)];
具体示例
分桶关键字CLUSTERED BY (<col_name>)
只能指定一个列名,会根据指定的列名的hash进行分桶
- create table users(id int,name string) clustered by (<id>) into 3 buckets
- row format delimited
- fields terminated by '\t'
- lines terminated by '\n'
- stored as textfile;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。