Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
7cc6bf5
Add PFOR core algorithm and tests
sfc-gh-pgaur Apr 20, 2026
378b3ee
Integrate PFOR encoding into parquet encoder/decoder
sfc-gh-pgaur Apr 21, 2026
6a1d6fb
Add PFOR encoding benchmark
sfc-gh-pgaur Apr 21, 2026
003818c
Use signed integer types consistently per Arrow style guide
sfc-gh-pgaur Jun 3, 2026
f2459cd
Take buffer parameters as spans in the PFOR wire routines
sfc-gh-pgaur Jun 3, 2026
df91383
Return Result<T>/Status on decode paths instead of ARROW_DCHECK
sfc-gh-pgaur Jun 3, 2026
5950438
Assert little-endian and replace reinterpret_cast with SafeCopy
sfc-gh-pgaur Jun 3, 2026
7dfaa76
Unpack a PFOR vector in one call instead of a batch loop
sfc-gh-pgaur Jun 3, 2026
ad3dc1e
Add pragma GCC unroll/ivdep to decode loops for better vectorization
sfc-gh-pgaur Jun 3, 2026
4699aab
Add PforEncodedVectorView for zero-copy decode path
sfc-gh-pgaur Jun 3, 2026
8976c6e
Let the encode path choose its vector size
sfc-gh-pgaur Jun 3, 2026
ab7852e
Fix pfor_test.cc: unwrap Result<> from PforVectorInfo::Load()
sfc-gh-pgaur Jun 3, 2026
d779ef4
Convert PforWrapper::LoadHeader to return Result<PforHeader>
sfc-gh-pgaur Jun 14, 2026
64fe429
Use SafeLoadAs/SafeStore for header and offset array in PforWrapper
sfc-gh-pgaur Jun 14, 2026
5bc0368
Validate header fields in PforWrapper::LoadHeader
sfc-gh-pgaur Jun 14, 2026
470be2c
Use int64_t and a qualified name at the PFOR call sites
sfc-gh-pgaur Jun 15, 2026
045e4c5
Use uint8_t* consistently in PforWrapper API instead of char*
sfc-gh-pgaur Jun 15, 2026
d5dbef5
Make PforVectorInfo a class with validated loads
sfc-gh-pgaur Jun 15, 2026
c42de3c
Convert PforEncodedVector and PforEncodedVectorView to classes
sfc-gh-pgaur Jun 15, 2026
f3fb7c0
Validate and construct PforVectorInfo atomically
sfc-gh-pgaur Jun 15, 2026
3df2641
Build the PFOR comparison benchmark
sfc-gh-pgaur Jun 25, 2026
1693795
Use bit_util helpers in PFOR and note the incremental paths
sfc-gh-pgaur Jun 26, 2026
5d78846
Drop Snowflake attribution from PFOR header comments
sfc-gh-pgaur Jun 26, 2026
533c1ba
Fix IsPowerOf2(int32_t) ambiguity in pfor_wrapper.cc
sfc-gh-pgaur Jun 28, 2026
208f684
Add portable FastLanes bit-packing kernels
sfc-gh-pgaur Jun 28, 2026
b9055d4
Benchmark FastLanes-FOR with the PFOR codecs
sfc-gh-pgaur Jun 28, 2026
51f861e
Add a flat-output decode for FastLanes-FOR and benchmark it
sfc-gh-pgaur Jun 28, 2026
2547640
Add the inverse FL_ORDER index mapping
sfc-gh-pgaur Jun 28, 2026
352c9c6
Add a per-vector PFOR packing mode
sfc-gh-pgaur Jun 28, 2026
208c86d
Allow transposed output from FastLanes vectors
sfc-gh-pgaur Jun 28, 2026
08162f6
Add ARROW_RELEASE_O3 to keep CMake's default Release -O3
sfc-gh-pgaur Jun 28, 2026
30e16d3
Cover bit_width 0 and 32 in the transposed-output tests
sfc-gh-pgaur Jul 20, 2026
bc572de
Adapt PFOR to updated Arrow util APIs
sfc-gh-pgaur Jul 20, 2026
02d9254
Migrate PFOR to std::span
sfc-gh-pgaur Jul 20, 2026
76f8fb2
Add a packing mode that interleaves without FL_ORDER
sfc-gh-pgaur Jul 20, 2026
dc48d90
Decode BitPack into stack scratch instead of a heap buffer
sfc-gh-pgaur Jul 24, 2026
2d8d866
Vectorize the frame-of-reference add in BitPack decode
sfc-gh-pgaur Jul 24, 2026
3adb23c
Speed up PFOR encode with a wider histogram and stack deltas
sfc-gh-pgaur Jul 24, 2026
7dba270
Skip FOR-add pass in PFOR decode when frame-of-reference is 0
sfc-gh-pgaur Jul 24, 2026
b8fabe8
Expand the PFOR benchmark corpus
sfc-gh-pgaur Jul 24, 2026
9ac70b7
Remove experimental FastLanes modes from PFOR
sfc-gh-pgaur Jul 24, 2026
1b2a34b
Benchmark PFOR on int64 columns
sfc-gh-pgaur Jul 25, 2026
dbdc31a
Fold frame bias into the bit unpacker
sfc-gh-pgaur Aug 21, 2026
8320163
Store the PFOR bit width in 7 bits, not 6
sfc-gh-pgaur Aug 21, 2026
6254912
Fold the frame-of-reference add into the PFOR unpacker
sfc-gh-pgaur Aug 21, 2026
810a6da
Spell the restrict qualifier portably in unpack_full
sfc-gh-pgaur Aug 23, 2026
b903d13
Fix PFOR check-in warnings
sfc-gh-pgaur Aug 25, 2026
25735eb
List PFOR in SupportedEncodings for INT32 and INT64
sfc-gh-pgaur Aug 25, 2026
2e33023
Use std::bit_width instead of __builtin_clz in PFOR
sfc-gh-pgaur Aug 25, 2026
ff9486a
Apply clang-format 18 to the PFOR sources
sfc-gh-pgaur Aug 25, 2026
1cafc2a
Reject a PFOR page header that disagrees with its buffer
sfc-gh-pgaur Aug 25, 2026
904dfca
Count PFOR exceptions in an unsigned field
sfc-gh-pgaur Aug 25, 2026
9f5dee1
Put the output buffer last in PforWrapper::Decode
sfc-gh-pgaur Aug 25, 2026
5a0db33
Return Status from PforWrapper::Encode
sfc-gh-pgaur Aug 25, 2026
a46fbb2
Decode PFOR pages with null slots through the Arrow path
sfc-gh-pgaur Aug 25, 2026
8dcfe49
Note that incremental PFOR encode and decode come later
sfc-gh-pgaur Aug 25, 2026
e43cd0f
Correct the bit_width mask comments in PforVectorInfo
sfc-gh-pgaur Aug 26, 2026
42cf43e
Validate PFOR exception positions and counts before patching
sfc-gh-pgaur Aug 26, 2026
ef8a231
Drop the cached PFOR page when the decoder is given a new one
sfc-gh-pgaur Aug 26, 2026
f1dd7d4
Validate PFOR wire metadata and enforce the output buffer size
sfc-gh-pgaur Aug 26, 2026
0ebefd0
Build PFOR into libarrow instead of recompiling it per target
sfc-gh-pgaur Aug 27, 2026
5e9e2f3
Stop PforDecoder from shadowing its base class page state
sfc-gh-pgaur Aug 27, 2026
5694ac6
Derive PFOR layout sizes from the fields they describe
sfc-gh-pgaur Aug 27, 2026
27e4eff
Drop the unused PFOR vector view; harden SerializeVector
sfc-gh-pgaur Aug 27, 2026
75caff2
Note the missing PLAIN fallback in PforEncoder
sfc-gh-pgaur Aug 27, 2026
c66efea
Type-parameterize the PFOR tests over int32 and int64
sfc-gh-pgaur Aug 27, 2026
09d6fb2
Take the PFOR value count from the page's own header
sfc-gh-pgaur Sep 3, 2026
c1f6c3b
Validate the PFOR element count and offset chain before decoding
sfc-gh-pgaur Sep 3, 2026
d49f702
Encode an all-null PFOR page as a bare header
sfc-gh-pgaur Sep 3, 2026
7ea40f6
Serialize PFOR little-endian instead of refusing to build
sfc-gh-pgaur Sep 3, 2026
5717cee
Build the PFOR sources under meson too
sfc-gh-pgaur Sep 3, 2026
88dc0bb
Document the cost of batched PFOR reads
sfc-gh-pgaur Sep 3, 2026
bdadb6f
Add end-to-end PFOR tests through the Arrow reader and writer
sfc-gh-pgaur Sep 3, 2026
68a1efe
Name the PFOR headers _internal.h
sfc-gh-pgaur Sep 3, 2026
24bce85
Bound the sequential unpacker at the page, not at the vector
sfc-gh-pgaur Sep 5, 2026
92a7dcb
Use Arrow's section-rule style for the PFOR comments
sfc-gh-pgaur Sep 19, 2026
d179a6e
Decode PFOR pages one vector at a time
sfc-gh-pgaur Sep 28, 2026
cbe53b2
Give PFOR a delta mode and a searchable frame
sfc-gh-pgaur Sep 1, 2026
f609eb0
Reduce the cost of PFOR frame selection
sfc-gh-pgaur Sep 1, 2026
a9479ca
Benchmark PFOR delta mode on correlated columns
sfc-gh-pgaur Sep 1, 2026
72d98d0
Reject unprofitable PFOR delta plans from a sample
sfc-gh-pgaur Sep 3, 2026
526427a
Gate PFOR and delta mode with writer properties
sfc-gh-pgaur Sep 3, 2026
dbabef0
Validate PFOR delta metadata before decoding
sfc-gh-pgaur Sep 3, 2026
4de5292
Note that the delta prefix sum could fold into the unpack kernel
sfc-gh-pgaur Sep 3, 2026
c2220b9
Measure the unpacker's page bound from the header this vector wrote
sfc-gh-pgaur Sep 5, 2026
545fb4c
Clarify delta-mode comments and test terminology
sfc-gh-pgaur Sep 19, 2026
e9a8ec3
Let a caller require the delta representation
sfc-gh-pgaur Sep 28, 2026
bd877ee
[C++][Parquet] Coalesce equal-width DELTA_BINARY_PACKED miniblocks
sfc-gh-pgaur Sep 18, 2026
ee608e6
[C++][Parquet] Scan DELTA_BINARY_PACKED deltas a vector at a time
sfc-gh-pgaur Sep 18, 2026
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ rat.txt

