apache spark - How do I raise failure with Scala Try -


in spark, can handle exceptions way:

val myrdd = sc.textfile(path) .map(line => try {        // dangerous     // if(condition)    //   raise isfailure;  }).filter(_.issuccess).map(_.get) 

i'd element read first map function raise failure well, under conditions. how do it?

if you're ignoring actual errors, can filter condition (given condition depends entirely on line):

def condition(line: string): boolean = ???  val myrdd = sc.textfile(path)   .map(line => try { // dangerous })   .filter(_.issuccess)   .filter(condition)   .map(_.get) 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -