跳到正文
W Winse Blog
bigdata 1 min read

# Set

Set<BlockedInfo> diffs = new HashSet<>();
diffs.addAll(oldBlockedList);
diffs.addAll(newBlockedList);
Iterator<BlockedInfo> iterator = diffs.iterator();
while (iterator.hasNext()) {
	BlockedInfo i = iterator.next();
	if (oldBlockedList.contains(i) && newBlockedList.contains(i)) {
		iterator.remove();
	}
}

第二段代码希望找出前后两个list的差别,即XOR的效果。但是。。。为什么呢?想一想。

用guava库一行代码搞定:

Sets.difference(Sets.union(oldBlockedList, newBlockedList), Sets.intersection(oldBlockedList, newBlockedList))

# hive建表

由于fs.defaultFS和hive.metastore.warehouse.dir对不上,建表后不能删除。

<property>
        <name>fs.defaultFS</name>
        <value>hdfs://zfcluster</value>
</property>
<property>
  <name>hive.metastore.warehouse.dir</name>
  <value>hdfs://zfcluster:8020/hive/warehousedir</value>
</property>

删除表报错:

hive> drop table es_t_house_monitor2;
FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. MetaException(message:java.lang.IllegalArgumentException: Wrong FS: hdfs://zfcluster:8020/hive/warehousedir/es_t_house_monitor2, expected: hdfs://zfcluster)

建错了,只能先改!然后把hive.metastore.warehouse.dir和fs.defaultFS调成一致。

修改hive持久化(数据库)的表sds,找到location是该路径的改掉。然后就可以drop表了。

# nginx rewrite中大括号

由于大括号用于一段规则的结束开始,所以直接在rewrite写 {} 是报错的。需要把包括{}大括号的规则用双引号括起来。

注: 对花括号( { 和 } )来说, 他们既能用在重定向的正则表达式里,也是用在配置文件里分割代码块, 为了避免冲突, 正则表达式里带花括号的话,应该用双引号(或者单引号)包围。

–END

在 GitHub 上讨论

欢迎通过 GitHub Issue 留言或反馈。每条讨论都会关联到对应文章的源文件路径。

2016-01-19-hole.md

Related posts