Skip to content

Commit 3079fea

Browse files
committed
Merge remote-tracking branch 'upstream/main' into ci/cudf_polars/polars_tests_rapidsmpf
2 parents b8305b4 + 3a9daa5 commit 3079fea

72 files changed

Lines changed: 12924 additions & 17328 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

cpp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ add_library(
536536
src/io/parquet/experimental/hybrid_scan_preprocess.cu
537537
src/io/parquet/experimental/page_index_filter.cu
538538
src/io/parquet/experimental/page_index_filter_utils.cu
539+
src/io/parquet/expression_transform_helpers.cpp
539540
src/io/parquet/io_utils/parquet_io_utils.cpp
540541
src/io/parquet/page_data.cu
541542
src/io/parquet/chunk_dict.cu

cpp/benchmarks/io/cuio_common.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,8 @@ void drop_page_cache_if_enabled(std::vector<std::string> const& file_paths)
274274
}
275275

276276
if (not is_file_scope) {
277-
if (not kvikio::drop_system_page_cache()) {
278-
CUDF_FAIL("Failed to execute the drop cache command");
279-
}
277+
auto const is_cache_dropped = kvikio::drop_system_page_cache();
278+
CUDF_EXPECTS(is_cache_dropped, "Failed to execute the drop cache command");
280279
return;
281280
}
282281

