Skip to content

Commit daee105

Browse files
committed
Fixed usage messages of all Spark SQL related scripts
1 parent 1aad911 commit daee105

File tree

4 files changed

+32
-27
lines changed

4 files changed

+32
-27
lines changed

bin/beeline

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,14 @@
1717
# limitations under the License.
1818
#
1919

20-
# Figure out where Spark is installed
21-
FWDIR="$(cd `dirname $0`/..; pwd)"
20+
#
21+
# Shell script for starting BeeLine
2222

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
23+
# Enter posix mode for bash
24+
set -o posix
3425

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
26+
# Figure out where Spark is installed
27+
FWDIR="$(cd `dirname $0`/..; pwd)"
4328

4429
CLASS="org.apache.hive.beeline.BeeLine"
45-
exec "$RUNNER" -cp "$CLASSPATH" $CLASS "$@"
30+
exec "$FWDIR/bin/spark-class" $CLASS "$@"

bin/spark-sql

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,24 @@
2323
# Enter posix mode for bash
2424
set -o posix
2525

26+
CLASS="org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver"
27+
2628
# Figure out where Spark is installed
2729
FWDIR="$(cd `dirname $0`/..; pwd)"
2830

2931
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
30-
echo "Usage: ./sbin/spark-sql [options]"
32+
echo "Usage: ./sbin/spark-sql [options] [cli option]"
33+
pattern="usage"
34+
pattern+="\|Spark assembly has been built with Hive"
35+
pattern+="\|NOTE: SPARK_PREPEND_CLASSES is set"
36+
pattern+="\|Spark Command: "
37+
pattern+="\|======="
38+
3139
$FWDIR/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
40+
echo
41+
echo "CLI options:"
42+
$FWDIR/bin/spark-class $CLASS --help 2>&1 | grep -v "$pattern" 1>&2
3243
exit 0
3344
fi
3445

35-
CLASS="org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver"
3646
exec "$FWDIR"/bin/spark-submit --class $CLASS spark-internal $@

sbin/start-thriftserver.sh

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,22 @@ set -o posix
2626
# Figure out where Spark is installed
2727
FWDIR="$(cd `dirname $0`/..; pwd)"
2828

29+
CLASS="org.apache.spark.sql.hive.thriftserver.HiveThriftServer2"
30+
2931
if [[ "$@" = *--help ]] || [[ "$@" = *-h ]]; then
30-
echo "Usage: ./sbin/start-thriftserver [options]"
32+
echo "Usage: ./sbin/start-thriftserver [options] [thrift server options]"
33+
pattern="usage"
34+
pattern+="\|Spark assembly has been built with Hive"
35+
pattern+="\|NOTE: SPARK_PREPEND_CLASSES is set"
36+
pattern+="\|Spark Command: "
37+
pattern+="\|======="
38+
pattern+="\|--help"
39+
3140
$FWDIR/bin/spark-submit --help 2>&1 | grep -v Usage 1>&2
41+
echo
42+
echo "Thrift server options:"
43+
$FWDIR/bin/spark-class $CLASS --help 2>&1 | grep -v "$pattern" 1>&2
3244
exit 0
3345
fi
3446

35-
CLASS="org.apache.spark.sql.hive.thriftserver.HiveThriftServer2"
3647
exec "$FWDIR"/bin/spark-submit --class $CLASS spark-internal $@

sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/HiveThriftServer2.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ private[hive] object HiveThriftServer2 extends Logging {
4040
val optionsProcessor = new ServerOptionsProcessor("HiveThriftServer2")
4141

4242
if (!optionsProcessor.process(args)) {
43-
logWarning("Error starting HiveThriftServer2 with given arguments")
4443
System.exit(-1)
4544
}
4645

0 commit comments

Comments
 (0)