I am trying to build a DataFrame from a list, here is the code:

        private void start() {
                SparkConf conf = new SparkConf().setAppName("Data Set from 
Array").setMaster("local");
                SparkContext sc = new SparkContext(conf);
                SQLContext sqlContext = new SQLContext(sc);

                Integer[] l = new Integer[] { 1, 2, 3, 4, 5, 6, 7 };
                List<Integer> data = Arrays.asList(l);

                System.out.println(data);
                
                DataFrame df = sqlContext.createDataFrame(data, 
org.apache.spark.sql.types.NumericType.class);
                df.show();
        }

My result is (unpleasantly):

[1, 2, 3, 4, 5, 6, 7]
++
||
++
||
||
||
||
||
||
||
++

I also tried with:
org.apache.spark.sql.types.NumericType.class
org.apache.spark.sql.types.IntegerType.class
org.apache.spark.sql.types.ArrayType.class

I am probably missing something super obvious :(

Thanks!

jg


Reply via email to