DBToaster query runner utility: add query set handling
@@ -5,10 +5,11 @@ set -e
QUERY_NUMBER=$1
ACTION=${2:-'run'} # supply jar to generate JAR file
+QUERY_SET=${3:-'bi'} # give the query set name, defaults to bi
DBTOASTER_BIN=${DBTOASTER_BIN:-$HOME/bin/dbtoaster/bin/dbtoaster}
if [ "${QUERY_NUMBER}x" == "x" ]; then
- echo 1>&2 "ERROR: No query number was provided. Provide bi query number as first argument, e.g. '$0 1'"
+ echo 1>&2 "ERROR: No query number was provided. Provide ${QUERY_SET} query number as first argument, e.g. '$0 1'"
exit -2
fi
@@ -17,13 +18,13 @@ TMP_SQL_SCRIPT=$(mktemp)
cat >$TMP_SQL_SCRIPT <<HERE
INCLUDE 'schema.sql';
-INCLUDE 'queries/bi-${QUERY_NUMBER}.sql';
+INCLUDE 'queries/${QUERY_SET}-${QUERY_NUMBER}.sql';
HERE
if [ "${ACTION}x" == "runx" ]; then
${DBTOASTER_BIN} -l scala -r $TMP_SQL_SCRIPT
elif [ "${ACTION}x" == "jarx" ]; then
- ${DBTOASTER_BIN} -l scala -c target/ldbc-bi-q${QUERY_NUMBER}.jar -n biQ${QUERY_NUMBER} $TMP_SQL_SCRIPT
+ ${DBTOASTER_BIN} -l scala -c target/ldbc-${QUERY_SET}-q${QUERY_NUMBER}.jar -n ${QUERY_SET}Q${QUERY_NUMBER} $TMP_SQL_SCRIPT
else
echo "ERROR: invalid action encountered: ${ACTION} Use run (this is the default, when omitted) or jar to run the query or generate jar, respectively."
fi
