diff --git a/presto-native-execution/presto_cpp/main/CMakeLists.txt b/presto-native-execution/presto_cpp/main/CMakeLists.txt index d86aa5e154052..4183f1be0bb3f 100644 --- a/presto-native-execution/presto_cpp/main/CMakeLists.txt +++ b/presto-native-execution/presto_cpp/main/CMakeLists.txt @@ -16,6 +16,7 @@ add_subdirectory(common) add_subdirectory(thrift) add_subdirectory(connectors) add_subdirectory(functions) +add_subdirectory(tool) add_library(presto_session_properties SessionProperties.cpp) diff --git a/presto-native-execution/presto_cpp/main/tool/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tool/CMakeLists.txt new file mode 100644 index 0000000000000..f8f5bcf1ad4da --- /dev/null +++ b/presto-native-execution/presto_cpp/main/tool/CMakeLists.txt @@ -0,0 +1,16 @@ +# 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. + +# Only build trace tools if Velox trace library is available +if(TARGET velox_query_trace_replayer_base) + add_subdirectory(trace) +endif() diff --git a/presto-native-execution/presto_cpp/main/tool/trace/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tool/trace/CMakeLists.txt new file mode 100644 index 0000000000000..867250fca51c6 --- /dev/null +++ b/presto-native-execution/presto_cpp/main/tool/trace/CMakeLists.txt @@ -0,0 +1,39 @@ +# 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. + +add_library(presto_tool_trace_replayers PartitionAndSerializeReplayer.cpp) + +target_link_libraries( + presto_tool_trace_replayers + presto_operators + velox_core + velox_exec + velox_query_trace_replayer_base +) + +add_executable(presto_trace_replayer TraceReplayerMain.cpp) + +target_link_libraries( + presto_trace_replayer + presto_tool_trace_replayers + presto_operators + presto_type_converter + velox_core + velox_exec + velox_query_trace_replayer_base + ${FOLLY_WITH_DEPENDENCIES} + ${GFLAGS_LIBRARIES} +) + +if(PRESTO_ENABLE_TESTING) + add_subdirectory(tests) +endif() diff --git a/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.cpp b/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.cpp index ae0d9c985f8de..e5bb302fc1963 100644 --- a/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.cpp +++ b/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.cpp @@ -11,11 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - */ #include "presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.h" - #include "presto_cpp/main/operators/PartitionAndSerialize.h" #include "velox/tool/trace/TraceReplayTaskRunner.h" @@ -32,6 +28,7 @@ PartitionAndSerializeReplayer::PartitionAndSerializeReplayer( const std::string& taskId, const std::string& nodeId, const std::string& nodeName, + const std::string& spillBaseDir, const std::string& driverIds, uint64_t queryCapacity, folly::Executor* executor) @@ -41,6 +38,7 @@ PartitionAndSerializeReplayer::PartitionAndSerializeReplayer( taskId, nodeId, nodeName, + spillBaseDir, driverIds, queryCapacity, executor) {} diff --git a/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.h b/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.h index f1cfd1c1d5a75..51882d2ff202f 100644 --- a/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.h +++ b/presto-native-execution/presto_cpp/main/tool/trace/PartitionAndSerializeReplayer.h @@ -11,16 +11,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * Copyright (c) Facebook, Inc. and its affiliates. - */ #pragma once #include "velox/core/PlanNode.h" #include "velox/tool/trace/OperatorReplayerBase.h" namespace facebook::velox::tool::trace { - /// The replayer to replay the traced 'PartitionAndSerialize' operators. class PartitionAndSerializeReplayer final : public OperatorReplayerBase { public: @@ -30,6 +26,7 @@ class PartitionAndSerializeReplayer final : public OperatorReplayerBase { const std::string& taskId, const std::string& nodeId, const std::string& nodeName, + const std::string& spillBaseDir, const std::string& driverIds, uint64_t queryCapacity, folly::Executor* executor); diff --git a/presto-native-execution/presto_cpp/main/tool/trace/TraceReplayerMain.cpp b/presto-native-execution/presto_cpp/main/tool/trace/TraceReplayerMain.cpp index 6d3a2486d86b8..fecf70ddd18cf 100644 --- a/presto-native-execution/presto_cpp/main/tool/trace/TraceReplayerMain.cpp +++ b/presto-native-execution/presto_cpp/main/tool/trace/TraceReplayerMain.cpp @@ -56,6 +56,7 @@ class PrestoTraceReplayRunner FLAGS_task_id, FLAGS_node_id, nodeName, + "", FLAGS_driver_ids, queryCapacityBytes, cpuExecutor_.get()); diff --git a/presto-native-execution/presto_cpp/main/tool/trace/tests/CMakeLists.txt b/presto-native-execution/presto_cpp/main/tool/trace/tests/CMakeLists.txt new file mode 100644 index 0000000000000..e108c349ebdff --- /dev/null +++ b/presto-native-execution/presto_cpp/main/tool/trace/tests/CMakeLists.txt @@ -0,0 +1,40 @@ +# 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. + +add_executable(presto_partition_and_serialize_replayer_test PartitionAndSerializeReplayerTest.cpp) + +target_link_libraries( + presto_partition_and_serialize_replayer_test + presto_tool_trace_replayers + presto_operators + presto_plan_builder + velox_core + velox_exec + velox_exec_test_lib + velox_hive_connector + velox_query_trace_replayer_base + gtest + gtest_main + ${FOLLY_WITH_DEPENDENCIES} + ${GFLAGS_LIBRARIES} +) + +set_property( + TARGET presto_partition_and_serialize_replayer_test + PROPERTY JOB_POOL_LINK presto_link_job_pool +) + +add_test( + NAME presto_partition_and_serialize_replayer_test + COMMAND presto_partition_and_serialize_replayer_test + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/presto-native-execution/presto_cpp/main/tool/trace/tests/PartitionAndSerializeReplayerTest.cpp b/presto-native-execution/presto_cpp/main/tool/trace/tests/PartitionAndSerializeReplayerTest.cpp index ec2fef74eb6f1..7847a4bedfebb 100644 --- a/presto-native-execution/presto_cpp/main/tool/trace/tests/PartitionAndSerializeReplayerTest.cpp +++ b/presto-native-execution/presto_cpp/main/tool/trace/tests/PartitionAndSerializeReplayerTest.cpp @@ -202,6 +202,7 @@ TEST_F(PartitionAndSerializeReplayerTest, basicReplay) { task->taskId(), partitionNodeId, "PartitionAndSerialize", + "", driverIds, queryCapacity, executor_.get());