Package uk.gov.gchq.gaffer.spark
Class SparkContextUtil
- java.lang.Object
-
- uk.gov.gchq.gaffer.spark.SparkContextUtil
-
-
Field Summary
Fields Modifier and Type Field Description static String
SPARK_CONTEXT_CONFIG_KEY
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addSparkSession(Context context, org.apache.spark.sql.SparkSession sparkSession)
Adds a spark session to the givenContext
.static void
addSparkSession(Context context, StoreProperties storeProperties)
Adds a spark session to the givenContext
.static Context
createContext(User user, org.apache.spark.sql.SparkSession sparkSession)
Create a new Context with the given user and spark session.static Context
createContext(User user, StoreProperties storeProperties)
Create a new Context with the given user and store propertiesstatic org.apache.spark.sql.SparkSession
createSparkSession(StoreProperties storeProperties)
static org.apache.spark.sql.SparkSession
getSparkSession(Context context, StoreProperties properties)
Extracts theSparkSession
from the Context.
-
-
-
Field Detail
-
SPARK_CONTEXT_CONFIG_KEY
public static final String SPARK_CONTEXT_CONFIG_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
addSparkSession
public static void addSparkSession(Context context, StoreProperties storeProperties)
Adds a spark session to the givenContext
.- Parameters:
context
- the user contextstoreProperties
- the store properties - used to create a spark session
-
addSparkSession
public static void addSparkSession(Context context, org.apache.spark.sql.SparkSession sparkSession)
Adds a spark session to the givenContext
.- Parameters:
context
- the user contextsparkSession
- the spark session to add to the context
-
createContext
public static Context createContext(User user, StoreProperties storeProperties)
Create a new Context with the given user and store properties- Parameters:
user
- the userstoreProperties
- the store properties- Returns:
- the new
Context
.
-
createContext
public static Context createContext(User user, org.apache.spark.sql.SparkSession sparkSession)
Create a new Context with the given user and spark session.- Parameters:
user
- the usersparkSession
- the spark session- Returns:
- the new
Context
.
-
getSparkSession
public static org.apache.spark.sql.SparkSession getSparkSession(Context context, StoreProperties properties)
Extracts theSparkSession
from the Context. If there is no SparkSession in the Context then a new SparkSession instance is created and added to the context.
-
createSparkSession
public static org.apache.spark.sql.SparkSession createSparkSession(StoreProperties storeProperties)
-
-