org.apache.hadoop.mapreduce.Mapper.map()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(184)

本文整理了Java中org.apache.hadoop.mapreduce.Mapper.map()方法的一些代码示例,展示了Mapper.map()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mapper.map()方法的具体详情如下:
包路径:org.apache.hadoop.mapreduce.Mapper
类名称:Mapper
方法名:map

Mapper.map介绍

[英]Called once for each key/value pair in the input split. Most applications should override this, but the default is the identity function.
[中]为输入拆分中的每个键/值对调用一次。大多数应用程序都应该覆盖它,但默认的是identity函数。

代码示例

代码示例来源:origin: apache/kylin

  1. protected void doMap(KEYIN key, VALUEIN value, Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context)
  2. throws IOException, InterruptedException {
  3. super.map(key, value, context);
  4. }

代码示例来源:origin: org.apache.kylin/kylin-engine-mr

  1. protected void doMap(KEYIN key, VALUEIN value, Mapper<KEYIN, VALUEIN, KEYOUT, VALUEOUT>.Context context)
  2. throws IOException, InterruptedException {
  3. super.map(key, value, context);
  4. }

代码示例来源:origin: org.apache.hadoop/hadoop-mapred-test

  1. public void map(LongWritable key, Text value, Context context)
  2. throws IOException, InterruptedException {
  3. if (ioEx) {
  4. throw new IOException();
  5. }
  6. if (rtEx) {
  7. throw new RuntimeException();
  8. }
  9. super.map(key, value, context);
  10. }
  11. }

代码示例来源:origin: locationtech/geowave

  1. @Override
  2. protected void map(
  3. final LongWritable key,
  4. final DoubleWritable value,
  5. final org.apache.hadoop.mapreduce.Mapper.Context context)
  6. throws IOException, InterruptedException {
  7. long positiveKey = key.get();
  8. double adjustedValue = value.get();
  9. if (positiveKey < 0) {
  10. positiveKey = -positiveKey - 1;
  11. adjustedValue *= -1;
  12. }
  13. super.map(new LongWritable(positiveKey), new DoubleWritable(adjustedValue), context);
  14. }
  15. }

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient

  1. public void map(LongWritable key, Text value, Context context)
  2. throws IOException, InterruptedException {
  3. if (ioEx) {
  4. throw new IOException();
  5. }
  6. if (rtEx) {
  7. throw new RuntimeException();
  8. }
  9. super.map(key, value, context);
  10. }
  11. }

代码示例来源:origin: com.facebook.hadoop/hadoop-core

  1. /**
  2. * Expert users can override this method for more complete control over the
  3. * execution of the Mapper.
  4. * @param context
  5. * @throws IOException
  6. */
  7. public void run(Context context) throws IOException, InterruptedException {
  8. setup(context);
  9. while (context.nextKeyValue()) {
  10. map(context.getCurrentKey(), context.getCurrentValue(), context);
  11. }
  12. cleanup(context);
  13. }
  14. }

代码示例来源:origin: org.apache.hadoop/hadoop-mapred

  1. /**
  2. * Expert users can override this method for more complete control over the
  3. * execution of the Mapper.
  4. * @param context
  5. * @throws IOException
  6. */
  7. public void run(Context context) throws IOException, InterruptedException {
  8. setup(context);
  9. while (context.nextKeyValue()) {
  10. map(context.getCurrentKey(), context.getCurrentValue(), context);
  11. }
  12. cleanup(context);
  13. }
  14. }

代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-core

  1. /**
  2. * Expert users can override this method for more complete control over the
  3. * execution of the Mapper.
  4. * @param context
  5. * @throws IOException
  6. */
  7. public void run(Context context) throws IOException, InterruptedException {
  8. setup(context);
  9. try {
  10. while (context.nextKeyValue()) {
  11. map(context.getCurrentKey(), context.getCurrentValue(), context);
  12. }
  13. } finally {
  14. cleanup(context);
  15. }
  16. }
  17. }

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

  1. /**
  2. * Expert users can override this method for more complete control over the
  3. * execution of the Mapper.
  4. * @param context
  5. * @throws IOException
  6. */
  7. public void run(Context context) throws IOException, InterruptedException {
  8. setup(context);
  9. try {
  10. while (context.nextKeyValue()) {
  11. map(context.getCurrentKey(), context.getCurrentValue(), context);
  12. }
  13. } finally {
  14. cleanup(context);
  15. }
  16. }
  17. }

代码示例来源:origin: io.hops/hadoop-mapreduce-client-core

  1. /**
  2. * Expert users can override this method for more complete control over the
  3. * execution of the Mapper.
  4. * @param context
  5. * @throws IOException
  6. */
  7. public void run(Context context) throws IOException, InterruptedException {
  8. setup(context);
  9. try {
  10. while (context.nextKeyValue()) {
  11. map(context.getCurrentKey(), context.getCurrentValue(), context);
  12. }
  13. } finally {
  14. cleanup(context);
  15. }
  16. }
  17. }

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-core

  1. /**
  2. * Expert users can override this method for more complete control over the
  3. * execution of the Mapper.
  4. * @param context
  5. * @throws IOException
  6. */
  7. public void run(Context context) throws IOException, InterruptedException {
  8. setup(context);
  9. try {
  10. while (context.nextKeyValue()) {
  11. map(context.getCurrentKey(), context.getCurrentValue(), context);
  12. }
  13. } finally {
  14. cleanup(context);
  15. }
  16. }
  17. }

相关文章