Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
- name: gcc-release-x86_64
cc: gcc-14
cxx: g++-14
build_args: --build_type Release
build_args: --build_type Release --install_smoke
- name: clang-release-x86_64
build_args: --build_type Release
- name: gcc-debug-x86_64
Expand Down
91 changes: 0 additions & 91 deletions .github/workflows/gcc8_test.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ When changing a public API, check the declaration under `include/paimon/`, its i

The full rules are in [`docs/code-style.md`](docs/code-style.md). In particular:

- Use C++17; do not introduce C++20 or later features.
- Build the implementation with C++20. Keep installed public headers C++17-compatible.
- Use `Status` and `Result<T>` for fallible operations. Do not use exceptions for production error propagation.
- Propagate errors with the project macros, including `PAIMON_RETURN_NOT_OK` and `PAIMON_ASSIGN_OR_RAISE`.
- Use an explicit type, not `auto`, as the declaration in `PAIMON_ASSIGN_OR_RAISE` and `PAIMON_ASSIGN_OR_RAISE_FROM_ARROW`.
Expand Down
19 changes: 7 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
# Adapted from Apache Arrow:
# https://github.com/apache/arrow/blob/apache-arrow-17.0.0/cpp/CMakeLists.txt

cmake_minimum_required(VERSION 3.22)
# 3.22 is the minimum required by Corrosion-rs (used for the Rust<->C++ FFI
# integration, see crates/lance_ffi). Ubuntu 24.04 ships CMake 3.28 and
# CentOS 8+/RHEL 9+ ship 3.20+, so older distributions need a newer CMake
# installation.
# Arrow's bundled Apache Thrift build requires CMake 3.26 or later.
cmake_minimum_required(VERSION 3.26)
message(STATUS "Building using CMake version: ${CMAKE_VERSION}")

# https://cmake.org/cmake/help/latest/policy/CMP0135.html
Expand All @@ -46,7 +43,7 @@ project(paimon

string(TOUPPER "${CMAKE_BUILD_TYPE}" UPPERCASE_BUILD_TYPE)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down Expand Up @@ -286,14 +283,11 @@ enable_testing()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_COMMON_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PAIMON_CXXFLAGS}")

# For any C code, use the same flags. These flags don't contain C++ specific
# flags.
# PAIMON_CXXFLAGS is shared with C builds but can contain a C++ standard flag.
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CXX_COMMON_FLAGS} ${PAIMON_CXXFLAGS}")
string(REGEX REPLACE "(^|[ \t])-std=(c|gnu)\\+\\+[^ \t]+" "" CMAKE_C_FLAGS
"${CMAKE_C_FLAGS}")

# Remove --std=c++17 to avoid errors from C compilers
string(REPLACE "-std=c++17" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})

# Add C++-only flags, like -std=c++11
set(CMAKE_CXX_FLAGS "${CXX_ONLY_FLAGS} ${CMAKE_CXX_FLAGS}")

include(san-config)
Expand Down Expand Up @@ -393,6 +387,7 @@ set(ENV{PAIMON_TEST_DATA} "${CMAKE_SOURCE_DIR}/test/test_data")
if(PAIMON_BUILD_TESTS OR PAIMON_BUILD_BENCHMARKS)
resolve_dependency(GTest)
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
include_directories("${CMAKE_SOURCE_DIR}/src/paimon/testing/arrow_compat")

paimon_link_libraries_whole_archive(PAIMON_LOCAL_FILE_SYSTEM_STATIC_LINK_LIBS
paimon_local_file_system_static)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Before submitting, please verify:

### Prerequisites

- **C++17** compatible compiler (GCC recommended)
- **CMake** ≥ 3.22
- **C++20** compatible compiler (GCC recommended)
- **CMake** ≥ 3.26
- **Python 3** (for linting scripts and pre-commit)

---
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ Paimon C++ currently provides:

## Building

Building requires a C++17-compatible compiler and CMake 3.22 or newer.
Building requires a C++20-compatible compiler and CMake 3.26 or newer. The
installed public headers support C++17.
Linux `x86_64` and `aarch64` builds are supported and verified in CI.
See the [build guide](docs/source/building.rst) for platform support, system requirements,
dependency configuration, optional components, and instructions for building and running tests.
Expand Down
25 changes: 13 additions & 12 deletions benchmark/benchmark_suite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,15 @@ Result<std::unique_ptr<parquet::arrow::FileReader>> OpenParquetSourceReader(
input.status().ToString());
}

