Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ public boolean isSpark1() {
return sparkInterpreter.getSparkVersion().getMajorVersion() == 1;
}

public boolean isSpark3() {
return sparkInterpreter.getSparkVersion().getMajorVersion() == 3;
}

public JavaSparkContext getJavaSparkContext() {
return sparkInterpreter.getJavaSparkContext();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,8 @@ public Object getSQLContext() {
public boolean isSpark1() {
return sparkInterpreter.getSparkVersion().getMajorVersion() == 1;
}

public boolean isSpark3() {
return sparkInterpreter.getSparkVersion().getMajorVersion() == 3;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
java_import(gateway.jvm, "org.apache.spark.mllib.api.python.*")

intp = gateway.entry_point

if intp.isSpark3():
warnings.filterwarnings(action='ignore', module='pyspark.util')

jsc = intp.getJavaSparkContext()

java_import(gateway.jvm, "org.apache.spark.sql.*")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# limitations under the License.
#

import warnings

from py4j.java_gateway import java_import
from pyspark.conf import SparkConf
from pyspark.context import SparkContext
Expand All @@ -24,6 +26,9 @@

intp = gateway.entry_point

if intp.isSpark3():
warnings.filterwarnings(action='ignore', module='pyspark.util')

jsc = intp.getJavaSparkContext()
java_import(gateway.jvm, "org.apache.spark.SparkEnv")
java_import(gateway.jvm, "org.apache.spark.SparkConf")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ && getDeployMode().equals("cluster")) {
} else {
LOGGER.info("Run Spark under non-secure mode as no keytab and principal is specified");
}

env.put("PYSPARK_PIN_THREAD", "true");
LOGGER.debug("buildEnvFromProperties: " + env);
return env;

Expand Down