|
17 | 17 | # limitations under the License.
|
18 | 18 | #
|
19 | 19 |
|
| 20 | +SCALA_VERSION=2.10 |
| 21 | + |
| 22 | +cygwin=false |
| 23 | +case "`uname`" in |
| 24 | + CYGWIN*) cygwin=true;; |
| 25 | +esac |
| 26 | + |
| 27 | +# Enter posix mode for bash |
| 28 | +set -o posix |
| 29 | + |
20 | 30 | # Figure out where Spark is installed
|
21 | 31 | FWDIR="$(cd `dirname $0`/..; pwd)"
|
22 | 32 |
|
| 33 | +ASSEMBLY_DIR="$FWDIR/assembly/target/scala-$SCALA_VERSION" |
| 34 | + |
| 35 | +if [ -n "$JAVA_HOME" ]; then |
| 36 | + JAR_CMD="$JAVA_HOME/bin/jar" |
| 37 | +else |
| 38 | + JAR_CMD="jar" |
| 39 | +fi |
| 40 | + |
| 41 | +# Use spark-assembly jar from either RELEASE or assembly directory |
| 42 | +if [ -f "$FWDIR/RELEASE" ]; then |
| 43 | + assembly_folder="$FWDIR"/lib |
| 44 | +else |
| 45 | + assembly_folder="$ASSEMBLY_DIR" |
| 46 | +fi |
| 47 | + |
| 48 | +num_jars=$(ls "$assembly_folder" | grep "spark-assembly.*hadoop.*\.jar" | wc -l) |
| 49 | +if [ "$num_jars" -eq "0" ]; then |
| 50 | + echo "Failed to find Spark assembly in $assembly_folder" |
| 51 | + echo "You need to build Spark before running this program." |
| 52 | + exit 1 |
| 53 | +fi |
| 54 | +if [ "$num_jars" -gt "1" ]; then |
| 55 | + jars_list=$(ls "$assembly_folder" | grep "spark-assembly.*hadoop.*.jar") |
| 56 | + echo "Found multiple Spark assembly jars in $assembly_folder:" |
| 57 | + echo "$jars_list" |
| 58 | + echo "Please remove all but one jar." |
| 59 | + exit 1 |
| 60 | +fi |
| 61 | + |
| 62 | +ASSEMBLY_JAR=$(ls "$assembly_folder"/spark-assembly*hadoop*.jar 2>/dev/null) |
| 63 | + |
| 64 | +# Verify that versions of java used to build the jars and run Spark are compatible |
| 65 | +jar_error_check=$("$JAR_CMD" -tf "$ASSEMBLY_JAR" nonexistent/class/path 2>&1) |
| 66 | +if [[ "$jar_error_check" =~ "invalid CEN header" ]]; then |
| 67 | + echo "Loading Spark jar with '$JAR_CMD' failed. " 1>&2 |
| 68 | + echo "This is likely because Spark was compiled with Java 7 and run " 1>&2 |
| 69 | + echo "with Java 6. (see SPARK-1703). Please use Java 7 to run Spark " 1>&2 |
| 70 | + echo "or build Spark with Java 6." 1>&2 |
| 71 | + exit 1 |
| 72 | +fi |
| 73 | + |
23 | 74 | CLASS="org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver"
|
24 |
| -$FWDIR/bin/spark-class $CLASS $@ |
| 75 | +exec "$FWDIR"/bin/spark-submit --class $CLASS $@ $ASSEMBLY_JAR |
0 commit comments