如何使用hadooppython在超表中插入'n'值?

2024-09-28 22:33:55 发布

您现在位置:Python中文网/ 问答频道 /正文

如何使用hadooppython流媒体在超表中插入多个值?我可以为单个列插入值,但不能插入多个列。在我尝试的时候,我得到了以下例外:

java.lang.RuntimeException: java.io.IOException: Unable to write cell - java.lang.Exception: incorrect output line format only 1 tabs
    at org.apache.hadoop.streaming.PipeMapRed.waitOutputThreads(PipeMapRed.java:325)
    at org.apache.hadoop.streaming.PipeMapRed.mapRedFinished(PipeMapRed.java:545)
    at org.apache.hadoop.streaming.PipeReducer.close(PipeReducer.java:137)
    at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:528)
    at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:419)
    at org.apache.hadoop.mapred.Child$4.run(Child.java:259)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:396)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1059)
    at org.apache.hadoop.mapred.Child.main(Child.java:253)
Caused by: java.io.IOException: Unable to write cell - java.lang.Exception: incorrect output line format only 1 tabs
    at org.hypertable.hadoop.mapred.TextTableOutputFormat$HypertableRecordWriter.write(TextTableOutputFormat.java:247)
    at org.hypertable.hadoop.mapred.TextTableOutputFormat$HypertableRecordWriter.write(TextTableOutputFormat.java:69)
    at org.apache.hadoop.mapred.ReduceTask$OldTrackingRecordWriter.write(ReduceTask.java:456)
    at org.apache.hadoop.mapred.ReduceTask$3.collect(ReduceTask.java:496)
    at org.apache.hadoop.streaming.PipeMapRed$MROutputThread.run(PipeMapRed.java:381)

在地图.py在

^{pr2}$

在减少.py在

import sys

for line in sys.stdin:
        txt= line.split('\t')
        print txt[0]+'\t'+txt[1]+'\t'+txt[2]

输入表单超表格将以制表符分隔的值, 例:“这是文本”。在

输出表包含三列,我需要将输入的文本按制表符拆分并保存到超级标签中。 超表输出列名cckw和{}。在


Tags: orgtxthadoopchildlangapachelinejava