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

Fix mac build #2204

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
18 changes: 14 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ set(CMAKE_FIND_PACKAGE_RESOLVE_SYMLINKS TRUE)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
if(NOT APPLE)
acquamarin marked this conversation as resolved.
Show resolved Hide resolved
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
endif()

# Detect OS and architecture, copied from DuckDB
set(OS_NAME "unknown")
Expand Down Expand Up @@ -156,10 +158,18 @@ endfunction()
function(add_kuzu_api_test TEST_NAME)
set(SRCS ${ARGN})
add_executable(${TEST_NAME} ${SRCS})
target_link_libraries(${TEST_NAME} PRIVATE api_graph_test api_test_helper)
if(APPLE)
target_link_libraries(${TEST_NAME} PRIVATE test_helper test_runner graph_test)
else()
target_link_libraries(${TEST_NAME} PRIVATE api_graph_test api_test_helper)
endif()
target_include_directories(${TEST_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/test/include)
include(GoogleTest)
gtest_discover_tests(${TEST_NAME})
if(APPLE)
gtest_discover_tests(${TEST_NAME} DISCOVERY_TIMEOUT 600 DISCOVERY_MODE PRE_TEST)
else()
gtest_discover_tests(${TEST_NAME})
endif()
endfunction()

add_definitions(-DKUZU_ROOT_DIRECTORY="${PROJECT_SOURCE_DIR}")
Expand Down
2 changes: 1 addition & 1 deletion src/processor/operator/persistent/reader/csv/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ static bool tryCastStringToStruct(const char* input, uint64_t len, ValueVector*
skipWhitespace(++input, end);

copyStringToVector(StructVector::getFieldVector(vector, fieldIdx).get(), rowToAdd,
std::string_view{valStart, valEnd}, csvReaderConfig);
std::string_view{valStart, (size_t)(valEnd - valStart)}, csvReaderConfig);
acquamarin marked this conversation as resolved.
Show resolved Hide resolved
}
return true;
}
Expand Down
25 changes: 14 additions & 11 deletions src/storage/store/column_chunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void ColumnChunk::initializeBuffer(offset_t capacity_) {
bufferSize = getBufferSize();
buffer = std::make_unique<uint8_t[]>(bufferSize);
if (nullChunk) {
static_cast<ColumnChunk*>(nullChunk.get())->initializeBuffer(capacity);
nullChunk->initializeBuffer(capacity_);
}
}

Expand Down Expand Up @@ -250,16 +250,19 @@ void ColumnChunk::write(const Value& val, uint64_t posToWrite) {
}

void ColumnChunk::resize(uint64_t newCapacity) {
capacity = newCapacity;
auto numBytesAfterResize = getBufferSize();
assert(numBytesAfterResize > bufferSize);
auto resizedBuffer = std::make_unique<uint8_t[]>(numBytesAfterResize);
if (dataType.getPhysicalType() == common::PhysicalTypeID::BOOL) {
memset(resizedBuffer.get(), 0 /* non null */, numBytesAfterResize);
}
memcpy(resizedBuffer.get(), buffer.get(), bufferSize);
bufferSize = numBytesAfterResize;
buffer = std::move(resizedBuffer);
if (numBytesPerValue != 0) {
// Avoid resizing struct/serial columns.
capacity = newCapacity;
auto numBytesAfterResize = getBufferSize();
assert(numBytesAfterResize > bufferSize);
auto resizedBuffer = std::make_unique<uint8_t[]>(numBytesAfterResize);
if (dataType.getPhysicalType() == common::PhysicalTypeID::BOOL) {
memset(resizedBuffer.get(), 0 /* non null */, numBytesAfterResize);
}
memcpy(resizedBuffer.get(), buffer.get(), bufferSize);
bufferSize = numBytesAfterResize;
buffer = std::move(resizedBuffer);
}
if (nullChunk) {
nullChunk->resize(newCapacity);
}
Expand Down