2014-02-13 01:35:09 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
#
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
# contributor license agreements. See the NOTICE file distributed with
|
|
|
|
# this work for additional information regarding copyright ownership.
|
|
|
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
# (the "License"); you may not use this file except in compliance with
|
|
|
|
# the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Go to the Spark project root directory
|
2014-09-08 13:24:15 -04:00
|
|
|
FWDIR="$(cd "`dirname $0`"/..; pwd)"
|
2014-07-30 15:24:35 -04:00
|
|
|
cd "$FWDIR"
|
2014-02-13 01:35:09 -05:00
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
# Remove work directory
|
|
|
|
rm -rf ./work
|
|
|
|
|
2014-10-06 17:19:06 -04:00
|
|
|
source "$FWDIR/dev/run-tests-codes.sh"
|
|
|
|
|
|
|
|
CURRENT_BLOCK=$BLOCK_GENERAL
|
|
|
|
|
|
|
|
function handle_error () {
|
|
|
|
echo "[error] Got a return code of $? on line $1 of the run-tests script."
|
|
|
|
exit $CURRENT_BLOCK
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
# Build against the right verison of Hadoop.
|
|
|
|
{
|
|
|
|
if [ -n "$AMPLAB_JENKINS_BUILD_PROFILE" ]; then
|
|
|
|
if [ "$AMPLAB_JENKINS_BUILD_PROFILE" = "hadoop1.0" ]; then
|
|
|
|
export SBT_MAVEN_PROFILES_ARGS="-Dhadoop.version=1.0.4"
|
|
|
|
elif [ "$AMPLAB_JENKINS_BUILD_PROFILE" = "hadoop2.0" ]; then
|
|
|
|
export SBT_MAVEN_PROFILES_ARGS="-Dhadoop.version=2.0.0-mr1-cdh4.1.1"
|
|
|
|
elif [ "$AMPLAB_JENKINS_BUILD_PROFILE" = "hadoop2.2" ]; then
|
2014-10-08 16:33:46 -04:00
|
|
|
export SBT_MAVEN_PROFILES_ARGS="-Pyarn -Phadoop-2.2 -Dhadoop.version=2.2.0"
|
2014-09-17 15:44:44 -04:00
|
|
|
elif [ "$AMPLAB_JENKINS_BUILD_PROFILE" = "hadoop2.3" ]; then
|
|
|
|
export SBT_MAVEN_PROFILES_ARGS="-Pyarn -Phadoop-2.3 -Dhadoop.version=2.3.0"
|
|
|
|
fi
|
2014-07-30 17:08:24 -04:00
|
|
|
fi
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
if [ -z "$SBT_MAVEN_PROFILES_ARGS" ]; then
|
|
|
|
export SBT_MAVEN_PROFILES_ARGS="-Pyarn -Phadoop-2.3 -Dhadoop.version=2.3.0"
|
|
|
|
fi
|
|
|
|
}
|
2014-08-02 16:35:35 -04:00
|
|
|
|
|
|
|
export SBT_MAVEN_PROFILES_ARGS="$SBT_MAVEN_PROFILES_ARGS -Pkinesis-asl"
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
# Determine Java path and version.
|
|
|
|
{
|
|
|
|
if test -x "$JAVA_HOME/bin/java"; then
|
|
|
|
declare java_cmd="$JAVA_HOME/bin/java"
|
|
|
|
else
|
|
|
|
declare java_cmd=java
|
|
|
|
fi
|
|
|
|
|
|
|
|
# We can't use sed -r -e due to OS X / BSD compatibility; hence, all the parentheses.
|
|
|
|
JAVA_VERSION=$(
|
|
|
|
$java_cmd -version 2>&1 \
|
|
|
|
| grep -e "^java version" --max-count=1 \
|
|
|
|
| sed "s/java version \"\(.*\)\.\(.*\)\.\(.*\)\"/\1\2/"
|
|
|
|
)
|
|
|
|
|
|
|
|
if [ "$JAVA_VERSION" -lt 18 ]; then
|
|
|
|
echo "[warn] Java 8 tests will not run because JDK version is < 1.8."
|
|
|
|
fi
|
|
|
|
}
|
2014-04-15 22:34:39 -04:00
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
# Only run Hive tests if there are sql changes.
|
|
|
|
# Partial solution for SPARK-1455.
|
2014-04-15 22:34:39 -04:00
|
|
|
if [ -n "$AMPLAB_JENKINS" ]; then
|
|
|
|
git fetch origin master:master
|
2014-09-17 15:44:44 -04:00
|
|
|
|
|
|
|
sql_diffs=$(
|
|
|
|
git diff --name-only master \
|
|
|
|
| grep -e "^sql/" -e "^bin/spark-sql" -e "^sbin/start-thriftserver.sh"
|
|
|
|
)
|
|
|
|
|
|
|
|
non_sql_diffs=$(
|
|
|
|
git diff --name-only master \
|
|
|
|
| grep -v -e "^sql/" -e "^bin/spark-sql" -e "^sbin/start-thriftserver.sh"
|
|
|
|
)
|
|
|
|
|
|
|
|
if [ -n "$sql_diffs" ]; then
|
|
|
|
echo "[info] Detected changes in SQL. Will run Hive test suite."
|
2014-08-18 23:42:19 -04:00
|
|
|
_RUN_SQL_TESTS=true
|
2014-09-17 15:44:44 -04:00
|
|
|
|
|
|
|
if [ -z "$non_sql_diffs" ]; then
|
|
|
|
echo "[info] Detected no changes except in SQL. Will only run SQL tests."
|
|
|
|
_SQL_TESTS_ONLY=true
|
|
|
|
fi
|
2014-04-15 22:34:39 -04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
set -o pipefail
|
2014-10-06 17:19:06 -04:00
|
|
|
trap 'handle_error $LINENO' ERR
|
2014-03-04 01:31:30 -05:00
|
|
|
|
2014-08-06 15:58:24 -04:00
|
|
|
echo ""
|
2014-03-24 11:44:12 -04:00
|
|
|
echo "========================================================================="
|
|
|
|
echo "Running Apache RAT checks"
|
|
|
|
echo "========================================================================="
|
2014-10-06 17:19:06 -04:00
|
|
|
|
|
|
|
CURRENT_BLOCK=$BLOCK_RAT
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
./dev/check-license
|
2014-03-04 01:31:30 -05:00
|
|
|
|
2014-08-06 15:58:24 -04:00
|
|
|
echo ""
|
2014-02-13 01:35:09 -05:00
|
|
|
echo "========================================================================="
|
|
|
|
echo "Running Scala style checks"
|
|
|
|
echo "========================================================================="
|
2014-10-06 17:19:06 -04:00
|
|
|
|
|
|
|
CURRENT_BLOCK=$BLOCK_SCALA_STYLE
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
./dev/lint-scala
|
2014-02-13 01:35:09 -05:00
|
|
|
|
2014-08-06 15:58:24 -04:00
|
|
|
echo ""
|
|
|
|
echo "========================================================================="
|
|
|
|
echo "Running Python style checks"
|
|
|
|
echo "========================================================================="
|
2014-10-06 17:19:06 -04:00
|
|
|
|
|
|
|
CURRENT_BLOCK=$BLOCK_PYTHON_STYLE
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
./dev/lint-python
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "========================================================================="
|
|
|
|
echo "Building Spark"
|
|
|
|
echo "========================================================================="
|
|
|
|
|
2014-10-06 17:19:06 -04:00
|
|
|
CURRENT_BLOCK=$BLOCK_BUILD
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
{
|
|
|
|
# We always build with Hive because the PySpark Spark SQL tests need it.
|
[SPARK-2706][SQL] Enable Spark to support Hive 0.13
Given that a lot of users are trying to use hive 0.13 in spark, and the incompatibility between hive-0.12 and hive-0.13 on the API level I want to propose following approach, which has no or minimum impact on existing hive-0.12 support, but be able to jumpstart the development of hive-0.13 and future version support.
Approach: Introduce “hive-version” property, and manipulate pom.xml files to support different hive version at compiling time through shim layer, e.g., hive-0.12.0 and hive-0.13.1. More specifically,
1. For each different hive version, there is a very light layer of shim code to handle API differences, sitting in sql/hive/hive-version, e.g., sql/hive/v0.12.0 or sql/hive/v0.13.1
2. Add a new profile hive-default active by default, which picks up all existing configuration and hive-0.12.0 shim (v0.12.0) if no hive.version is specified.
3. If user specifies different version (currently only 0.13.1 by -Dhive.version = 0.13.1), hive-versions profile will be activated, which pick up hive-version specific shim layer and configuration, mainly the hive jars and hive-version shim, e.g., v0.13.1.
4. With this approach, nothing is changed with current hive-0.12 support.
No change by default: sbt/sbt -Phive
For example: sbt/sbt -Phive -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 assembly
To enable hive-0.13: sbt/sbt -Dhive.version=0.13.1
For example: sbt/sbt -Dhive.version=0.13.1 -Pyarn -Phadoop-2.4 -Dhadoop.version=2.4.0 assembly
Note that in hive-0.13, hive-thriftserver is not enabled, which should be fixed by other Jira, and we don’t need -Phive with -Dhive.version in building (probably we should use -Phive -Dhive.version=xxx instead after thrift server is also supported in hive-0.13.1).
Author: Zhan Zhang <zhazhan@gmail.com>
Author: zhzhan <zhazhan@gmail.com>
Author: Patrick Wendell <pwendell@gmail.com>
Closes #2241 from zhzhan/spark-2706 and squashes the following commits:
3ece905 [Zhan Zhang] minor fix
410b668 [Zhan Zhang] solve review comments
cbb4691 [Zhan Zhang] change run-test for new options
0d4d2ed [Zhan Zhang] rebase
497b0f4 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
8fad1cf [Zhan Zhang] change the pom file and make hive-0.13.1 as the default
ab028d1 [Zhan Zhang] rebase
4a2e36d [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
4cb1b93 [zhzhan] Merge pull request #1 from pwendell/pr-2241
b0478c0 [Patrick Wendell] Changes to simplify the build of SPARK-2706
2b50502 [Zhan Zhang] rebase
a72c0d4 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
cb22863 [Zhan Zhang] correct the typo
20f6cf7 [Zhan Zhang] solve compatability issue
f7912a9 [Zhan Zhang] rebase and solve review feedback
301eb4a [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
10c3565 [Zhan Zhang] address review comments
6bc9204 [Zhan Zhang] rebase and remove temparory repo
d3aa3f2 [Zhan Zhang] Merge branch 'master' into spark-2706
cedcc6f [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
3ced0d7 [Zhan Zhang] rebase
d9b981d [Zhan Zhang] rebase and fix error due to rollback
adf4924 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
3dd50e8 [Zhan Zhang] solve conflicts and remove unnecessary implicts
d10bf00 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
dc7bdb3 [Zhan Zhang] solve conflicts
7e0cc36 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
d7c3e1e [Zhan Zhang] Merge branch 'master' into spark-2706
68deb11 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
d48bd18 [Zhan Zhang] address review comments
3ee3b2b [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
57ea52e [Zhan Zhang] Merge branch 'master' into spark-2706
2b0d513 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
9412d24 [Zhan Zhang] address review comments
f4af934 [Zhan Zhang] rebase
1ccd7cc [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
128b60b [Zhan Zhang] ignore 0.12.0 test cases for the time being
af9feb9 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
5f5619f [Zhan Zhang] restructure the directory and different hive version support
05d3683 [Zhan Zhang] solve conflicts
e4c1982 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
94b4fdc [Zhan Zhang] Spark-2706: hive-0.13.1 support on spark
87ebf3b [Zhan Zhang] Merge branch 'master' into spark-2706
921e914 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
f896b2a [Zhan Zhang] Merge branch 'master' into spark-2706
789ea21 [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
cb53a2c [Zhan Zhang] Merge branch 'master' of https://github.com/apache/spark
f6a8a40 [Zhan Zhang] revert
ba14f28 [Zhan Zhang] test
dbedff3 [Zhan Zhang] Merge remote-tracking branch 'upstream/master'
70964fe [Zhan Zhang] revert
fe0f379 [Zhan Zhang] Merge branch 'master' of https://github.com/zhzhan/spark
70ffd93 [Zhan Zhang] revert
42585ec [Zhan Zhang] test
7d5fce2 [Zhan Zhang] test
2014-10-24 14:03:17 -04:00
|
|
|
BUILD_MVN_PROFILE_ARGS="$SBT_MAVEN_PROFILES_ARGS -Phive -Phive-0.12.0"
|
2014-09-17 15:44:44 -04:00
|
|
|
|
|
|
|
|
|
|
|
# NOTE: echo "q" is needed because sbt on encountering a build file with failure
|
|
|
|
#+ (either resolution or compilation) prompts the user for input either q, r, etc
|
|
|
|
#+ to quit or retry. This echo is there to make it not block.
|
2014-10-31 14:27:59 -04:00
|
|
|
# NOTE: Do not quote $BUILD_MVN_PROFILE_ARGS or else it will be interpreted as a
|
2014-09-19 18:44:47 -04:00
|
|
|
#+ single argument!
|
2014-09-17 15:44:44 -04:00
|
|
|
# QUESTION: Why doesn't 'yes "q"' work?
|
|
|
|
# QUESTION: Why doesn't 'grep -v -e "^\[info\] Resolving"' work?
|
2014-10-31 14:27:59 -04:00
|
|
|
# First build with 0.12 to ensure patches do not break the hive 12 build
|
|
|
|
echo "[info] Compile with hive 0.12"
|
2014-09-17 15:44:44 -04:00
|
|
|
echo -e "q\n" \
|
2014-10-31 14:27:59 -04:00
|
|
|
| sbt/sbt $BUILD_MVN_PROFILE_ARGS clean hive/compile hive-thriftserver/compile \
|
|
|
|
| grep -v -e "info.*Resolving" -e "warn.*Merging" -e "info.*Including"
|
|
|
|
|
|
|
|
# Then build with default version(0.13.1) because tests are based on this version
|
|
|
|
echo "[info] Building Spark with these arguments: $SBT_MAVEN_PROFILES_ARGS -Phive"
|
|
|
|
echo -e "q\n" \
|
|
|
|
| sbt/sbt $SBT_MAVEN_PROFILES_ARGS -Phive package assembly/assembly \
|
2014-09-17 15:44:44 -04:00
|
|
|
| grep -v -e "info.*Resolving" -e "warn.*Merging" -e "info.*Including"
|
|
|
|
}
|
2014-08-06 15:58:24 -04:00
|
|
|
|
|
|
|
echo ""
|
2014-02-13 01:35:09 -05:00
|
|
|
echo "========================================================================="
|
|
|
|
echo "Running Spark unit tests"
|
|
|
|
echo "========================================================================="
|
2014-07-30 17:31:20 -04:00
|
|
|
|
2014-10-06 17:19:06 -04:00
|
|
|
CURRENT_BLOCK=$BLOCK_SPARK_UNIT_TESTS
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
{
|
|
|
|
# If the Spark SQL tests are enabled, run the tests with the Hive profiles enabled.
|
2014-09-17 18:14:04 -04:00
|
|
|
# This must be a single argument, as it is.
|
2014-09-17 15:44:44 -04:00
|
|
|
if [ -n "$_RUN_SQL_TESTS" ]; then
|
2014-10-24 21:36:35 -04:00
|
|
|
SBT_MAVEN_PROFILES_ARGS="$SBT_MAVEN_PROFILES_ARGS -Phive"
|
2014-09-17 15:44:44 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$_SQL_TESTS_ONLY" ]; then
|
2014-09-17 18:14:04 -04:00
|
|
|
# This must be an array of individual arguments. Otherwise, having one long string
|
|
|
|
#+ will be interpreted as a single test, which doesn't work.
|
2014-11-04 01:29:48 -05:00
|
|
|
SBT_MAVEN_TEST_ARGS=("catalyst/test" "sql/test" "hive/test" "mllib/test")
|
2014-09-17 15:44:44 -04:00
|
|
|
else
|
2014-09-17 18:14:04 -04:00
|
|
|
SBT_MAVEN_TEST_ARGS=("test")
|
2014-09-17 15:44:44 -04:00
|
|
|
fi
|
|
|
|
|
2014-09-17 18:14:04 -04:00
|
|
|
echo "[info] Running Spark tests with these arguments: $SBT_MAVEN_PROFILES_ARGS ${SBT_MAVEN_TEST_ARGS[@]}"
|
2014-09-17 15:44:44 -04:00
|
|
|
|
|
|
|
# NOTE: echo "q" is needed because sbt on encountering a build file with failure
|
|
|
|
#+ (either resolution or compilation) prompts the user for input either q, r, etc
|
|
|
|
#+ to quit or retry. This echo is there to make it not block.
|
2014-09-19 18:44:47 -04:00
|
|
|
# NOTE: Do not quote $SBT_MAVEN_PROFILES_ARGS or else it will be interpreted as a
|
|
|
|
#+ single argument!
|
|
|
|
#+ "${SBT_MAVEN_TEST_ARGS[@]}" is cool because it's an array.
|
2014-09-17 15:44:44 -04:00
|
|
|
# QUESTION: Why doesn't 'yes "q"' work?
|
|
|
|
# QUESTION: Why doesn't 'grep -v -e "^\[info\] Resolving"' work?
|
|
|
|
echo -e "q\n" \
|
2014-09-19 18:44:47 -04:00
|
|
|
| sbt/sbt $SBT_MAVEN_PROFILES_ARGS "${SBT_MAVEN_TEST_ARGS[@]}" \
|
2014-09-17 15:44:44 -04:00
|
|
|
| grep -v -e "info.*Resolving" -e "warn.*Merging" -e "info.*Including"
|
|
|
|
}
|
2014-02-13 01:35:09 -05:00
|
|
|
|
2014-08-06 15:58:24 -04:00
|
|
|
echo ""
|
2014-02-13 01:35:09 -05:00
|
|
|
echo "========================================================================="
|
|
|
|
echo "Running PySpark tests"
|
|
|
|
echo "========================================================================="
|
2014-10-06 17:19:06 -04:00
|
|
|
|
|
|
|
CURRENT_BLOCK=$BLOCK_PYSPARK_UNIT_TESTS
|
|
|
|
|
2014-02-13 01:35:09 -05:00
|
|
|
./python/run-tests
|
2014-03-25 00:20:23 -04:00
|
|
|
|
2014-08-06 15:58:24 -04:00
|
|
|
echo ""
|
2014-03-25 00:20:23 -04:00
|
|
|
echo "========================================================================="
|
|
|
|
echo "Detecting binary incompatibilites with MiMa"
|
|
|
|
echo "========================================================================="
|
2014-10-06 17:19:06 -04:00
|
|
|
|
|
|
|
CURRENT_BLOCK=$BLOCK_MIMA
|
|
|
|
|
2014-09-17 15:44:44 -04:00
|
|
|
./dev/mima
|