|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# |
| 4 | +# Licensed to the Apache Software Foundation (ASF) under one or more |
| 5 | +# contributor license agreements. See the NOTICE file distributed with |
| 6 | +# this work for additional information regarding copyright ownership. |
| 7 | +# The ASF licenses this file to You under the Apache License, Version 2.0 |
| 8 | +# (the "License"); you may not use this file except in compliance with |
| 9 | +# the License. You may obtain a copy of the License at |
| 10 | +# |
| 11 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +# |
| 13 | +# Unless required by applicable law or agreed to in writing, software |
| 14 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +# See the License for the specific language governing permissions and |
| 17 | +# limitations under the License. |
| 18 | +# |
| 19 | + |
| 20 | +# Figure out where Spark is installed |
| 21 | +FWDIR="$(cd `dirname $0`/..; pwd)" |
| 22 | + |
| 23 | +# Find the java binary |
| 24 | +if [ -n "${JAVA_HOME}" ]; then |
| 25 | + RUNNER="${JAVA_HOME}/bin/java" |
| 26 | +else |
| 27 | + if [ `command -v java` ]; then |
| 28 | + RUNNER="java" |
| 29 | + else |
| 30 | + echo "JAVA_HOME is not set" >&2 |
| 31 | + exit 1 |
| 32 | + fi |
| 33 | +fi |
| 34 | + |
| 35 | +# Compute classpath using external script |
| 36 | +classpath_output=$($FWDIR/bin/compute-classpath.sh) |
| 37 | +if [[ "$?" != "0" ]]; then |
| 38 | + echo "$classpath_output" |
| 39 | + exit 1 |
| 40 | +else |
| 41 | + CLASSPATH=$classpath_output |
| 42 | +fi |
| 43 | + |
| 44 | +CLASS="org.apache.hive.beeline.BeeLine" |
| 45 | +exec "$RUNNER" -cp "$CLASSPATH" $CLASS "$@" |
0 commit comments