Skip to content

Commit b48cda5

Browse files
committed
Merge branch 'master' into groupby
Conflicts: python/pyspark/rdd.py python/pyspark/shuffle.py python/pyspark/tests.py
2 parents 85138e6 + 73b3089 commit b48cda5

File tree

139 files changed

+3729
-908
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+3729
-908
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Many of the example programs print usage help if no params are given.
6969
Testing first requires [building Spark](#building-spark). Once Spark is built, tests
7070
can be run using:
7171

72-
./sbt/sbt test
72+
./dev/run-tests
7373

7474
## A Note About Hadoop Versions
7575

@@ -118,7 +118,10 @@ If your project is built with Maven, add this to your POM file's `<dependencies>
118118
## A Note About Thrift JDBC server and CLI for Spark SQL
119119

120120
Spark SQL supports Thrift JDBC server and CLI.
121-
See sql-programming-guide.md for more information about using the JDBC server.
121+
See sql-programming-guide.md for more information about using the JDBC server and CLI.
122+
You can use those features by setting `-Phive` when building Spark as follows.
123+
124+
$ sbt/sbt -Phive assembly
122125

123126
## Configuration
124127

@@ -136,3 +139,5 @@ submitting any copyrighted material via pull request, email, or other means
136139
you agree to license the material under the project's open source license and
137140
warrant that you have the legal authority to do so.
138141

142+
Please see [Contributing to Spark wiki page](https://cwiki.apache.org/SPARK/Contributing+to+Spark)
143+
for more information.

bin/load-spark-env.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ if [ -z "$SPARK_ENV_LOADED" ]; then
2727
# Returns the parent of the directory this script lives in.
2828
parent_dir="$(cd `dirname $0`/..; pwd)"
2929

30-
use_conf_dir=${SPARK_CONF_DIR:-"$parent_dir/conf"}
30+
user_conf_dir=${SPARK_CONF_DIR:-"$parent_dir/conf"}
3131

32-
if [ -f "${use_conf_dir}/spark-env.sh" ]; then
32+
if [ -f "${user_conf_dir}/spark-env.sh" ]; then
3333
# Promote all variable declarations to environment (exported) variables
3434
set -a
35-
. "${use_conf_dir}/spark-env.sh"
35+
. "${user_conf_dir}/spark-env.sh"
3636
set +a
3737
fi
3838
fi

bin/spark-class

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,14 @@ else
105105
exit 1
106106
fi
107107
fi
108+
JAVA_VERSION=$($RUNNER -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
108109

109110
# Set JAVA_OPTS to be able to load native libraries and to set heap size
110-
JAVA_OPTS="-XX:MaxPermSize=128m $OUR_JAVA_OPTS"
111+
if [ "$JAVA_VERSION" -ge 18 ]; then
112+
JAVA_OPTS="$OUR_JAVA_OPTS"
113+
else
114+
JAVA_OPTS="-XX:MaxPermSize=128m $OUR_JAVA_OPTS"
115+
fi
111116
JAVA_OPTS="$JAVA_OPTS -Xms$OUR_JAVA_MEM -Xmx$OUR_JAVA_MEM"
112117

113118
# Load extra JAVA_OPTS from conf/java-opts, if it exists

bin/spark-class2.cmd

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,13 @@ rem All drivers use SPARK_JAVA_OPTS + SPARK_DRIVER_MEMORY. The repl also uses SP
7777
)
7878

7979
rem Set JAVA_OPTS to be able to load native libraries and to set heap size
80-
set JAVA_OPTS=-XX:MaxPermSize=128m %OUR_JAVA_OPTS% -Djava.library.path=%SPARK_LIBRARY_PATH% -Xms%OUR_JAVA_MEM% -Xmx%OUR_JAVA_MEM%
80+
for /f "tokens=3" %%i in ('java -version 2^>^&1 ^| find "version"') do set jversion=%%i
81+
for /f "tokens=1 delims=_" %%i in ("%jversion:~1,-1%") do set jversion=%%i
82+
if "%jversion%" geq "1.8.0" (
83+
set JAVA_OPTS=%OUR_JAVA_OPTS% -Djava.library.path=%SPARK_LIBRARY_PATH% -Xms%OUR_JAVA_MEM% -Xmx%OUR_JAVA_MEM%
84+
) else (
85+
set JAVA_OPTS=-XX:MaxPermSize=128m %OUR_JAVA_OPTS% -Djava.library.path=%SPARK_LIBRARY_PATH% -Xms%OUR_JAVA_MEM% -Xmx%OUR_JAVA_MEM%
86+
)
8187
rem Attention: when changing the way the JAVA_OPTS are assembled, the change must be reflected in CommandUtils.scala!
8288

8389
rem Test whether the user has built Spark

bin/spark-shell

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
cygwin=false
2424
case "`uname`" in
25-
CYGWIN*) cygwin=true;;
25+
CYGWIN*) cygwin=true;;
2626
esac
2727

2828
# Enter posix mode for bash
@@ -32,9 +32,9 @@ set -o posix
3232
FWDIR="$(cd `dirname $0`/..; pwd)"
3333

3434
function usage() {
35-
echo "Usage: ./bin/spark-shell [options]"
36-
$FWDIR/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
37-
exit 0
35+
echo "Usage: ./bin/spark-shell [options]"
36+
$FWDIR/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
37+
exit 0
3838
}
3939

