All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.johnsnowlabs.util.spark.SparkUtil.scala Maven / Gradle / Ivy

package com.johnsnowlabs.util.spark

import org.apache.spark.sql.expressions.UserDefinedFunction
import org.apache.spark.sql.functions.udf

object SparkUtil {

  // Helper UDF function to flatten arrays for Spark < 2.4.0
  def flattenArrays: UserDefinedFunction = udf { (arrayColumn: Seq[Seq[String]]) =>
    arrayColumn.flatten.distinct
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy