Search
 
SCRIPT & CODE EXAMPLE
 

SCALA

dataframe column json parser spark scala

import org.apache.spark.sql.functions.{lit, schema_of_json, from_json}
import collection.JavaConverters._

val schema = schema_of_json(lit(df.select($"jsonData").as[String].first))
df.withColumn("jsonData", from_json($"jsonData", schema, Map[String, String]().asJava))
Comment

PREVIOUS NEXT
Code Example
Scala :: reduce scala 
Scala :: scala in hadoop 
Scala :: Exception: sbt.TrapExitSecurityException thrown from the UncaughtExceptionHandler in thread "run-main-0" 
Scala :: how to print message in scala 
Scala :: scala reverse string 
Actionscript :: rabbitmq docker cant connect localhost 
Actionscript :: mount_osxfuse : Input/output error 
Excel :: google sheets convert month to number 
Excel :: excel auto adjust row heights 
Excel :: AND logic in excel formula 
Perl :: perl regex 
Perl :: perl split array into smaller arrays 
Perl :: nested haah in perl 
Pascal :: pascal delay 
Powershell :: powershell display firewall rules name 
Gdscript :: godot close game 
Clojure :: how to use clojure cond 
Lisp :: common lisp map number to word 
Assembly :: vba hello world 
Assembly :: visual studio change assembly name 
Assembly :: list all sensors android 
Javascript :: jquery vslidation remove spaces from input 
Javascript :: jquery 2 decimal places 
Javascript :: how to insatll react-router-dom 
Javascript :: jquery delay 1 second 
Javascript :: chrome design mode console 
Javascript :: f.select on change jquery 
Javascript :: execute after one second javascript 
Javascript :: electron hide menu bar 
Javascript :: javacsript update text in span 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =