Skip to content

Commit

Permalink
Merge branch 'branch-22.02' into bug-regex-match-octal
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwendt committed Jan 12, 2022
2 parents 5e87e1f + 093b0ad commit baf2250
Show file tree
Hide file tree
Showing 25 changed files with 245 additions and 104 deletions.
2 changes: 1 addition & 1 deletion ci/benchmark/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ conda list --show-channel-urls
################################################################################

logger "Build libcudf..."
if [[ ${BUILD_MODE} == "pull-request" ]]; then
if [[ "${BUILD_MODE}" == "pull-request" ]]; then
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf benchmarks tests --ptds
else
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf benchmarks tests -l --ptds
Expand Down
2 changes: 1 addition & 1 deletion ci/cpu/upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export GPUCI_RETRY_SLEEP=30
export LABEL_OPTION=${LABEL_OPTION:-"--label main"}

# Skip uploads unless BUILD_MODE == "branch"
if [ ${BUILD_MODE} != "branch" ]; then
if [ "${BUILD_MODE}" != "branch" ]; then
echo "Skipping upload"
return 0
fi
Expand Down
4 changes: 2 additions & 2 deletions ci/gpu/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ if [[ -z "$PROJECT_FLASH" || "$PROJECT_FLASH" == "0" ]]; then
################################################################################

gpuci_logger "Build from source"
if [[ ${BUILD_MODE} == "pull-request" ]]; then
if [[ "${BUILD_MODE}" == "pull-request" ]]; then
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests --ptds
else
"$WORKSPACE/build.sh" clean libcudf cudf dask_cudf libcudf_kafka cudf_kafka benchmarks tests -l --ptds
Expand Down Expand Up @@ -222,7 +222,7 @@ else
install_dask

gpuci_logger "Build python libs from source"
if [[ ${BUILD_MODE} == "pull-request" ]]; then
if [[ "${BUILD_MODE}" == "pull-request" ]]; then
"$WORKSPACE/build.sh" cudf dask_cudf cudf_kafka --ptds
else
"$WORKSPACE/build.sh" cudf dask_cudf cudf_kafka -l --ptds
Expand Down
7 changes: 4 additions & 3 deletions conda/recipes/cudf_kafka/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set cuda_version = '.'.join(environ.get('CUDA', '11.5').split('.')[:2]) %}
{% set py_version = environ.get('python', '3.8') %}
{% set py_version = environ.get('PY_VER', '3.8') %}
{% set py_version_numeric = py_version.replace('.', '') %}

package:
name: cudf_kafka
Expand All @@ -14,7 +15,7 @@ source:

build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version.replace('.', '') }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version_numeric }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- CC
- CXX
Expand All @@ -34,7 +35,7 @@ requirements:
run:
- python {{ py_version }}
- libcudf_kafka {{ version }}
- python-confluent-kafka >=1.7.0,<1.8.0a0=py{{ py_version.replace('.', '') }}*
- python-confluent-kafka >=1.7.0,<1.8.0a0=py{{ py_version_numeric }}*
- cudf {{ version }}

test: # [linux64]
Expand Down
11 changes: 6 additions & 5 deletions conda/recipes/custreamz/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
{% set version = environ.get('GIT_DESCRIBE_TAG', '0.0.0.dev').lstrip('v') + environ.get('VERSION_SUFFIX', '') %}
{% set minor_version = version.split('.')[0] + '.' + version.split('.')[1] %}
{% set cuda_version = '.'.join(environ.get('CUDA', '11.5').split('.')[:2]) %}
{% set py_version = environ.get('python', '3.8') %}
{% set py_version = environ.get('PY_VER', '3.8') %}
{% set py_version_numeric = py_version.replace('.', '') %}

package:
name: custreamz
Expand All @@ -14,7 +15,7 @@ source:

build:
number: {{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version.replace('.', '') }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
string: py{{ py_version_numeric }}_{{ GIT_DESCRIBE_HASH }}_{{ GIT_DESCRIBE_NUMBER }}
script_env:
- VERSION_SUFFIX
- PARALLEL_LEVEL
Expand All @@ -25,15 +26,15 @@ build:
requirements:
host:
- python {{ py_version }}
- python-confluent-kafka >=1.7.0,<1.8.0a0=py{{ py_version.replace('.', '') }}*
- python-confluent-kafka >=1.7.0,<1.8.0a0=py{{ py_version_numeric }}*
- cudf_kafka {{ version }}
run:
- python {{ py_version }}
- streamz
- streamz
- cudf {{ version }}
- dask>=2021.11.1,<=2021.11.2
- distributed>=2021.11.1,<=2021.11.2
- python-confluent-kafka >=1.7.0,<1.8.0a0=py{{ py_version.replace('.', '') }}*
- python-confluent-kafka >=1.7.0,<1.8.0a0=py{{ py_version_numeric }}*
- cudf_kafka {{ version }}

test: # [linux64]
Expand Down
2 changes: 1 addition & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ set_target_properties(
)

target_compile_options(
cudftestutil PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${CUDF_CXX_FLAGS}>"
cudftestutil PUBLIC "$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CXX>:${CUDF_CXX_FLAGS}>>"
"$<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:CUDA>:${CUDF_CUDA_FLAGS}>>"
)

Expand Down
2 changes: 1 addition & 1 deletion cpp/doxygen/regex.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The details are based on features documented at https://www.regular-expressions.
| Literal character | Any character except `[\^$.⎮?*+()` | All characters except the listed special characters match a single instance of themselves | `a` matches `a` |
| Literal curly braces | `{` and `}` | `{` and `}` are literal characters, unless they are part of a valid regular expression token such as a quantifier `{3}` | `{` matches `{` |
| Backslash escapes a metacharacter | `\` followed by any of `[\^$.⎮?*+(){}` | A backslash escapes special characters to suppress their special meaning | `\*` matches `*` |
| Hexadecimal escape | `\xFF` where `FF` are 2 hexadecimal digits | Matches the character at the specified position in the code page | `\xA9` matches `©` |
| Hexadecimal escape | `\xFF` where `FF` are 2 hexadecimal digits | Matches the character at the specified position in the ASCII table | `\x40` matches `@` |
| Character escape | `\n`, `\r` and `\t` | Match an line-feed (LF) character, carriage return (CR) character and a tab character respectively | `\r\n` matches a Windows CRLF line break |
| Character escape | `\a` | Match the "alert" or "bell" control character (ASCII 0x07) | |
| Character escape | `\f` | Match the form-feed control character (ASCII 0x0C) | |
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/cudf/utilities/traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ inline bool is_equality_comparable(data_type type)
template <typename T>
constexpr inline bool is_numeric()
{
return cuda::std::is_integral<T>() or std::is_floating_point<T>::value;
return cuda::std::is_arithmetic<T>();
}

struct is_numeric_impl {
Expand Down
9 changes: 8 additions & 1 deletion cpp/include/cudf_test/type_lists.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -158,6 +158,13 @@ std::enable_if_t<cudf::is_timestamp_t<TypeParam>::value, TypeParam> make_type_pa
return TypeParam{typename TypeParam::duration(init_value)};
}

template <typename TypeParam, typename T>
std::enable_if_t<std::is_same_v<TypeParam, std::string>, TypeParam> make_type_param_scalar(
T const init_value)
{
return std::to_string(init_value);
}

/**
* @brief Type list for all integral types except type bool.
*/
Expand Down
5 changes: 3 additions & 2 deletions cpp/src/reductions/struct_minmax_util.cuh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, NVIDIA CORPORATION.
* Copyright (c) 2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@
#include <cudf/detail/utilities/vector_factories.hpp>
#include <cudf/table/row_operators.cuh>
#include <cudf/table/table_device_view.cuh>
#include <cudf/table/table_view.hpp>

namespace cudf {
namespace reduction {
Expand Down Expand Up @@ -97,7 +98,7 @@ class comparison_binop_generator {
table_view{{input}}, {}, std::vector<null_order>{DEFAULT_NULL_ORDER})},
d_flattened_input_ptr{table_device_view::create(flattened_input, stream)},
is_min_op(is_min_op),
has_nulls{input.has_nulls()},
has_nulls{has_nested_nulls(table_view{{input}})},
null_orders_dvec(0, stream)
{
if (is_min_op) {
Expand Down
23 changes: 22 additions & 1 deletion cpp/tests/groupby/max_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -388,5 +388,26 @@ TEST_F(groupby_max_struct_test, null_keys_and_values)
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
}

TEST_F(groupby_max_struct_test, values_with_null_child)
{
constexpr int32_t null{0};
auto const keys = fixed_width_column_wrapper<int32_t>{1, 1};
auto const vals = [] {
auto child1 = fixed_width_column_wrapper<int32_t>{1, 1};
auto child2 = fixed_width_column_wrapper<int32_t>{{-1, null}, null_at(1)};
return structs_column_wrapper{child1, child2};
}();

auto const expect_keys = fixed_width_column_wrapper<int32_t>{1};
auto const expect_vals = [] {
auto child1 = fixed_width_column_wrapper<int32_t>{1};
auto child2 = fixed_width_column_wrapper<int32_t>{-1};
return structs_column_wrapper{child1, child2};
}();

auto agg = cudf::make_max_aggregation<groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
}

} // namespace test
} // namespace cudf
23 changes: 22 additions & 1 deletion cpp/tests/groupby/min_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2021, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -387,5 +387,26 @@ TEST_F(groupby_min_struct_test, null_keys_and_values)
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
}

TEST_F(groupby_min_struct_test, values_with_null_child)
{
constexpr int32_t null{0};
auto const keys = fixed_width_column_wrapper<int32_t>{1, 1};
auto const vals = [] {
auto child1 = fixed_width_column_wrapper<int32_t>{1, 1};
auto child2 = fixed_width_column_wrapper<int32_t>{{-1, null}, null_at(1)};
return structs_column_wrapper{child1, child2};
}();

auto const expect_keys = fixed_width_column_wrapper<int32_t>{1};
auto const expect_vals = [] {
auto child1 = fixed_width_column_wrapper<int32_t>{1};
auto child2 = fixed_width_column_wrapper<int32_t>{{null}, null_at(0)};
return structs_column_wrapper{child1, child2};
}();

auto agg = cudf::make_min_aggregation<groupby_aggregation>();
test_single_agg(keys, vals, expect_keys, expect_vals, std::move(agg));
}

} // namespace test
} // namespace cudf
58 changes: 35 additions & 23 deletions cpp/tests/transpose/transpose_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019, NVIDIA CORPORATION.
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -22,9 +22,9 @@
#include <algorithm>
#include <limits>
#include <random>
#include <string>

namespace {
using cudf::test::fixed_width_column_wrapper;

template <typename T, typename F>
auto generate_vectors(size_t ncols, size_t nrows, F generator)
Expand Down Expand Up @@ -59,10 +59,10 @@ auto transpose_vectors(std::vector<std::vector<T>> const& input)
return transposed;
}

template <typename T>
template <typename T, typename ColumnWrapper>
auto make_columns(std::vector<std::vector<T>> const& values)
{
std::vector<fixed_width_column_wrapper<T>> columns;
std::vector<ColumnWrapper> columns;
columns.reserve(values.size());

for (auto const& value_col : values) {
Expand All @@ -72,11 +72,11 @@ auto make_columns(std::vector<std::vector<T>> const& values)
return columns;
}

template <typename T>
template <typename T, typename ColumnWrapper>
auto make_columns(std::vector<std::vector<T>> const& values,
std::vector<std::vector<cudf::size_type>> const& valids)
{
std::vector<fixed_width_column_wrapper<T>> columns;
std::vector<ColumnWrapper> columns;
columns.reserve(values.size());

for (size_t col = 0; col < values.size(); ++col) {
Expand All @@ -86,31 +86,34 @@ auto make_columns(std::vector<std::vector<T>> const& values,
return columns;
}

template <typename T>
auto make_table_view(std::vector<fixed_width_column_wrapper<T>> const& cols)
template <typename ColumnWrapper>
auto make_table_view(std::vector<ColumnWrapper> const& cols)
{
std::vector<cudf::column_view> views(cols.size());

std::transform(
cols.begin(), cols.end(), views.begin(), [](fixed_width_column_wrapper<T> const& col) {
return static_cast<cudf::column_view>(col);
});
std::transform(cols.begin(), cols.end(), views.begin(), [](auto const& col) {
return static_cast<cudf::column_view>(col);
});

return cudf::table_view(views);
}

template <typename T>
void run_test(size_t ncols, size_t nrows, bool add_nulls)
{
using ColumnWrapper = std::conditional_t<std::is_same_v<T, std::string>,
cudf::test::strings_column_wrapper,
cudf::test::fixed_width_column_wrapper<T>>;

std::mt19937 rng(1);

// Generate values as vector of vectors
auto const values = generate_vectors<T>(
ncols, nrows, [&rng]() { return cudf::test::make_type_param_scalar<T>(rng()); });
auto const valuesT = transpose_vectors(values);

std::vector<fixed_width_column_wrapper<T>> input_cols;
std::vector<fixed_width_column_wrapper<T>> expected_cols;
std::vector<ColumnWrapper> input_cols;
std::vector<ColumnWrapper> expected_cols;
std::vector<cudf::size_type> expected_nulls(nrows);

if (add_nulls) {
Expand All @@ -129,11 +132,11 @@ void run_test(size_t ncols, size_t nrows, bool add_nulls)
});

// Create column wrappers from vector of vectors
input_cols = make_columns(values, valids);
expected_cols = make_columns(valuesT, validsT);
input_cols = make_columns<T, ColumnWrapper>(values, valids);
expected_cols = make_columns<T, ColumnWrapper>(valuesT, validsT);
} else {
input_cols = make_columns(values);
expected_cols = make_columns(valuesT);
input_cols = make_columns<T, ColumnWrapper>(values);
expected_cols = make_columns<T, ColumnWrapper>(valuesT);
}

// Create table views from column wrappers
Expand All @@ -158,7 +161,13 @@ template <typename T>
class TransposeTest : public cudf::test::BaseFixture {
};

TYPED_TEST_SUITE(TransposeTest, cudf::test::FixedWidthTypes);
// Using std::string here instead of cudf::test::StringTypes allows us to
// use std::vector<T> utilities in this file just like the fixed-width types.
// Should consider changing cudf::test::StringTypes to std::string instead of cudf::string_view.
using StdStringType = cudf::test::Types<std::string>;
using TransposeTypes = cudf::test::Concat<cudf::test::FixedWidthTypes, StdStringType>;

TYPED_TEST_SUITE(TransposeTest, TransposeTypes); // cudf::test::FixedWidthTypes);

TYPED_TEST(TransposeTest, SingleValue) { run_test<TypeParam>(1, 1, false); }

Expand All @@ -182,11 +191,14 @@ TYPED_TEST(TransposeTest, EmptyTable) { run_test<TypeParam>(0, 0, false); }

TYPED_TEST(TransposeTest, EmptyColumns) { run_test<TypeParam>(10, 0, false); }

TYPED_TEST(TransposeTest, MismatchedColumns)
class TransposeTestError : public cudf::test::BaseFixture {
};

TEST_F(TransposeTestError, MismatchedColumns)
{
fixed_width_column_wrapper<TypeParam, int32_t> col1({1, 2, 3});
fixed_width_column_wrapper<int8_t> col2{{4, 5, 6}};
fixed_width_column_wrapper<float> col3{{7, 8, 9}};
cudf::test::fixed_width_column_wrapper<uint32_t, int32_t> col1({1, 2, 3});
cudf::test::fixed_width_column_wrapper<int8_t> col2{{4, 5, 6}};
cudf::test::fixed_width_column_wrapper<float> col3{{7, 8, 9}};
cudf::table_view input{{col1, col2, col3}};
EXPECT_THROW(cudf::transpose(input), cudf::logic_error);
}
Expand Down
Loading

0 comments on commit baf2250

Please sign in to comment.