def writeData(writer): key = LongWritable() value = LongWritable() for i in range(1000): key.set(1000 - i) value.set(i) print(('[%d] %s %s' % (writer.getLength(), key.toString(), value.toString()))) writer.append(key, value)
def writeData(writer): key = LongWritable() value = LongWritable() for i in xrange(10): key.set(1000 - i) value.set(i) print '[%d] %s %s' % (writer.getLength(), key.toString(), value.toString()) writer.append(key, value)
def write_text_data(writer): key = LongWritable() value = Text() for i in xrange(1000): key.set(1000 - i) value.set('taro {}'.format(i)) print '[%d] %s %s' % (writer.getLength(), key.toString(), value.toString()) writer.append(key, value)