分享

求mr读取parquet的例子

louiscool2 发表于 2015-11-23 10:04:00 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 4 19889
按照
http://blog.cloudera.com/blog/2014/03/how-to-use-parquet-with-impala-hive-pig-mapreduce/   里的例子貌似有问题,出来的是所有的的key:value数据。
比如有parquet源表里有字段a和b,这个例子最后出来的是
a:1
b:2
如果
     public void map(LongWritable key, Group value, Context context) throws IOException, InterruptedException {
          NullWritable outKey = NullWritable.get();
          String outputRecord = "";
          // Get the schema and field values of the record
          String inputRecord = value.toString();
          // Process the value, create an output record
          // ...
          context.write(outKey, new Text(outputRecord));
      }

已有(4)人评论

跳转到指定楼层
s060403072 发表于 2015-11-23 12:45:05
这个比较复杂些。里面跟咱们普通的不太一样,可能因为其它包了,楼主认为应该怎么输出
回复

使用道具 举报

bioger_hit 发表于 2015-11-23 15:54:56
这样应该没问题,应该是组合group
回复

使用道具 举报

louiscool2 发表于 2015-11-25 20:21:17
我想得到的数据不是
"a:1
b:2"
而是1,2
回复

使用道具 举报

heierya 发表于 2017-6-16 18:21:54
楼主会读了么?求教。
最近项目要用到
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条