Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More windows-related fixes #126

Merged
merged 9 commits into from
Oct 11, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions export/planloader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
add_library(planloader SHARED planloader.cpp)

add_dependencies(planloader substrait_io)
8 changes: 6 additions & 2 deletions src/substrait/common/tests/IoTest.cpp
Original file line number Diff line number Diff line change
@@ -7,7 +7,10 @@
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include <protobuf-matchers/protocol-buffer-matchers.h>

#ifndef _WIN32
#include <unistd.h>
#endif

using ::protobuf_matchers::EqualsProto;
using ::protobuf_matchers::Partially;
@@ -45,8 +48,9 @@ TEST_F(IoTest, LoadMissingFile) {
class SaveAndLoadTestFixture : public ::testing::TestWithParam<PlanFileFormat> {
public:
void SetUp() override {
testFileDirectory_ = std::filesystem::temp_directory_path() /
std::filesystem::path("my_temp_dir");
testFileDirectory_ = (std::filesystem::temp_directory_path() /
std::filesystem::path("my_temp_dir"))
.string();

if (!std::filesystem::create_directory(testFileDirectory_)) {
ASSERT_TRUE(false) << "Failed to create temporary directory.";
7 changes: 5 additions & 2 deletions src/substrait/textplan/converter/LoadBinary.cpp
Original file line number Diff line number Diff line change
@@ -23,10 +23,13 @@ namespace {

class StringErrorCollector : public google::protobuf::io::ErrorCollector {
public:
void AddError(int line, int column, const std::string& message) override {
void RecordError(
int line,
google::protobuf::io::ColumnNumber column,
absl::string_view message) override {
errors_.push_back(
std::to_string(line + 1) + ":" + std::to_string(column + 1) + " → " +
message);
std::string(message));
}

[[nodiscard]] std::vector<std::string> getErrors() const {
2 changes: 1 addition & 1 deletion src/substrait/textplan/converter/ReferenceNormalizer.cpp
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ bool compareExtensionFunctions(
return make_tuple(
// First sort so that extension functions precede any other kind of
// extension.
not decl.has_extension_function(),
!decl.has_extension_function(),
// Next sort by space.
decl.extension_function().extension_uri_reference(),
// Finally sort by name within a space.
11 changes: 6 additions & 5 deletions src/substrait/textplan/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -36,12 +36,13 @@ target_link_libraries(
absl::status
absl::statusor)

add_executable(planparser Tool.cpp)

target_link_libraries(planparser substrait_textplan_loader error_listener)
if(UNIX)
add_executable(planparser Tool.cpp)
target_link_libraries(planparser substrait_textplan_loader error_listener)
install(TARGETS planparser EXPORT SubstraitTargets)
endif()
install(TARGETS substrait_textplan_loader EXPORT SubstraitTargets)

if(${SUBSTRAIT_CPP_BUILD_TESTING})
add_subdirectory(tests)
endif()

install(TARGETS planparser substrait_textplan_loader EXPORT SubstraitTargets)
15 changes: 12 additions & 3 deletions src/substrait/textplan/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -39,6 +39,9 @@ add_test_case(

cmake_path(GET CMAKE_CURRENT_SOURCE_DIR PARENT_PATH TEXTPLAN_SOURCE_DIR)

# Get all JSON files in the data directory
file(GLOB JSON_FILES "${TEXTPLAN_SOURCE_DIR}/data/*.json")

add_custom_command(
TARGET substrait_textplan_round_trip_test
POST_BUILD
@@ -48,9 +51,15 @@ add_custom_command(
COMMAND
${CMAKE_COMMAND} -E copy
"${TEXTPLAN_SOURCE_DIR}/converter/data/q6_first_stage.json"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/data/q6_first_stage.json"
COMMAND ${CMAKE_COMMAND} -E copy "${TEXTPLAN_SOURCE_DIR}/data/*.json"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/data/")
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/data/q6_first_stage.json")

foreach(json_file ${TEXTPLAN_JSON_FILES})
add_custom_command(
TARGET substrait_textplan_round_trip_test
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy "${json_file}"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/data/")
endforeach()

message(
STATUS "test data will be here: ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests/data"
2 changes: 1 addition & 1 deletion src/substrait/textplan/tests/RoundtripTest.cpp
Original file line number Diff line number Diff line change
@@ -59,7 +59,7 @@ std::vector<std::string> getTestCases() {
testDataPath.append("data");
for (auto const& dirEntry :
std::filesystem::recursive_directory_iterator{testDataPath}) {
std::string pathName = dirEntry.path();
std::string pathName = dirEntry.path().string();
if (endsWith(pathName, ".json") &&
!endsWith(pathName, "q6_first_stage.json")) {
filenames.push_back(pathName);
2 changes: 1 addition & 1 deletion third_party/protobuf.cmake
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ FetchContent_Declare(GTest
)
FetchContent_Declare(Protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG v23.4
GIT_TAG v28.2
OVERRIDE_FIND_PACKAGE
)
set(protobuf_BUILD_TESTS OFF CACHE INTERNAL "")