in src/main/java/com/aliyun/emr/example/spark/SparkMaxComputeJavaDemo.java [33:57]
public static void main(String[] args) {
String partition = null;
String accessId = args[0];
String accessKey = args[1];
String odpsUrl = args[2];
String tunnelUrl = args[3];
String project = args[4];
String table = args[5];
if (args.length > 6) {
partition = args[6];
}
SparkConf sparkConf = new SparkConf().setAppName("E-MapReduce Demo 3-2: Spark MaxCompute Demo (Java)");
JavaSparkContext jsc = new JavaSparkContext(sparkConf);
OdpsOps odpsOps = new OdpsOps(jsc.sc(), accessId, accessKey, odpsUrl, tunnelUrl);
System.out.println("Read odps table...");
JavaRDD<List<Long>> readData = odpsOps.readTableWithJava(project, table, new RecordToLongs(), Integer.valueOf(partition));
System.out.println("counts: ");
System.out.println(readData.count());
}