-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
455 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (c) Facebook, Inc. and its affiliates. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
find_package(c-ares CONFIG) | ||
if(c-ares_FOUND) | ||
if(TARGET c-ares::cares) | ||
return() | ||
endif() | ||
endif() | ||
|
||
find_path( | ||
C_ARES_INCLUDE_DIR | ||
NAMES ares.h | ||
PATH_SUFFIXES c-ares) | ||
find_library(C_ARES_LIBRARY NAMES c-ares) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(c-ares DEFAULT_MSG C_ARES_LIBRARY | ||
C_ARES_INCLUDE_DIR) | ||
|
||
if(c-ares_FOUND AND NOT TARGET c-ares::cares) | ||
add_library(c-ares::cares UNKNOWN IMPORTED) | ||
set_target_properties( | ||
cares::cares | ||
PROPERTIES IMPORTED_LOCATION "${C_ARES_LIBRARY}" | ||
INTERFACE_INCLUDE_DIRECTORIES "${C_ARES_INCLUDE_DIR}") | ||
endif() | ||
|
||
mark_as_advanced(C_ARES_INCLUDE_DIR C_ARES_LIBRARY) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
================== | ||
Spark Query Runner | ||
================== | ||
|
||
Introduction | ||
------------ | ||
|
||
The Spark Query Runner is a tool designed to facilitate the testing of Velox. | ||
It achieves this by executing SQL queries on Apache Spark and comparing the results | ||
with those produced by Velox. It helps ensure the correctness of Velox's computing | ||
against Spark and provides a method for identifying potential issues in Velox's | ||
implementation. Currently Spark-3.5.1 is used in Velox. | ||
|
||
How It Works | ||
------------ | ||
|
||
The Spark Query Runner operates by executing given SQL queries on both Spark and Velox. | ||
The results from both systems are then compared to check for any differences. | ||
If the results match, it indicates that Velox is producing the correct output. | ||
If the results differ, it suggests a potential issue in Velox that needs to be | ||
investigated. | ||
|
||
Since Spark 3.4, Spark Connect has introduced a decoupled client-server architecture | ||
for Spark that allows remote connectivity to Spark clusters. From the client | ||
perspective, Spark Connect mostly behaves as any other gRPC client, which is polyglot | ||
and and cross-platforms. During execution, the Spark Connect endpoint embedded on the | ||
Spark Server receives and translates unresolved logical plans into Spark’s logical plan | ||
operators. From there, the standard Spark execution process kicks in, ensuring that | ||
Spark Connect leverages all of Spark’s optimizations and enhancements. Results are | ||
streamed back to the client through gRPC as Apache Arrow-encoded row batches. | ||
|
||
In the Spark Query Runner, we use Spark Connect to submit queries to Spark and fetch | ||
the results back to Velox for comparison. The steps for this process are as follows: | ||
|
||
1. Provide the Spark SQL query to be executed. The query could be generated from Velox | ||
plan node or manually written. | ||
2. Create a protobuf message `ExecutePlanRequest` from the SQL query. The protocols | ||
used by Spark Connect are defined in `Apache Spark <https://github.com/apache/spark/tree/v3.5.1/connector/connect/common/src/main/protobuf/spark/connect>`_. | ||
3. Submit the message to SparkConnectService through gRPC API `ExecutePlan`. | ||
4. Fetch Spark's results from execution response. Results are in Arrow IPC stream format, | ||
and can be read as Arrow RecordBatch by `arrow::ipc::RecordBatchReader`. | ||
5. Convert Arrow RecordBatch as Velox vector for comparison with Velox's results. | ||
|
||
Usage | ||
----- | ||
|
||
To use the Spark Query Runner, you will need to deploy an executable Spark and start the | ||
Spark Connect server with below command. | ||
|
||
.. code-block:: | ||
"$SPARK_HOME"/sbin/start-connect-server.sh --jars "$JAR_PATH"/spark-connect_2.12-3.5.1.jar | ||
The jar of Spark Connect could be downloaded from `maven repository <https://repo1.maven.org/maven2/org/apache/spark/spark-connect_2.12/3.5.1/>`_. | ||
If Spark Connect server is started successfully, you can see log as below. The server will | ||
be started at `localhost:15002`. | ||
|
||
.. code-block:: | ||
INFO SparkConnectServer: Spark Connect server started at: 0:0:0:0:0:0:0:0%0:15002 | ||
You can then provide the Spark Query Runner with the SQL query and the data to run the | ||
query on. The tool will execute the query on Spark and return results as Velox vectors. | ||
|
||
To run fuzzer test with Spark Query Runner, you can download the spark-server docker image | ||
`ghcr.io/facebookincubator/velox-dev:spark-server` and run below command to start Spark | ||
connect server in it. | ||
|
||
.. code-block:: | ||
bash /opt/start-spark.sh | ||
Currently to use Spark as reference DB is only supported in aggregate fuzzer test. You can | ||
trigger its test referring to :doc:`Fuzzer <fuzzer>` and the results will be verified against Spark. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.