Skip to content

Instantly share code, notes, and snippets.

@chetkhatri
Created May 11, 2020 15:38
Show Gist options
  • Save chetkhatri/e9db45a9a047590570d224c1ae60736b to your computer and use it in GitHub Desktop.
Save chetkhatri/e9db45a9a047590570d224c1ae60736b to your computer and use it in GitHub Desktop.
import scala.util.{Try, Success, Failure}
val df = Try(spark.read.
format("com.databricks.spark.xml").
option("rootTag", "hierarchy").
option("rowTag", "sms_request").
load("/tmp/broadcast.xml")) match {
case Success(df) => df
case Failure(exception) => throw new Exception("foo")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment