我们可以制作一个在hive中同时具有分区和分区的表吗?
答案 0 :(得分:2)
是。
分区是你将数据分成HDFS上的目录数。每个目录都是一个分区。例如,如果您的表定义类似于
CREATE TABLE user_info_bucketed(user_id BIGINT, firstname STRING, lastname STRING)
COMMENT 'A bucketed copy of user_info'
PARTITIONED BY(ds STRING)
CLUSTERED BY(user_id) INTO 256 BUCKETS;
然后你将在hdfs上有目录,如
/user/hive/warehouse/user_info_bucketed/ds=2011-01-11/
/user/hive/warehouse/user_info_bucketed/ds=2011-01-12/
/user/hive/warehouse/user_info_bucketed/ds=2011-01-13/
Bucketing是关于如何在分区内分发数据的,所以你将在hdfs上有文件,如
/user/hive/warehouse/user_info_bucketed/ds=2011-01-11/000000_0
/user/hive/warehouse/user_info_bucketed/ds=2011-01-11/000000_1
...
/user/hive/warehouse/user_info_bucketed/ds=2011-01-11/000000_255
/user/hive/warehouse/user_info_bucketed/ds=2011-01-12/000000_0
/user/hive/warehouse/user_info_bucketed/ds=2011-01-12/000000_1
...
/user/hive/warehouse/user_info_bucketed/ds=2011-01-12/000000_255
参考: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL+BucketedTables http://www.hadooptpoint.com/hive-buckets-optimization-techniques/
答案 1 :(得分:1)
是的。这是直截了当的 尝试以下方法:
var str = "This product price is £15.00 and old price is £19.00";
var r = str.split(" ").filter(function(n) {
if(/£/.test(n)) return n;
});
console.log(r);
在此示例中,我已通过部门创建分区,并通过指定生成 随便这会帮助你
答案 2 :(得分:0)