@@ -0,0 +1,1709 @@
+/**%0A * Illustrates loading a json file and finding out if people like pandas%0A */%0Apackage com.oreilly.learningsparkexamples.java;%0A%0Aimport java.io.StringReader;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.Iterator;%0Aimport java.lang.Iterable;%0Aimport scala.Tuple2;%0A%0Aimport org.apache.commons.lang.StringUtils;%0Aimport org.apache.spark.SparkConf;%0Aimport org.apache.spark.api.java.JavaRDD;%0Aimport org.apache.spark.api.java.JavaPairRDD;%0Aimport org.apache.spark.api.java.JavaSparkContext;%0Aimport org.apache.spark.api.java.function.DoubleFunction;%0Aimport org.apache.spark.api.java.function.FlatMapFunction;%0Aimport org.apache.spark.api.java.function.Function;%0A%0Aimport com.datastax.spark.connector.CassandraRow;%0Aimport static com.datastax.spark.connector.CassandraJavaUtil.javaFunctions;%0A%0Apublic class BasicQueryCassandra %7B%0A  public static void main(String%5B%5D args) throws Exception %7B%0A%09%09if (args.length != 2) %7B%0A      throw new Exception(%22Usage BasicLoadJson %5BsparkMaster%5D %5BcassandraHost%5D%22);%0A%09%09%7D%0A    String sparkMaster = args%5B0%5D;%0A    String cassandraHost = args%5B1%5D;%0A    SparkConf conf = new SparkConf(true)%0A      .set(%22spark.cassandra.connection.host%22, cassandraHost);%0A%0A%09%09JavaSparkContext sc = new JavaSparkContext(%0A      sparkMaster, %22basicquerycassandra%22, conf);%0A    // entire table as an RDD%0A    // assumes your table test was created as CREATE TABLE test.kv(key text PRIMARY KEY, value int);%0A    JavaRDD%3CCassandraRow%3E data = javaFunctions(sc).cassandraTable(%22test%22 , %22kv%22);%0A    // print some basic stats%0A    System.out.println(data.mapToDouble(new DoubleFunction%3CCassandraRow%3E() %7B%0A        public double call(CassandraRow row) %7B%0A          return row.getInt(%22value%22);%0A        %7D%7D).stats());%0A%0A%09%7D%0A%7D%0A%0A

Add a basic java query example