4040
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
@@ -46,20 +46,20 @@ SUBMIT_USAGE_FUNCTION=usage
4646
gatherSparkSubmitOpts "$@"
4747

4848
function main() {
49-
if $cygwin; then
50-
# Workaround for issue involving JLine and Cygwin
51-
# (see http://sourceforge.net/p/jline/bugs/40/).
52-
# If you're using the Mintty terminal emulator in Cygwin, may need to set the
53-
# "Backspace sends ^H" setting in "Keys" section of the Mintty options
54-
# (see https://github.com/sbt/sbt/issues/562).
55-
stty -icanon min 1 -echo > /dev/null 2>&1
56-
export SPARK_SUBMIT_OPTS="$SPARK_SUBMIT_OPTS -Djline.terminal=unix"
57-
$FWDIR/bin/spark-submit --class org.apache.spark.repl.Main "${SUBMISSION_OPTS[@]}" spark-shell "${APPLICATION_OPTS[@]}"
58-
stty icanon echo > /dev/null 2>&1
59-
else
60-
export SPARK_SUBMIT_OPTS
61-
$FWDIR/bin/spark-submit --class org.apache.spark.repl.Main "${SUBMISSION_OPTS[@]}" spark-shell "${APPLICATION_OPTS[@]}"
62-
fi
49+
if $cygwin; then
50+
# Workaround for issue involving JLine and Cygwin
51+
# (see http://sourceforge.net/p/jline/bugs/40/).
52+
# If you're using the Mintty terminal emulator in Cygwin, may need to set the
53+
# "Backspace sends ^H" setting in "Keys" section of the Mintty options
54+
# (see https://github.com/sbt/sbt/issues/562).
55+
stty -icanon min 1 -echo > /dev/null 2>&1
56+
export SPARK_SUBMIT_OPTS="$SPARK_SUBMIT_OPTS -Djline.terminal=unix"
57+
$FWDIR/bin/spark-submit --class org.apache.spark.repl.Main "${SUBMISSION_OPTS[@]}" spark-shell "${APPLICATION_OPTS[@]}"
58+
stty icanon echo > /dev/null 2>&1
59+
else
60+
export SPARK_SUBMIT_OPTS
61+
$FWDIR/bin/spark-submit --class org.apache.spark.repl.Main "${SUBMISSION_OPTS[@]}" spark-shell "${APPLICATION_OPTS[@]}"
62+
fi
6363
}
6464

6565
# Copy restore-TTY-on-exit functions from Scala script so spark-shell exits properly even in

bin/spark-sql

Lines changed: 13 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
set -o posix
2525

2626
CLASS="org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver"
27+
CLASS_NOT_FOUND_EXIT_STATUS=1
2728

2829
# Figure out where Spark is installed
2930
FWDIR="$(cd `dirname $0`/..; pwd)"
@@ -43,52 +44,22 @@ function usage {
4344
$FWDIR/bin/spark-class $CLASS --help 2>&1 | grep -v "$pattern" 1>&2
4445
}
4546

46-
function ensure_arg_number {
47-
arg_number=$1
48-
at_least=$2
49-
50-
if [[ $arg_number -lt $at_least ]]; then
51-
usage
52-
exit 1
53-
fi
54-
}
55-
56-
if [[ "$@" = --help ]] || [[ "$@" = -h ]]; then
47+
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
5748
usage
5849
exit 0
5950
fi
6051

61-
CLI_ARGS=()
62-
SUBMISSION_ARGS=()
63-
64-
while (($#)); do
65-
case $1 in
66-
-d | --define | --database | -f | -h | --hiveconf | --hivevar | -i | -p)
67-
ensure_arg_number $# 2
68-
CLI_ARGS+=("$1"); shift
69-
CLI_ARGS+=("$1"); shift
70-
;;
52+
source $FWDIR/bin/utils.sh
53+
SUBMIT_USAGE_FUNCTION=usage
54+
gatherSparkSubmitOpts "$@"
7155

72-
-e)
73-
ensure_arg_number $# 2
74-
CLI_ARGS+=("$1"); shift
75-
CLI_ARGS+=("$1"); shift
76-
;;
56+
"$FWDIR"/bin/spark-submit --class $CLASS "${SUBMISSION_OPTS[@]}" spark-internal "${APPLICATION_OPTS[@]}"
57+
exit_status=$?
7758

78-
-s | --silent)
79-
CLI_ARGS+=("$1"); shift
80-
;;
81-
82-
-v | --verbose)
83-
# Both SparkSubmit and SparkSQLCLIDriver recognizes -v | --verbose
84-
CLI_ARGS+=("$1")
85-
SUBMISSION_ARGS+=("$1"); shift
86-
;;
87-
88-
*)
89-
SUBMISSION_ARGS+=("$1"); shift
90-
;;
91-
esac
92-
done
59+
if [[ exit_status -eq CLASS_NOT_FOUND_EXIT_STATUS ]]; then
60+
echo
61+
echo "Failed to load Spark SQL CLI main class $CLASS."
62+
echo "You need to build Spark with -Phive."
63+
fi
9364

94-
exec "$FWDIR"/bin/spark-submit --class $CLASS "${SUBMISSION_ARGS[@]}" spark-internal "${CLI_ARGS[@]}"
65+
exit $exit_status

0 commit comments

Comments
 (0)