title: In Spark RDD Println Error, How can I present the Data such as [Ljava.lang.String;@8e6606
body: <p>I have one problem with Apache Spark, using Scala. I'm trying to create a Spark application that prints an RDD from user input. Input data is like this:</p>
  
  <pre><code>List("aaaa","aaaa","dfddf","aaaa","aaaa","dfddf","aaaa","aaaa","dfddf","aaaa","aaaa","dfddf","aaaa","aaaa","dfddf")
  </code></pre>
  
  <p>Code is like this:</p>
  
  <pre><code>    val wSchemaString = "col1 col2 col3 col4";
      val wSchema = StructType(wSchemaString.split(" ").map(fieldName =&gt;StructField(fieldName, StringType, true)));
      val wRow = sc.parallelize(wInput.map(_.split(",")));
      val wRowRDD = wRow.map(x=&gt;{
          val wNum = wSchemaString.split(" ").size;
          var out = new Array[String](wNum+1);
          for(i &lt;- 0 to wNum)
          {
              out(i) = x(i);
          }
          Row(out);
      });
  
  wRowRDD.collect.foreach(println);
  ...
  </code></pre>
  
  <p>Result is like this: </p>
  
  <pre><code>27 [[Ljava.lang.String;@5f1ec010]
  28 [[Ljava.lang.String;@5bd38b39]
  29 [[Ljava.lang.String;@5d6b1c05]
  30 [[Ljava.lang.String;@7ea6404c]
  31 [[Ljava.lang.String;@75447fda]
  32 [[Ljava.lang.String;@6425fd5b]
  33 [[Ljava.lang.String;@7a1c94ba]
  34 [[Ljava.lang.String;@6a687df7]
  35 [[Ljava.lang.String;@722619b4]
  36 [[Ljava.lang.String;@117d1979]
  37 [[Ljava.lang.String;@304a45f4]
  38 [[Ljava.lang.String;@5c36aef0]
  39 [[Ljava.lang.String;@a173ddc]
  40 [[Ljava.lang.String;@7bde3bb0]
  41 [[Ljava.lang.String;@3b20df58]
  42 [[Ljava.lang.String;@981f1f2
  </code></pre>
  
  <p><strong>But, what I want is this:</strong></p>
  
  <pre><code>"aaaa","aaaa","dfddf","aaaa"
  "aaaa","dfddf","aaaa","aaaa"
  "dfddf","aaaa","aaaa","dfddf"    
  "aaaa","aaaa","dfddf","aaaa"
  </code></pre>