Skip to content
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
11 changes: 10 additions & 1 deletion cpp/libcudf_streaming/src/detail/device_bloom_filter.cu
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ using BloomFilterRefType =
cuco::bloom_filter_ref<KeyType,
cuco::extent<std::size_t>,
cuco::thread_scope_device,
cuco::arrow_filter_policy<KeyType, cuco::identity_hash>>;
cuco::parametric_filter_policy<cuco::identity_hash<KeyType>,
std::uint32_t,
8,
8,
8,
1,
1,
8,
false,
false>>;
using StorageType = BloomFilterRefType::filter_block_type;

} // namespace
Expand Down
118 changes: 0 additions & 118 deletions cpp/src/io/parquet/arrow_filter_policy.cuh

This file was deleted.

28 changes: 26 additions & 2 deletions cpp/src/io/parquet/bloom_filter_reader.cu
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

#include "arrow_filter_policy.cuh"
#include "compact_protocol_reader.hpp"
#include "expression_transform_helpers.hpp"
#include "io/utilities/time_utils.hpp"
Expand All @@ -25,6 +24,7 @@
#include <rmm/device_buffer.hpp>
#include <rmm/exec_policy.hpp>

#include <cuco/bloom_filter_policies.cuh>
#include <cuco/bloom_filter_ref.cuh>
#include <cuda/iterator>
#include <thrust/tabulate.h>
Expand All @@ -36,6 +36,30 @@
namespace cudf::io::parquet::detail {
namespace {

/**
* @brief Policy describing the Apache Arrow Block-Split Bloom Filter, hashing keys with cudf's
* `XXHash_64` (so that `cudf::string_view` and other cudf types are hashed by content, matching the
* Apache Parquet/Arrow bloom filter specification).
*
* Uses cuco's `parametric_filter_policy` with the Apache Arrow layout: 256-bit blocks (8 x
* `uint32_t`), 8 fingerprint bits per key, fully horizontal add (Theta=8) and fully vertical
* contains (Phi=8). This layout is bit-compatible with Apache Arrow, as verified by cuCollections
* `tests/bloom_filter/arrow_compat_test.cu`.
*
* @tparam Key The type of the values to generate a fingerprint for.
*/
template <class Key>
using arrow_filter_policy = cuco::parametric_filter_policy<cudf::hashing::detail::XXHash_64<Key>,
std::uint32_t,
8,
8,
8,
1,
1,
8,
false,
false>;

/**
* @brief Converts bloom filter membership results (for each column chunk) to a device column.
*
Expand Down
5 changes: 2 additions & 3 deletions cpp/src/join/mark_join.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -165,8 +165,7 @@ using storage_ref_type =
cuco::bucket_storage_ref<mark_key_type, mark_join_bucket_size, cuco::extent<std::size_t>>;
using right_key_type = cuco::pair<hash_value_type, rhs_index_type>;

using bloom_filter_policy_type =
cuco::default_filter_policy<cuco::detail::identity_hash<hash_value_type>, hash_value_type, 2U>;
using bloom_filter_policy_type = cuco::default_filter_policy<hash_value_type>;
using bloom_filter_allocator_type = rmm::mr::polymorphic_allocator<cuda::std::byte>;
using bloom_filter_type = cuco::bloom_filter<hash_value_type,
cuco::extent<std::size_t>,
Expand Down
22 changes: 17 additions & 5 deletions cpp/tests/io/parquet_bloom_filter_test.cu
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/

#include "src/io/parquet/arrow_filter_policy.cuh"

#include <cudf_test/base_fixture.hpp>
#include <cudf_test/column_utilities.hpp>
#include <cudf_test/column_wrapper.hpp>
Expand All @@ -18,15 +16,29 @@
#include <rmm/mr/polymorphic_allocator.hpp>

#include <cuco/bloom_filter.cuh>
#include <cuco/bloom_filter_policies.cuh>

#include <cstdint>

using StringType = cudf::string_view;

class ParquetBloomFilterTest : public cudf::test::BaseFixture {};

TEST_F(ParquetBloomFilterTest, TestStrings)
{
using key_type = StringType;
using policy_type = cudf::io::parquet::detail::arrow_filter_policy<key_type>;
using key_type = StringType;
// Apache Arrow Block-Split Bloom Filter layout, hashing keys with cudf's `XXHash_64` (matching
// `cudf::io::parquet::detail::arrow_filter_policy`).
using policy_type = cuco::parametric_filter_policy<cudf::hashing::detail::XXHash_64<key_type>,
std::uint32_t,
8,
8,
8,
1,
1,
8,
false,
false>;
using word_type = policy_type::word_type;

std::size_t constexpr num_filter_blocks = 4;
Expand Down
Loading