Skip to content

Commit

Permalink
Check for the presence of presto libraries only when sql commands are…
Browse files Browse the repository at this point in the history
… used (apache#5883)

Co-authored-by: Sijie Guo <[email protected]>
  • Loading branch information
srkukarni and sijie committed Jan 24, 2020
1 parent 648ed0e commit ec122ed
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions bin/pulsar
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,18 @@ if [ ! -f "${PY_INSTANCE_FILE}" ]; then
fi

# find pulsar sql presto distribution location
if [ ! -d "${PRESTO_HOME}" ]; then

BUILT_PRESTO_HOME="${SQL_HOME}/presto-distribution/target/pulsar-presto-distribution"
if [ ! -d "${BUILT_PRESTO_HOME}" ]; then
echo "\nCouldn't find presto distribution.";
echo "Make sure you've run 'mvn package'\n";
exit 1;
check_presto_libraries() {
if [ ! -d "${PRESTO_HOME}" ]; then

BUILT_PRESTO_HOME="${SQL_HOME}/presto-distribution/target/pulsar-presto-distribution"
if [ ! -d "${BUILT_PRESTO_HOME}" ]; then
echo "\nCouldn't find presto distribution.";
echo "Make sure you've run 'mvn package'\n";
exit 1;
fi
PRESTO_HOME=${BUILT_PRESTO_HOME}
fi
PRESTO_HOME=${BUILT_PRESTO_HOME}
fi
}

pulsar_help() {
cat <<EOF
Expand Down Expand Up @@ -345,8 +347,10 @@ elif [ $COMMAND == "broker-tool" ]; then
elif [ $COMMAND == "compact-topic" ]; then
exec $JAVA $OPTS org.apache.pulsar.compaction.CompactorTool --broker-conf $PULSAR_BROKER_CONF $@
elif [ $COMMAND == "sql" ]; then
check_presto_libraries
exec $JAVA -cp "${PRESTO_HOME}/lib/*" com.facebook.presto.cli.Presto --server localhost:8081 "${@}"
elif [ $COMMAND == "sql-worker" ]; then
check_presto_libraries
exec ${PRESTO_HOME}/bin/launcher --etc-dir ${PULSAR_PRESTO_CONF} "${@}"
elif [ $COMMAND == "tokens" ]; then
exec $JAVA $OPTS org.apache.pulsar.utils.auth.tokens.TokensCliUtils $@
Expand Down

0 comments on commit ec122ed

Please sign in to comment.