Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-31749

The Using Hadoop OutputFormats example is not avaliable for DataStream

    XMLWordPrintableJSON

Details

    Description

      The following example shows how to use Hadoop’s TextOutputFormat from the doc: https://nightlies.apache.org/flink/flink-docs-release-1.17/docs/connectors/datastream/formats/hadoop/#using-hadoop-outputformats . But the DataStream has no output().

      // Obtain the result we want to emit
      DataStream<Tuple2<Text, IntWritable>> hadoopResult = [...]
      
      // Set up the Hadoop TextOutputFormat.
      HadoopOutputFormat<Text, IntWritable> hadoopOF =
        // create the Flink wrapper.
        new HadoopOutputFormat<Text, IntWritable>(
          // set the Hadoop OutputFormat and specify the job.
          new TextOutputFormat<Text, IntWritable>(), job
        );
      hadoopOF.getConfiguration().set("mapreduce.output.textoutputformat.separator", " ");
      TextOutputFormat.setOutputPath(job, new Path(outputPath));
      
      // Emit data using the Hadoop TextOutputFormat.
      hadoopResult.output(hadoopOF); 

      Attachments

        Activity

          People

            echauchot Etienne Chauchot
            easonqin junzhong qin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: