Hadoop 'grep' 示例

标签 hadoop mapreduce

在 Hadoop 'grep' 示例(Hadoop 包附带)中,组参数是什么。你能给我一个例子吗?

最佳答案

免责声明:我还没有运行这个例子,我只是在看了 http://wiki.apache.org/hadoop/Grep 之后才开始回答。

CLI 调用是:bin/hadoop org.apache.hadoop.examples.Grep <indir> <outdir> <regex> [<group>]你想知道 <group> .

我怀疑这是正则表达式中的分组。 (随机链接 - http://www.exampledepot.com/egs/java.util.regex/Group.html)

如 Hadoop Grep 链接所述

The command works different than the Unix grep call: it doesn't display the complete matching line, but only the matching string

我从这里得到的是,如果您指定 <group>值(一个数字)它将只输出该组的值。

举个例子(从群组链接中拉取)

input: aba
regex: (a(b)*)+
group 0: aba
group 1: a
group 2: b

如果值为 <group>1那么结果将是a .第 0 组是完全匹配,而不是原始字符串,在这种情况下它恰好是相同的。

第一个

关于Hadoop 'grep' 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6250784/

相关文章:

hadoop - 查询以仅显示 impala 中的列名

configuration - 如何在 hadoop-evn.sh 中设置内存

java - 在编写mapreduce类时

node.js - HBase:Thrift vs Rest 性能

eclipse - 在 MapReduce 模式下,来自 Jar 文件而非 Eclipse 的 PIG 脚本统计信息始终为零 (0)

hadoop - 检查页面排名收敛

java - Hadoop 找不到映射器类

java - 在 HBase 单元中保存多个版本

python - 使用 Thrift 在 Python 脚本中运行 Hive-Query 时出现 `Connection Refused`

hadoop - 在 postgres 中插入数据时,Reduce 代码随机卡住