cpp/doxygen/developer_guide/DEVELOPER_GUIDE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,19 @@ occurred and is used for the exception's `what()` message. If the conditional ev
11421142
`false`, then an error has occurred and an instance of the exception class in the third argument
11431143
(or the default, `cudf::logic_error`) is thrown.
11441144
1145+
The condition (first argument) of `CUDF_EXPECTS` should be a pure predicate that only inspects
1146+
state without modifying it. If the result of an operation with a side effect needs to be checked,
1147+
capture the result in a variable first:
1148+
1149+
```c++
1150+
// WRONG — side effect (initialization) inside the condition:
1151+
CUDF_EXPECTS(reader.init(source), "Failed to initialize reader");
1152+
1153+
// RIGHT — capture the result, then check it:
1154+
auto const init_ok = reader.init(source);
1155+
CUDF_EXPECTS(init_ok, "Failed to initialize reader");
1156+
```
1157+
11451158
There are times where a particular code path, if reached, should indicate an error no matter what.
11461159
For example, often the `default` case of a `switch` statement represents an invalid alternative.
11471160
Use the `CUDF_FAIL` macro for such errors. This is effectively the same as calling
@@ -1153,6 +1166,11 @@ Example:
11531166
CUDF_FAIL("This code path should not be reached.");
11541167
```
11551168
1169+
Prefer `CUDF_EXPECTS` over `if (condition) { CUDF_FAIL(reason); }` when the condition has no side
1170+
effects. The `if`/`CUDF_FAIL` pattern is appropriate when cleanup or other actions must be
1171+
performed before throwing, or when the condition itself involves side effects that cannot be
1172+
separated from the check.
1173+
11561174
### CUDA Error Checking
11571175
11581176
Use the `CUDF_CUDA_TRY` macro to check for the successful completion of CUDA runtime API functions.

cpp/include/cudf/dictionary/detail/concatenate.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -12,7 +12,7 @@
1212

1313
#include <rmm/cuda_stream_view.hpp>
1414

15-
namespace CUDF_EXPORT cudf {
15+
namespace cudf {
1616
namespace dictionary::detail {
1717
/**
1818
* @brief Returns a single column by vertically concatenating the given vector of
@@ -31,4 +31,4 @@ std::unique_ptr<column> concatenate(host_span<column_view const> columns,
3131
rmm::device_async_resource_ref mr);
3232

3333
} // namespace dictionary::detail
34-
} // namespace CUDF_EXPORT cudf
34+
} // namespace cudf

cpp/include/cudf/dictionary/detail/encode.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -12,7 +12,7 @@
1212

1313
#include <rmm/cuda_stream_view.hpp>
1414

15-
namespace CUDF_EXPORT cudf {
15+
namespace cudf {
1616
namespace dictionary::detail {
1717
/**
1818
* @brief Construct a dictionary column by dictionary encoding an existing column.
@@ -73,4 +73,4 @@ std::unique_ptr<column> decode(dictionary_column_view const& dictionary_column,
7373
data_type get_indices_type_for_size(size_type keys_size);
7474

7575
} // namespace dictionary::detail
76-
} // namespace CUDF_EXPORT cudf
76+
} // namespace cudf

cpp/include/cudf/dictionary/detail/merge.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -11,7 +11,7 @@
1111

1212
#include <rmm/cuda_stream_view.hpp>
1313

14-
namespace CUDF_EXPORT cudf {
14+
namespace cudf {
1515
namespace dictionary::detail {
1616

1717
/**
@@ -36,4 +36,4 @@ std::unique_ptr<column> merge(dictionary_column_view const& lcol,
3636
rmm::device_async_resource_ref mr);
3737

3838
} // namespace dictionary::detail
39-
} // namespace CUDF_EXPORT cudf
39+
} // namespace cudf

cpp/include/cudf/dictionary/detail/replace.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -12,7 +12,7 @@
1212

1313
#include <rmm/cuda_stream_view.hpp>
1414

15-
namespace CUDF_EXPORT cudf {
15+
namespace cudf {
1616
namespace dictionary::detail {
1717

1818
/**
@@ -51,4 +51,4 @@ std::unique_ptr<column> replace_nulls(dictionary_column_view const& input,
5151
rmm::device_async_resource_ref mr);
5252

5353
} // namespace dictionary::detail
54-
} // namespace CUDF_EXPORT cudf
54+
} // namespace cudf
Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
66

77
#include <cudf/dictionary/dictionary_column_view.hpp>
88
#include <cudf/scalar/scalar.hpp>
99
#include <cudf/utilities/default_stream.hpp>
10-
#include <cudf/utilities/export.hpp>
1110
#include <cudf/utilities/memory_resource.hpp>
1211

1312
#include <rmm/cuda_stream_view.hpp>
1413

15-
namespace CUDF_EXPORT cudf {
14+
namespace cudf {
1615
namespace dictionary {
1716
namespace detail {
1817

@@ -27,30 +26,6 @@ std::unique_ptr<scalar> get_index(dictionary_column_view const& dictionary,
2726
rmm::cuda_stream_view stream,
2827
rmm::device_async_resource_ref mr);
2928

30-
/**
31-
* @brief Get the index for a key if it were added to the given dictionary.
32-
*
33-
* The actual index is returned if the `key` is already part of the dictionary's key set.
34-
*
35-
* @code{.pseudo}
36-
* d1 = {["a","c","d"],[2,0,1,0]}
37-
* idx = get_insert_index(d1,"b")
38-
* idx is 1
39-
* @endcode{.pseudo}
40-
*
41-
* @throw cudf::logic_error if `key.type() != dictionary.keys().type()`
42-
*
43-
* @param dictionary The dictionary to search for the key.
44-
* @param key The value to search for in the dictionary keyset.
45-
* @param stream CUDA stream used for device memory operations and kernel launches.
46-
* @param mr Device memory resource used to allocate the returned column's device memory.
47-
* @return Numeric scalar index value of the key within the dictionary
48-
*/
49-
std::unique_ptr<scalar> get_insert_index(dictionary_column_view const& dictionary,
50-
scalar const& key,
51-
rmm::cuda_stream_view stream,
52-
rmm::device_async_resource_ref mr);
53-
5429
} // namespace detail
5530
} // namespace dictionary
56-
} // namespace CUDF_EXPORT cudf
31+
} // namespace cudf

cpp/include/cudf/dictionary/detail/update_keys.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2024, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
#pragma once
@@ -13,7 +13,7 @@
1313

1414
#include <rmm/cuda_stream_view.hpp>
1515

16-
namespace CUDF_EXPORT cudf {
16+
namespace cudf {
1717
namespace dictionary::detail {
1818
/**
1919
* @copydoc cudf::dictionary::add_keys(dictionary_column_view const&,column_view
@@ -92,4 +92,4 @@ std::pair<std::vector<std::unique_ptr<column>>, std::vector<table_view>> match_d
9292
std::vector<table_view> tables, rmm::cuda_stream_view stream, rmm::device_async_resource_ref mr);
9393

9494
} // namespace dictionary::detail
95-
} // namespace CUDF_EXPORT cudf
95+
} // namespace cudf

cpp/include/cudf/io/csv.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: Copyright (c) 2020-2025, NVIDIA CORPORATION.
2+
* SPDX-FileCopyrightText: Copyright (c) 2020-2026, NVIDIA CORPORATION.
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

@@ -795,9 +795,7 @@ class csv_reader_options {
795795
*/
796796
void set_na_values(std::vector<std::string> vals)
797797
{
798-
if ((!vals.empty()) and (!_na_filter)) {
799-
CUDF_FAIL("Can't set na_values when na_filtering is disabled");
800-
}
798+
CUDF_EXPECTS(vals.empty() or _na_filter, "Can't set na_values when na_filtering is disabled");
801799

802800
_na_values = std::move(vals);
803801
}

0 commit comments

Comments
 (0)