|
| 1 | +#!/bin/bash |
| 2 | +# |
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 4 | +# or more contributor license agreements. See the NOTICE file |
| 5 | +# distributed with this work for additional information |
| 6 | +# regarding copyright ownership. The ASF licenses this file |
| 7 | +# to you under the Apache License, Version 2.0 (the |
| 8 | +# "License"); you may not use this file except in compliance |
| 9 | +# with 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, |
| 14 | +# software distributed under the License is distributed on an |
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 16 | +# KIND, either express or implied. See the License for the |
| 17 | +# specific language governing permissions and limitations |
| 18 | +# under the License. |
| 19 | +# |
| 20 | + |
| 21 | +set -eux |
| 22 | + |
| 23 | +DIR="$(cd "$(dirname "$0")" && pwd)" |
| 24 | +PARENT_DIR="${DIR}/.." |
| 25 | +MVN_CMD="${PARENT_DIR}/mvnw" |
| 26 | +SPARK_MASTER="${SPARK_MASTER:-local[*]}" |
| 27 | +PROJECT_VERSION=$("${MVN_CMD}" -f "${DIR}/pom.xml" -q help:evaluate -Dexpression=project.version -DforceStdout) |
| 28 | +COMET_SPARK_ARTIFACT_ID=$("${MVN_CMD}" -f "${PARENT_DIR}/spark/pom.xml" -q help:evaluate -Dexpression=project.artifactId -DforceStdout) |
| 29 | +COMET_SPARK_JAR="${PARENT_DIR}/spark/target/${COMET_SPARK_ARTIFACT_ID}-${PROJECT_VERSION}.jar" |
| 30 | +COMET_FUZZ_ARTIFACT_ID=$("${MVN_CMD}" -f "${DIR}/pom.xml" -q help:evaluate -Dexpression=project.artifactId -DforceStdout) |
| 31 | +COMET_FUZZ_JAR="${DIR}/target/${COMET_FUZZ_ARTIFACT_ID}-${PROJECT_VERSION}-jar-with-dependencies.jar" |
| 32 | +NUM_FILES="${NUM_FILES:-2}" |
| 33 | +NUM_ROWS="${NUM_ROWS:-200}" |
| 34 | +NUM_QUERIES="${NUM_QUERIES:-500}" |
| 35 | + |
| 36 | +if [ ! -f "${COMET_SPARK_JAR}" ]; then |
| 37 | + echo "Building Comet Spark jar..." |
| 38 | + pushd "${PARENT_DIR}" |
| 39 | + make |
| 40 | + popd |
| 41 | +else |
| 42 | + echo "Building Fuzz testing jar..." |
| 43 | + "${MVN_CMD}" -f "${DIR}/pom.xml" package -DskipTests |
| 44 | +fi |
| 45 | + |
| 46 | +echo "Generating data..." |
| 47 | +"${SPARK_HOME}/bin/spark-submit" \ |
| 48 | + --master "${SPARK_MASTER}" \ |
| 49 | + --class org.apache.comet.fuzz.Main \ |
| 50 | + "${COMET_FUZZ_JAR}" \ |
| 51 | + data --num-files="${NUM_FILES}" --num-rows="${NUM_ROWS}" \ |
| 52 | + --exclude-negative-zero \ |
| 53 | + --generate-arrays --generate-structs --generate-maps |
| 54 | + |
| 55 | +echo "Generating queries..." |
| 56 | +"${SPARK_HOME}/bin/spark-submit" \ |
| 57 | + --master "${SPARK_MASTER}" \ |
| 58 | + --class org.apache.comet.fuzz.Main \ |
| 59 | + "${COMET_FUZZ_JAR}" \ |
| 60 | + queries --num-files="${NUM_FILES}" --num-queries="${NUM_QUERIES}" |
| 61 | + |
| 62 | +echo "Running fuzz tests..." |
| 63 | +"${SPARK_HOME}/bin/spark-submit" \ |
| 64 | + --master "${SPARK_MASTER}" \ |
| 65 | + --conf spark.memory.offHeap.enabled=true \ |
| 66 | + --conf spark.memory.offHeap.size=16G \ |
| 67 | + --conf spark.plugins=org.apache.spark.CometPlugin \ |
| 68 | + --conf spark.comet.enabled=true \ |
| 69 | + --conf spark.shuffle.manager=org.apache.spark.sql.comet.execution.shuffle.CometShuffleManager \ |
| 70 | + --conf spark.comet.exec.shuffle.enabled=true \ |
| 71 | + --jars "${COMET_SPARK_JAR}" \ |
| 72 | + --conf spark.driver.extraClassPath="${COMET_SPARK_JAR}" \ |
| 73 | + --conf spark.executor.extraClassPath="${COMET_SPARK_JAR}" \ |
| 74 | + --class org.apache.comet.fuzz.Main \ |
| 75 | + "${COMET_FUZZ_JAR}" \ |
| 76 | + run --num-files="${NUM_FILES}" --filename="queries.sql" |
0 commit comments