apache spark Pipe extension - Java Big Data

Java examples for Big Data:apache spark

Description

apache spark Pipe extension

Demo Code



import java.util.Arrays;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

public class PipeEx {

    public static void main(String[] args) {
        SparkConf conf = new SparkConf().setAppName("PipeEx").setMaster(
                "local[*]");
        JavaSparkContext sc = new JavaSparkContext(conf);

        JavaRDD<Integer> number = sc.parallelize(
                Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9), 3);
        System.out.println(number.collect());

        System.out//from w  w w  .  j  a  v a  2 s .co  m
                .println(number
                        .pipe("C:\\print.bat")
                        .collect());

        sc.close();

    }

}

Related Tutorials