2012-06-14 11 views
11

मुझे लगता है कि शीर्षक पहले से ही मेरे प्रश्न को समझा रहा है। मैंहडोप: कुंजी और मान आउटपुट फ़ाइल में अलग टैब हैं। इसे अर्धविराम से अलग कैसे करें?

key;value 

में

key (tab space) value 

बदलना चाहते में सभी उत्पादन फ़ाइलें reducers मानचित्रकारों के उत्पादन से पैदा कर रहे हैं होगा।

मुझे Google का उपयोग करके इस पर अच्छा प्रलेखन नहीं मिला। क्या कोई इसे प्राप्त करने के तरीके पर कोड का एक अंश दे सकता है?

+0

क्या संस्करण (0.20.2, 0.20.20x, 1.0.x, 2.0.0?) और distro (अपाचे, क्लाउडेरा?) हैडऑप का उपयोग कर रहे हैं –

+0

आप अपने आउटपुट प्रारूप वर्ग के रूप में क्या उपयोग कर रहे हैं: 'oahmapred.TextOutputFormat', या' oahmapreduce.lib.output.TextOutputFormat'? –

उत्तर

18

";"

+0

हैलो क्रिस..क्या यह ठीक है कि मैंने जो निर्दिष्ट किया है ??? – Tariq

+1

यह mapreduce.output.textoutputformat.separator होना चाहिए यदि आप नए एपीआई – Tariq

+0

1.0.0 का उपयोग कर रहे हैं तो अभी भी 'oahmapreduce.lib.output.TextOutputFormat' के लिए अपने स्रोत में 'mapred.textoutputformat.separator' दिखाता है। Http: // svn.apache.org/viewvc/hadoop/common/tags/release-1.0.0/src/mapred/org/apache/hadoop/mapreduce/lib/output/TextOutputFormat.java?view=markup, रेखा 115 –

1

के विन्यास संपत्ति mapred.textoutputformat.separator सेट आप अपनी पसंद का एक विभाजक निर्दिष्ट करने के लिए "KeyValueLineRecordReader" के "KEY_VALUE_SEPERATOR" संपत्ति का उपयोग कर सकते हैं।

+1

इस संपत्ति को डेटा को वापस पढ़ने के दौरान सेट किया जा सकता है, लेकिन आउटपुट –

+0

के लिए उपयोग नहीं किया जाता है क्रिस धन्यवाद। – Tariq

14

बेहतर दस्तावेज़ीकरण की कमी में, यहाँ है कि मैं क्या एकत्र किया है:

setTextOutputFormatSeparator(final Job job, final String separator){ 
      final Configuration conf = job.getConfiguration(); //ensure accurate config ref 

      conf.set("mapred.textoutputformat.separator", separator); //Prior to Hadoop 2 (YARN) 
      conf.set("mapreduce.textoutputformat.separator", separator); //Hadoop v2+ (YARN) 
      conf.set("mapreduce.output.textoutputformat.separator", separator); 
      conf.set("mapreduce.output.key.field.separator", separator); 
      conf.set("mapred.textoutputformat.separatorText", separator); // ? 
    } 
संबंधित मुद्दे