Skip to content

Commit ef16954

Browse files
peterenescumeta-codesync[bot]
authored andcommitted
feat: Support VeloxQueryRunner in Github Expression Fuzzer (facebookincubator#15483)
Summary: Pull Request resolved: facebookincubator#15483 Add Regression Fuzzer (i.e. Expression Fuzzer with LocalRunnerService as a source-of-truth) to Fuzzer Job test suite. This fuzzer sends serialized plans to a thrift service build on the base commit to test solely on new changes. Differential Revision: D86911550
1 parent def7506 commit ef16954

File tree

6 files changed

+244
-63
lines changed

6 files changed

+244
-63
lines changed

.github/workflows/scheduled.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,13 @@ jobs:
383383
path: velox/_build/debug/velox/exec/fuzzer/velox_spatial_join_fuzzer
384384
retention-days: ${{ env.RETENTION }}
385385

386+
- name: Upload local runner service runner
387+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
388+
with:
389+
name: local_runner_service_runner
390+
path: velox/_build/debug/velox/exec/fuzzer/velox_local_runner_service_runner
391+
retention-days: ${{ env.RETENTION }}
392+
386393
presto-fuzzer-run:
387394
name: Presto Fuzzer
388395
if: ${{ needs.compile.outputs.presto_bias != 'true' }}
@@ -459,6 +466,96 @@ jobs:
459466
path: |
460467
/tmp/fuzzer_repro
461468
469+
presto-fuzzer-with-local-runner-run:
470+
name: Presto Fuzzer with Local Runner
471+
if: ${{ needs.compile.outputs.presto_bias != 'true' }}
472+
runs-on: ubuntu-latest
473+
container: ghcr.io/facebookincubator/velox-dev:centos9
474+
needs: compile
475+
timeout-minutes: 120
476+
steps:
477+
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
478+
if: github.event_name == 'pull_request'
479+
id: changes
480+
with:
481+
filters: |
482+
presto:
483+
- 'velox/expression/!(test)**'
484+
- 'velox/exec/!(test)**'
485+
- 'velox/common/!(test)**'
486+
- 'velox/core/!(test)**'
487+
- 'velox/vector/!(test)**'
488+
489+
- name: Set presto specific fuzzer duration
490+
env:
491+
# Run for 30 minutes instead of 15, when files relevant to presto are touched
492+
pr_duration: ${{ steps.changes.outputs.presto == 'true' && 1800 || 900 }}
493+
# Run for 60 minutes if its a scheduled run
494+
other_duration: ${{ inputs.duration || (github.event_name == 'push' && 1800 || 3600) }}
495+
is_pr: ${{ github.event_name == 'pull_request' }}
496+
run: |
497+
if [ "$is_pr" == "true" ]; then
498+
duration=$pr_duration
499+
else
500+
duration=$other_duration
501+
fi
502+
503+
echo "DURATION=$duration" >> $GITHUB_ENV
504+
505+
- name: Download presto fuzzer
506+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
507+
with:
508+
name: presto
509+
510+
- name: Download local runner service runner
511+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
512+
with:
513+
name: local_runner_service_runner
514+
515+
- name: Run Presto Fuzzer with Local Runner
516+
run: |
517+
mkdir -p /tmp/fuzzer_repro/logs/
518+
chmod -R 777 /tmp/fuzzer_repro
519+
chmod +x velox_expression_fuzzer_test
520+
chmod +x velox_local_runner_service_runner
521+
# Start LocalRunnerService in the background
522+
./velox_local_runner_service_runner > /tmp/fuzzer_repro/logs/local_runner_service.log 2>&1 &
523+
LOCAL_RUNNER_PID=$!
524+
echo "Started LocalRunnerService with PID: ${LOCAL_RUNNER_PID}"
525+
# Sleep for 10 seconds to allow service to start
526+
sleep 10
527+
random_seed=${RANDOM}
528+
echo "Random seed: ${random_seed}"
529+
./velox_expression_fuzzer_test \
530+
--seed ${random_seed} \
531+
--enable_variadic_signatures \
532+
--velox_fuzzer_enable_complex_types \
533+
--velox_fuzzer_enable_decimal_type \
534+
--lazy_vector_generation_ratio 0.2 \
535+
--common_dictionary_wraps_generation_ratio=0.3 \
536+
--velox_fuzzer_enable_column_reuse \
537+
--velox_fuzzer_enable_expression_reuse \
538+
--max_expression_trees_per_step 2 \
539+
--retry_with_try \
540+
--enable_dereference \
541+
--duration_sec $DURATION \
542+
--minloglevel=0 \
543+
--stderrthreshold=2 \
544+
--log_dir=/tmp/fuzzer_repro/logs \
545+
--repro_persist_path=/tmp/fuzzer_repro \
546+
--local_runner_service_url=http://127.0.0.1:9091 \
547+
&& echo -e "\n\nFuzzer run finished successfully."
548+
# Stop the LocalRunnerService
549+
kill $LOCAL_RUNNER_PID || true
550+
551+
- name: Archive production artifacts
552+
if: ${{ !cancelled() }}
553+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
554+
with:
555+
name: presto-fuzzer-with-local-runner-failure-artifacts
556+
path: |
557+
/tmp/fuzzer_repro
558+
462559
presto-sot-fuzzer-run:
463560
name: Expression Fuzzer with Presto SOT
464561
needs: compile
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
include_guard(GLOBAL)
15+
16+
# Fizz is Meta's TLS 1.3 implementation library
17+
# GitHub: https://github.com/facebookincubator/fizz
18+
19+
set(VELOX_FIZZ_BUILD_VERSION "2024.11.18.00")
20+
set(
21+
VELOX_FIZZ_BUILD_SHA256_CHECKSUM
22+
SHA256=0000000000000000000000000000000000000000000000000000000000000000
23+
)
24+
set(
25+
VELOX_FIZZ_SOURCE_URL
26+
"https://github.com/facebookincubator/fizz/archive/refs/tags/v${VELOX_FIZZ_BUILD_VERSION}.tar.gz"
27+
)
28+
29+
velox_resolve_dependency_url(FIZZ)
30+
31+
message(STATUS "Building fizz from source")
32+
33+
# Fizz depends on folly
34+
velox_set_source(folly)
35+
velox_resolve_dependency(folly CONFIG REQUIRED)
36+
37+
FetchContent_Declare(
38+
fizz
39+
URL ${VELOX_FIZZ_SOURCE_URL}
40+
URL_HASH ${VELOX_FIZZ_BUILD_SHA256_CHECKSUM}
41+
OVERRIDE_FIND_PACKAGE
42+
EXCLUDE_FROM_ALL
43+
)
44+
45+
# Configure fizz build options
46+
set(BUILD_TESTS OFF CACHE BOOL "Build fizz tests")
47+
set(BUILD_EXAMPLES OFF CACHE BOOL "Build fizz examples")
48+
49+
FetchContent_MakeAvailable(fizz)
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Copyright (c) Facebook, Inc. and its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
include_guard(GLOBAL)
15+
16+
# Wangle is Meta's C++ Networking Library
17+
# GitHub: https://github.com/facebook/wangle
18+
19+
set(VELOX_WANGLE_BUILD_VERSION "2024.11.18.00")
20+
set(
21+
VELOX_WANGLE_BUILD_SHA256_CHECKSUM
22+
SHA256=0000000000000000000000000000000000000000000000000000000000000000
23+
)
24+
set(
25+
VELOX_WANGLE_SOURCE_URL
26+
"https://github.com/facebook/wangle/archive/refs/tags/v${VELOX_WANGLE_BUILD_VERSION}.tar.gz"
27+
)
28+
29+
velox_resolve_dependency_url(WANGLE)
30+
31+
message(STATUS "Building wangle from source")
32+
33+
# Wangle depends on folly and fizz
34+
velox_set_source(folly)
35+
velox_resolve_dependency(folly CONFIG REQUIRED)
36+
37+
velox_set_source(fizz)
38+
velox_resolve_dependency(fizz CONFIG REQUIRED)
39+
40+
FetchContent_Declare(
41+
wangle
42+
URL ${VELOX_WANGLE_SOURCE_URL}
43+
URL_HASH ${VELOX_WANGLE_BUILD_SHA256_CHECKSUM}
44+
OVERRIDE_FIND_PACKAGE
45+
EXCLUDE_FROM_ALL
46+
)
47+
48+
# Configure wangle build options
49+
set(BUILD_TESTS OFF CACHE BOOL "Build wangle tests")
50+
set(BUILD_EXAMPLES OFF CACHE BOOL "Build wangle examples")
51+
52+
FetchContent_MakeAvailable(wangle)

CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -639,16 +639,13 @@ if(${VELOX_BUILD_TESTING})
639639
# to be installed on the system, instead of being built by gRPC.
640640
velox_set_source(c-ares)
641641
velox_resolve_dependency(c-ares)
642-
643642
velox_set_source(gRPC)
644643
velox_resolve_dependency(gRPC)
645-
endif()
646644

647-
if(VELOX_ENABLE_REMOTE_FUNCTIONS)
648-
# TODO: Move this to use resolve_dependency(). For some reason, FBThrift
649-
# requires clients to explicitly install fizz and wangle.
650-
find_package(fizz CONFIG REQUIRED)
651-
find_package(wangle CONFIG REQUIRED)
645+
velox_set_source(fizz)
646+
velox_resolve_dependency(fizz CONFIG REQUIRED)
647+
velox_set_source(wangle)
648+
velox_resolve_dependency(wangle CONFIG REQUIRED)
652649
find_package(FBThrift CONFIG REQUIRED)
653650
endif()
654651

velox/exec/fuzzer/CMakeLists.txt

Lines changed: 21 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# LocalRunnerService (for Regression Fuzzer)
16+
include(FBThriftCppLibrary)
17+
add_fbthrift_cpp_library(
18+
local_runner_service_thrift
19+
if/LocalRunnerService.thrift
20+
SERVICES
21+
LocalRunnerService
22+
)
23+
# LocalRunnerService Executable
24+
add_executable(velox_local_runner_service_runner LocalRunnerServiceRunner.cpp)
25+
target_link_libraries(
26+
velox_local_runner_service_runner
27+
velox_local_runner_service_lib
28+
velox_functions_prestosql
29+
gtest
30+
gflags
31+
Folly::folly
32+
)
33+
1534
add_library(
1635
velox_fuzzer_util
1736
ReferenceQueryRunner.cpp
@@ -25,16 +44,9 @@ add_library(
2544
PrestoQueryRunnerToSqlPlanNodeVisitor.cpp
2645
FuzzerUtil.cpp
2746
PrestoSql.cpp
47+
VeloxQueryRunner.cpp
2848
)
2949

30-
# TODO Add VeloxQueryRunner to velox_fuzzer_util to support in
31-
# ExpressionFuzzerTest. More information can be found here:
32-
# https://github.com/facebookincubator/velox/issues/15414
33-
if(VELOX_ENABLE_REMOTE_FUNCTIONS)
34-
target_sources(velox_fuzzer_util PRIVATE VeloxQueryRunner.cpp)
35-
target_link_libraries(velox_fuzzer_util FBThrift::thriftcpp2)
36-
endif()
37-
3850
target_link_libraries(
3951
velox_fuzzer_util
4052
velox_common_fuzzer_util
@@ -50,6 +62,7 @@ target_link_libraries(
5062
velox_dwio_dwrf_writer
5163
velox_dwio_catalog_fbhive
5264
velox_dwio_faulty_file_sink
65+
local_runner_service_thrift
5366
)
5467

5568
add_library(velox_aggregation_fuzzer_base AggregationFuzzerBase.cpp)
@@ -218,53 +231,6 @@ target_link_libraries(
218231
velox_vector_fuzzer
219232
)
220233

221-
# LocalRunnerService (requires FBThrift support)
222-
if(VELOX_ENABLE_REMOTE_FUNCTIONS)
223-
# Generate Thrift library for LocalRunnerService
224-
include(FBThriftCppLibrary)
225-
add_fbthrift_cpp_library(
226-
local_runner_service_thrift
227-
if/LocalRunnerService.thrift
228-
SERVICES
229-
LocalRunnerService
230-
)
231-
232-
target_compile_options(local_runner_service_thrift PRIVATE -Wno-error=deprecated-declarations)
233-
234-
# LocalRunnerService Library
235-
add_library(velox_local_runner_service_lib LocalRunnerService.cpp)
236-
237-
target_link_libraries(
238-
velox_local_runner_service_lib
239-
local_runner_service_thrift
240-
velox_core
241-
velox_exec
242-
velox_exec_test_lib
243-
velox_expression
244-
velox_functions_prestosql
245-
velox_common_base
246-
velox_memory
247-
Folly::folly
248-
FBThrift::thriftcpp2
249-
gflags
250-
glog::glog
251-
)
252-
253-
target_include_directories(velox_local_runner_service_lib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
254-
255-
# LocalRunnerService Executable
256-
add_executable(velox_local_runner_service_runner LocalRunnerServiceRunner.cpp)
257-
258-
target_link_libraries(
259-
velox_local_runner_service_runner
260-
velox_local_runner_service_lib
261-
velox_functions_prestosql
262-
gtest
263-
gflags
264-
Folly::folly
265-
)
266-
endif()
267-
268234
if(${VELOX_BUILD_TESTING})
269235
add_subdirectory(tests)
270236
endif()

0 commit comments

Comments
 (0)