# for ODBC DLL
*.rc

# Local out-of-tree benchmark build dir
cpp/build-bench/
3 changes: 3 additions & 0 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ takes precedence over ccache if a storage backend is configured" ON)

define_option(ARROW_GGDB_DEBUG "Pass -ggdb flag to debug builds" ON)

define_option(ARROW_RELEASE_O3
"Keep CMake's default -O3 in Release builds instead of -O2" OFF)

define_option(ARROW_WITH_MUSL "Whether the system libc is musl or not" OFF)

define_option(ARROW_ENABLE_THREADING "Enable threading in Arrow core" ON)
Expand Down
13 changes: 9 additions & 4 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -632,20 +632,25 @@ endif()
# Same as Release, except with debug symbols enabled.

if(NOT MSVC)
# CMake's default Release flags are "-O3 -DNDEBUG"; the appends below
# downgrade them to -O2, since the last -O flag wins in GCC. Set
# ARROW_RELEASE_O3 to skip the downgrade: the bit-packing kernels are
# built around the inlining and unrolling -O3 enables, and the
# throughput figures quoted for them were measured with it in effect.
set(C_RELEASE_FLAGS "")
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3" AND NOT ARROW_RELEASE_O3)
string(APPEND C_RELEASE_FLAGS " -O2")
endif()
set(CXX_RELEASE_FLAGS "")
if(CMAKE_CXX_FLAGS_RELEASE MATCHES "-O3")
if(CMAKE_CXX_FLAGS_RELEASE MATCHES "-O3" AND NOT ARROW_RELEASE_O3)
string(APPEND CXX_RELEASE_FLAGS " -O2")
endif()
set(C_RELWITHDEBINFO_FLAGS "")
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-O3")
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-O3" AND NOT ARROW_RELEASE_O3)
string(APPEND C_RELWITHDEBINFO_FLAGS " -O2")
endif()
set(CXX_RELWITHDEBINFO_FLAGS "")
if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-O3")
if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-O3" AND NOT ARROW_RELEASE_O3)
string(APPEND CXX_RELWITHDEBINFO_FLAGS " -O2")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,8 @@ set(ARROW_UTIL_SRCS
util/math_internal.cc
util/memory.cc
util/mutex.cc
util/pfor/pfor.cc
util/pfor/pfor_wrapper.cc
util/ree_util.cc
util/secure_string.cc
util/string.cc
Expand Down
2 changes: 2 additions & 0 deletions cpp/src/arrow/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ arrow_util_srcs = [
'util/math_internal.cc',
'util/memory.cc',
'util/mutex.cc',
'util/pfor/pfor.cc',
'util/pfor/pfor_wrapper.cc',
'util/ree_util.cc',
'util/secure_string.cc',
'util/string.cc',
Expand Down
4 changes: 4 additions & 0 deletions cpp/src/arrow/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,10 @@ add_arrow_test(threading-utility-test
test_common.cc
thread_pool_test.cc)

add_arrow_test(pfor-test SOURCES pfor/pfor_test.cc)

add_arrow_benchmark(pfor/pfor_benchmark)

add_arrow_benchmark(bit_block_counter_benchmark)
add_arrow_benchmark(bit_util_benchmark)
add_arrow_benchmark(bitmap_reader_benchmark)
Expand Down
32 changes: 32 additions & 0 deletions cpp/src/arrow/util/bpacking.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ struct UnpackDynamicFunction {
}
};

template <typename Uint>
struct UnpackBiasDynamicFunction {
using FunctionType = decltype(&bpacking::unpack_bias_scalar<Uint>);

static constexpr auto targets() {
return std::array{
ARROW_DISPATCH_TARGET_NONE(&bpacking::unpack_bias_scalar<Uint>) //
ARROW_DISPATCH_TARGET_NEON(&bpacking::unpack_bias_neon<Uint>) //
ARROW_DISPATCH_TARGET_SVE128(&bpacking::unpack_bias_sve128<Uint>) //
ARROW_DISPATCH_TARGET_SVE256(&bpacking::unpack_bias_sve256<Uint>) //
ARROW_DISPATCH_TARGET_SSE4_2(&bpacking::unpack_bias_sse4_2<Uint>) //
ARROW_DISPATCH_TARGET_AVX2(&bpacking::unpack_bias_avx2<Uint>) //
ARROW_DISPATCH_TARGET_AVX512(&bpacking::unpack_bias_avx512<Uint>) //
};
}
};

} // namespace

template <typename Uint>
Expand All @@ -57,4 +74,19 @@ template void unpack<uint16_t>(const uint8_t*, uint16_t*, const UnpackOptions&);
template void unpack<uint32_t>(const uint8_t*, uint32_t*, const UnpackOptions&);
template void unpack<uint64_t>(const uint8_t*, uint64_t*, const UnpackOptions&);

template <typename Uint>
void unpack_bias(const uint8_t* in, Uint* out, const UnpackOptions& opts, Uint bias) {
static const DynamicDispatch<UnpackBiasDynamicFunction<Uint>> dispatch;
return dispatch(in, out, opts, bias);
}

template void unpack_bias<uint8_t>(const uint8_t*, uint8_t*, const UnpackOptions&,
uint8_t);
template void unpack_bias<uint16_t>(const uint8_t*, uint16_t*, const UnpackOptions&,
uint16_t);
template void unpack_bias<uint32_t>(const uint8_t*, uint32_t*, const UnpackOptions&,
uint32_t);
template void unpack_bias<uint64_t>(const uint8_t*, uint64_t*, const UnpackOptions&,
uint64_t);

} // namespace arrow::internal
Loading
Loading