SHARE
TWEET

Untitled

a guest Jul 17th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {"key": { "defaultWeights":"1" }, "measures": { "m1":-0.01, "m2":-0.5.....}}
  2.      
  3. val flattened = dff.withColumn("default_weights", json_tuple(col("key"), "defaultWeights")).show
  4.      
  5. org.apache.spark.sql.AnalysisException: cannot resolve 'json_tuple(`key`, 'defaultWeights')' due to data type mismatch: json_tuple requires that all arguments are strings;;
  6. 'Project [key#6, measures#7, json_tuple(key#6, defaultWeights) AS default_weights#13]
  7. +- Relation[key#6,measures#7] json
  8.      
  9. <console>:25: error: type mismatch;
  10.  found   : String
  11.  required: org.apache.spark.sql.Column
  12.        val flattened = dff.withColumn("default_weights", json_tuple("key", "defaultWeights")).show
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top