org.apache.spark.sql.SparkSession.Builder Java Examples

The following examples show how to use org.apache.spark.sql.SparkSession.Builder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AutomatedTestBase.java    From systemds with Apache License 2.0 6 votes vote down vote up
/**
 * Create a SystemDS-preferred Spark Session.
 *
 * @param appName the application name
 * @param master the master value (ie, "local", etc)
 * @return Spark Session
 */
public static SparkSession createSystemDSSparkSession(String appName, String master) {
	Builder builder = SparkSession.builder();
	if (appName != null) {
		builder.appName(appName);
	}
	if (master != null) {
		builder.master(master);
	}
	builder.config("spark.driver.maxResultSize", "0");
	if (SparkExecutionContext.FAIR_SCHEDULER_MODE) {
		builder.config("spark.scheduler.mode", "FAIR");
	}
	builder.config("spark.locality.wait", "5s");
	SparkSession spark = builder.getOrCreate();
	return spark;
}
 
Example #2
Source File: AutomatedTestBase.java    From systemds with Apache License 2.0 6 votes vote down vote up
/**
 * Create a SystemDS-preferred Spark Session.
 *
 * @param appName the application name
 * @param master the master value (ie, "local", etc)
 * @return Spark Session
 */
public static SparkSession createSystemDSSparkSession(String appName, String master) {
	Builder builder = SparkSession.builder();
	if (appName != null) {
		builder.appName(appName);
	}
	if (master != null) {
		builder.master(master);
	}
	builder.config("spark.driver.maxResultSize", "0");
	if (SparkExecutionContext.FAIR_SCHEDULER_MODE) {
		builder.config("spark.scheduler.mode", "FAIR");
	}
	builder.config("spark.locality.wait", "5s");
	SparkSession spark = builder.getOrCreate();
	return spark;
}
 
Example #3
Source File: GeoWaveSparkConf.java    From geowave with Apache License 2.0 6 votes vote down vote up
private static SparkSession internalCreateSession(
    final SparkConf conf,
    final SparkConf addonOptions) {

  // Create initial SessionBuilder from default Configuration.
  Builder builder = SparkSession.builder().config(conf);

  // Ensure SpatialEncoders and UDTs are registered at each session
  // creation.
  GeoWaveSpatialEncoders.registerUDTs();

  if (addonOptions != null) {
    builder = builder.config(addonOptions);
  }

  return builder.getOrCreate();
}