title: Convert Json WrappedArray to String using spark sql
body: <p>I'm working on a zeppelin notebook and try to load data from a table using sql. 
  In the table, each row has one column which is a JSON blob. For example,  <code>[{'timestamp':12345,'value':10},{'timestamp':12346,'value':11},{'timestamp':12347,'value':12}]</code></p>
  
  <p>I want to select the JSON blob as a string, like the original string. But spark automatically load it as a WrappedArray. </p>
  
  <p>It seems that I have to write a UDF to convert the WrappedArray to a string. The following is my code. </p>
  
  <p>I first define a Scala function and then register the function. And then use the registered function on the column.</p>
  
  <pre><code>val unwraparr = udf ((x: WrappedArray[(Int, Int)]) =&gt; x.map { case Row(val1: String) =&gt;  + "," + val2 })
  sqlContext.udf.register("fwa", unwraparr)
  </code></pre>
  
  <p>It doesn't work. I would really appreciate if anyone can help. </p>
  
  <p>The following is the schema of the part I'm working on. There will be many amount and timeStamp pairs.  </p>
  
  <pre><code>-- targetColumn: array (nullable = true)
      |-- element: struct (containsNull = true)
      |    |-- value: long (nullable = true)
      |    |-- timeStamp: string (nullable = true)
  </code></pre>
  
  <p>UPDATE:
  I come up with the following code:</p>
  
  <pre><code>val f = (x: Seq[Row]) =&gt; x.map { case Row(val1: Long, val2: String) =&gt; x.mkString("+") }
  </code></pre>
  
  <p>I need it to concat the objects/struct/row (not sure how to call the struct) to a single string. </p>