Package eu.dnetlib.dhp.utils
Class SparkSessionSupport
java.lang.Object
eu.dnetlib.dhp.utils.SparkSessionSupport
SparkSession utility methods.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidrunWithSparkHiveSession(org.apache.spark.SparkConf conf, Boolean isSparkSessionManaged, FunctionalInterfaceSupport.ThrowingConsumer<org.apache.spark.sql.SparkSession, Exception> fn) Runs a given function using SparkSession created with hive support and using default builder and supplied SparkConf.static voidrunWithSparkSession(Function<org.apache.spark.SparkConf, org.apache.spark.sql.SparkSession> sparkSessionBuilder, org.apache.spark.SparkConf conf, Boolean isSparkSessionManaged, FunctionalInterfaceSupport.ThrowingConsumer<org.apache.spark.sql.SparkSession, Exception> fn) Runs a given function using SparkSession created using supplied builder and supplied SparkConf.static voidrunWithSparkSession(org.apache.spark.SparkConf conf, Boolean isSparkSessionManaged, FunctionalInterfaceSupport.ThrowingConsumer<org.apache.spark.sql.SparkSession, Exception> fn) Runs a given function using SparkSession created using default builder and supplied SparkConf.
-
Method Details
-
runWithSparkSession
public static void runWithSparkSession(org.apache.spark.SparkConf conf, Boolean isSparkSessionManaged, FunctionalInterfaceSupport.ThrowingConsumer<org.apache.spark.sql.SparkSession, Exception> fn) Runs a given function using SparkSession created using default builder and supplied SparkConf. Stops SparkSession when SparkSession is managed. Allows to reuse SparkSession created externally.- Parameters:
conf- SparkConf instanceisSparkSessionManaged- When true will stop SparkSessionfn- Consumer to be applied to constructed SparkSession
-
runWithSparkHiveSession
public static void runWithSparkHiveSession(org.apache.spark.SparkConf conf, Boolean isSparkSessionManaged, FunctionalInterfaceSupport.ThrowingConsumer<org.apache.spark.sql.SparkSession, Exception> fn) Runs a given function using SparkSession created with hive support and using default builder and supplied SparkConf. Stops SparkSession when SparkSession is managed. Allows to reuse SparkSession created externally.- Parameters:
conf- SparkConf instanceisSparkSessionManaged- When true will stop SparkSessionfn- Consumer to be applied to constructed SparkSession
-
runWithSparkSession
public static void runWithSparkSession(Function<org.apache.spark.SparkConf, org.apache.spark.sql.SparkSession> sparkSessionBuilder, org.apache.spark.SparkConf conf, Boolean isSparkSessionManaged, FunctionalInterfaceSupport.ThrowingConsumer<org.apache.spark.sql.SparkSession, Exception> fn) Runs a given function using SparkSession created using supplied builder and supplied SparkConf. Stops SparkSession when SparkSession is managed. Allows to reuse SparkSession created externally.- Parameters:
sparkSessionBuilder- Builder of SparkSessionconf- SparkConf instanceisSparkSessionManaged- When true will stop SparkSessionfn- Consumer to be applied to constructed SparkSession
-