std::unique_ptr<parquet::arrow::FileReader> parquet_reader;
const auto open_status = parquet::arrow::OpenFile(
input.ValueUnsafe(), arrow::default_memory_pool(), &parquet_reader);
if (!open_status.ok()) {
return Status::Invalid("create Parquet reader failed: ", open_status.ToString());
auto reader_result =
parquet::arrow::OpenFile(input.ValueUnsafe(), arrow::default_memory_pool());
if (!reader_result.ok()) {
return Status::Invalid("create Parquet reader failed for ", path, ": ",
reader_result.status().ToString());
}
parquet_reader->set_batch_size(GetSourceBatchMaxRows());
return parquet_reader;
auto reader = std::move(reader_result).ValueUnsafe();
reader->set_batch_size(GetSourceBatchMaxRows());
return reader;
}
#endif

Expand Down Expand Up @@ -396,12 +397,12 @@ Status WriteSourceDataToWriter(paimon::FileStoreWrite* writer, const SourceDataS
#else
PAIMON_ASSIGN_OR_RAISE(std::unique_ptr<parquet::arrow::FileReader> parquet_reader,
OpenParquetSourceReader(source_spec.path));
std::unique_ptr<arrow::RecordBatchReader> batch_reader;
const auto reader_status = parquet_reader->GetRecordBatchReader(&batch_reader);
if (!reader_status.ok()) {
return Status::Invalid("create Parquet source batch reader failed: ",
reader_status.ToString());
auto batch_reader_result = parquet_reader->GetRecordBatchReader();
if (!batch_reader_result.ok()) {
return Status::Invalid("create Parquet source batch reader failed for ", source_spec.path,
": ", batch_reader_result.status().ToString());
}
auto batch_reader = std::move(batch_reader_result).ValueUnsafe();

int64_t written_rows = 0;
while (true) {
Expand Down
8 changes: 1 addition & 7 deletions ci/scripts/build_paimon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ pushd "${build_dir}"
ENABLE_LUMINA="ON"
ENABLE_FULL_TEXT="ON"
ENABLE_LANCE="ON"
if [[ "${CC:-}" == *"gcc-8"* ]] || [[ "${CXX:-}" == *"g++-8"* ]]; then
ENABLE_LUMINA="OFF"
ENABLE_FULL_TEXT="OFF" # The full-text index (Rust FFI) is not built on the gcc-8 image.
fi
if [[ "${enable_tsan}" == "true" ]]; then
ENABLE_FULL_TEXT="OFF" # The full-text Rust library is not TSAN-instrumented.
ENABLE_LANCE="OFF" # Lance's Rust library is not TSAN-instrumented.
Expand Down Expand Up @@ -217,12 +213,10 @@ if [[ "${install_smoke}" == "true" ]]; then
-S "${source_dir}/scripts/releasing/install_smoke" \
-B "${smoke_build_dir}" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${install_dir};${build_dir}/arrow_ep-install"
-DCMAKE_PREFIX_PATH="${install_dir}"
cmake --build "${smoke_build_dir}" -- -j "${build_jobs}"

runtime_library_path="${install_dir}/lib:${install_dir}/lib64"
runtime_library_path+=":${build_dir}/arrow_ep-install/lib"
runtime_library_path+=":${build_dir}/arrow_ep-install/lib64"
if [[ "$(uname -s)" == "Darwin" ]]; then
cmake -E env \
"DYLD_LIBRARY_PATH=${runtime_library_path}" \
Expand Down
34 changes: 21 additions & 13 deletions ci/scripts/download_release_asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Fetch a pinned GitHub release asset. Use the release API if the browser
# download endpoint times out, and publish a file only after verification.
set -euo pipefail

url=$1
output=$2
sha256=$3
shift 3

verify() {
if command -v sha256sum >/dev/null; then
Expand All @@ -39,16 +38,25 @@ mkdir -p "$(dirname "${output}")"
tmp=$(mktemp "${output}.XXXXXX")
trap 'rm -f "${tmp}"' EXIT
curl_args=(--proto '=https' --tlsv1.2 -fsSL --retry 3 --connect-timeout 15 --max-time 180)
if ! curl "${curl_args[@]}" "${url}" -o "${tmp}" || ! verify "${tmp}"; then
release=${url#https://github.com/}
repo=${release%%/releases/download/*}
asset=${release##*/}
tag=${release#*/releases/download/}
tag=${tag%/*}
asset_url=$(curl "${curl_args[@]}" "https://api.github.com/repos/${repo}/releases/tags/${tag}" |
python3 -c 'import json, sys
print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "${asset}")
curl "${curl_args[@]}" -H 'Accept: application/octet-stream' "${asset_url}" -o "${tmp}"
verify "${tmp}"
for candidate in "${url}" "$@"; do
if curl "${curl_args[@]}" "${candidate}" -o "${tmp}" && verify "${tmp}"; then
mv -f "${tmp}" "${output}"
exit 0
fi
done

if [[ "${url}" != https://github.com/*/releases/download/* ]]; then
exit 1
fi

release=${url#https://github.com/}
repo=${release%%/releases/download/*}
asset=${release##*/}
tag=${release#*/releases/download/}
tag=${tag%/*}
asset_url=$(curl "${curl_args[@]}" "https://api.github.com/repos/${repo}/releases/tags/${tag}" |
python3 -c 'import json, sys
print(next(a["url"] for a in json.load(sys.stdin)["assets"] if a["name"] == sys.argv[1]))' "${asset}")
curl "${curl_args[@]}" -H 'Accept: application/octet-stream' "${asset_url}" -o "${tmp}"
verify "${tmp}"
mv -f "${tmp}" "${output}"
3 changes: 1 addition & 2 deletions ci/scripts/setup_flatc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ set -eux
FLATBUFFERS_VERSION=${FLATBUFFERS_VERSION:-25.12.19}
FLATC_INSTALL_DIR=${FLATC_INSTALL_DIR:-"${HOME}/.local/bin"}

# Vortex's native dependencies invoke bindgen in their build scripts, which loads libclang at
# build time. Images that only carry GCC (e.g. the gcc8 test container) may lack it.
# Vortex's native dependencies use bindgen, which loads libclang at build time.
if ! ldconfig -p 2>/dev/null | grep -q 'libclang'; then
if [[ "$(id -u)" -ne 0 ]] && command -v sudo >/dev/null 2>&1; then
apt_prefix="sudo"
Expand Down
16 changes: 16 additions & 0 deletions ci/scripts/test_download_release_asset.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ case "$*" in
echo '{"assets":[{"name":"archive","url":"https://api.github.com/assets/123"}]}' ;;
*application/octet-stream*https://api.github.com/assets/123*)
printf '%s' "${ASSET_CONTENT:-abc}" > "${!#}" ;;
*downloads.apache.org/example/archive*) exit 28 ;;
*dlcdn.apache.org/example/archive*) printf '%s' corrupt > "${!#}" ;;
*archive.apache.org/dist/example/archive*) printf '%s' abc > "${!#}" ;;
*) exit 1 ;;
esac
MOCK
Expand All @@ -55,3 +58,16 @@ if ASSET_CONTENT=invalid fetch; then
exit 1
fi
[[ ! -e "${work}/archive" ]]

: > "${REQUEST_LOG}"
url=https://downloads.apache.org/example/archive
if fetch; then
exit 1
fi
[[ ! -e "${work}/archive" ]]
[[ $(wc -l < "${REQUEST_LOG}") -eq 1 ]]

bash "${script}" "${url}" "${work}/archive" "${checksum}" \
https://dlcdn.apache.org/example/archive https://archive.apache.org/dist/example/archive
[[ $(cat "${work}/archive") == abc ]]
[[ $(wc -l < "${REQUEST_LOG}") -eq 4 ]]
16 changes: 0 additions & 16 deletions cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,6 @@ if(NOT DEFINED CMAKE_C_STANDARD)
set(CMAKE_C_STANDARD 11)
endif()

# This ensures that things like c++11 get passed correctly
if(NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
endif()

# We require a C++11 compliant compiler
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_CXX_EXTENSIONS OFF)

# Build with -fPIC so that can static link our libraries into other people's
# shared libraries
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
Expand Down Expand Up @@ -186,12 +176,6 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CXX_ONLY_FLAGS "${CXX_ONLY_FLAGS} -Wno-subobject-linkage")
endif()

if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "8.0"
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0")
# When using the C++17 filesystem library (<filesystem>) with GCC 8, you do need to explicitly link stdc++fs.
link_libraries(stdc++fs)
endif()

elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL
"Clang")
# Clang options for all builds
Expand Down
Loading
Loading