Package cern.nxcals.api.utils
Class SparkUtils
java.lang.Object
cern.nxcals.api.utils.SparkUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.spark.SparkConfcreateSparkConf(cern.nxcals.api.config.SparkProperties config) Creates Spark configurationstatic org.apache.spark.sql.SparkSessioncreateSparkSession(cern.nxcals.api.config.SparkProperties properties) Creates Spark session with the given properties.static org.apache.spark.sql.SparkSessioncreateSparkSession(org.apache.spark.SparkConf config) Creates Spark session with the given config.static Supplier<org.apache.spark.sql.SparkSession> createSparkSessionSupplier(@NonNull cern.nxcals.api.config.SparkProperties sparkProperties) Creates Spark session supplier that is able to recreate and return a new instance of the SparkSession in case the current one was closed.static Supplier<org.apache.spark.sql.SparkSession> createSparkSessionSupplier(@NonNull org.apache.spark.SparkConf sparkConf) Creates Spark session supplier that is able to recreate and return a new instance of the SparkSession in case the current one was closed.static Supplier<org.apache.spark.sql.SparkSession> createSparkSessionSupplier(@NonNull org.apache.spark.SparkConf sparkConf, @NonNull List<cern.nxcals.common.config.SparkSessionModifier> sessionModifiers) Creates Spark session supplier that is able to recreate and return a new instance of the SparkSession in case the current one was closed.static voidmodifySparkSession(org.apache.spark.sql.SparkSession session, Collection<cern.nxcals.common.config.SparkSessionModifier> modifiers) Modifies Spark session according to the collection of modifiers
-
Method Details
-
createSparkConf
public static org.apache.spark.SparkConf createSparkConf(cern.nxcals.api.config.SparkProperties config) Creates Spark configuration- Parameters:
config- Spark properties config- Returns:
- Configuration for a Spark application
-
createSparkSession
public static org.apache.spark.sql.SparkSession createSparkSession(org.apache.spark.SparkConf config) Creates Spark session with the given config.- Parameters:
config- config of the session- Returns:
- spark session
-
modifySparkSession
public static void modifySparkSession(org.apache.spark.sql.SparkSession session, Collection<cern.nxcals.common.config.SparkSessionModifier> modifiers) Modifies Spark session according to the collection of modifiers- Parameters:
session- session to modifymodifiers- to apply to the session
-
createSparkSession
public static org.apache.spark.sql.SparkSession createSparkSession(cern.nxcals.api.config.SparkProperties properties) Creates Spark session with the given properties.- Parameters:
properties- properties of the session- Returns:
- spark session
-
createSparkSessionSupplier
public static Supplier<org.apache.spark.sql.SparkSession> createSparkSessionSupplier(@NonNull @NonNull org.apache.spark.SparkConf sparkConf, @NonNull @NonNull List<cern.nxcals.common.config.SparkSessionModifier> sessionModifiers) Creates Spark session supplier that is able to recreate and return a new instance of the SparkSession in case the current one was closed.- Parameters:
sparkConf- config of the sessionsessionModifiers- to apply to the session
-
createSparkSessionSupplier
public static Supplier<org.apache.spark.sql.SparkSession> createSparkSessionSupplier(@NonNull @NonNull org.apache.spark.SparkConf sparkConf) Creates Spark session supplier that is able to recreate and return a new instance of the SparkSession in case the current one was closed.- Parameters:
sparkConf- config of the session
-
createSparkSessionSupplier
public static Supplier<org.apache.spark.sql.SparkSession> createSparkSessionSupplier(@NonNull @NonNull cern.nxcals.api.config.SparkProperties sparkProperties) Creates Spark session supplier that is able to recreate and return a new instance of the SparkSession in case the current one was closed.- Parameters:
sparkProperties- Spark properties config
-