Skip to content

Commit

Permalink
Fix unused variables and functions (rapidsai#13275)
Browse files Browse the repository at this point in the history
Removed unused variables and functions.
Removed src/io/utilities/type_conversion.cpp/hpp
Rename some variables which are shadowed by other variables to avoid confusion.

Authors:
  - Karthikeyan (https://github.com/karthikeyann)

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Vukasin Milovanovic (https://github.com/vuule)
  - Bradley Dice (https://github.com/bdice)

URL: rapidsai#13275
  • Loading branch information
karthikeyann authored May 3, 2023
1 parent bc3b90f commit ed4c021
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 147 deletions.
1 change: 0 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ add_library(
src/io/utilities/parsing_utils.cu
src/io/utilities/row_selection.cpp
src/io/utilities/trie.cu
src/io/utilities/type_conversion.cpp
src/jit/cache.cpp
src/jit/parser.cpp
src/jit/util.cpp
Expand Down
2 changes: 0 additions & 2 deletions cpp/src/binaryop/binaryop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ void binary_operation(mutable_column_view& out,
{
std::string const output_type_name = cudf::type_to_name(out.type());

std::string ptx_hash =
"prog_binop." + std::to_string(std::hash<std::string>{}(ptx + output_type_name));
std::string cuda_source =
cudf::jit::parse_single_function_ptx(ptx, "GENERIC_BINARY_OP", output_type_name);

Expand Down
5 changes: 2 additions & 3 deletions cpp/src/copying/split.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022, NVIDIA CORPORATION.
* Copyright (c) 2019-2023, 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 @@ -61,8 +61,7 @@ std::vector<cudf::table_view> split(cudf::table_view const& input,
host_span<size_type const> splits,
rmm::cuda_stream_view stream)
{
std::vector<table_view> result{};
if (input.num_columns() == 0) { return result; }
if (input.num_columns() == 0) { return {}; }
return split(input, input.column(0).size(), splits, stream);
}

Expand Down
1 change: 0 additions & 1 deletion cpp/src/io/csv/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <io/utilities/column_buffer.hpp>
#include <io/utilities/hostdevice_vector.hpp>
#include <io/utilities/parsing_utils.cuh>
#include <io/utilities/type_conversion.hpp>

#include <cudf/detail/utilities/cuda.cuh>
#include <cudf/detail/utilities/vector_factories.hpp>
Expand Down
1 change: 0 additions & 1 deletion cpp/src/io/json/reader_impl.cu
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <io/comp/io_uncomp.hpp>
#include <io/utilities/column_buffer.hpp>
#include <io/utilities/parsing_utils.cuh>
#include <io/utilities/type_conversion.hpp>

#include <cudf/column/column_factories.hpp>
#include <cudf/detail/nvtx/ranges.hpp>
Expand Down
70 changes: 0 additions & 70 deletions cpp/src/io/utilities/type_conversion.cpp

This file was deleted.

31 changes: 0 additions & 31 deletions cpp/src/io/utilities/type_conversion.hpp

This file was deleted.

3 changes: 0 additions & 3 deletions cpp/tests/binaryop/binop-compiled-fixed_point-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ TYPED_TEST(FixedPointCompiledTest, FixedPointBinaryOpNullMaxSimple)
using decimalXX = TypeParam;
using RepType = cudf::device_storage_type_t<decimalXX>;

auto const trues = std::vector<bool>(4, true);
auto const col1 = fp_wrapper<RepType>{{40, 30, 20, 10, 0}, {1, 0, 1, 1, 0}, scale_type{-2}};
auto const col2 = fp_wrapper<RepType>{{10, 20, 30, 40, 0}, {1, 1, 1, 0, 0}, scale_type{-2}};
auto const expected = fp_wrapper<RepType>{{40, 20, 30, 10, 0}, {1, 1, 1, 1, 0}, scale_type{-2}};
Expand All @@ -475,7 +474,6 @@ TYPED_TEST(FixedPointCompiledTest, FixedPointBinaryOpNullMinSimple)
using decimalXX = TypeParam;
using RepType = cudf::device_storage_type_t<decimalXX>;

auto const trues = std::vector<bool>(4, true);
auto const col1 = fp_wrapper<RepType>{{40, 30, 20, 10, 0}, {1, 1, 1, 0, 0}, scale_type{-1}};
auto const col2 = fp_wrapper<RepType>{{10, 20, 30, 40, 0}, {1, 0, 1, 1, 0}, scale_type{-1}};
auto const expected = fp_wrapper<RepType>{{10, 30, 20, 40, 0}, {1, 1, 1, 1, 0}, scale_type{-1}};
Expand All @@ -495,7 +493,6 @@ TYPED_TEST(FixedPointCompiledTest, FixedPointBinaryOpNullEqualsSimple)
using decimalXX = TypeParam;
using RepType = cudf::device_storage_type_t<decimalXX>;

auto const trues = std::vector<bool>(4, true);
auto const col1 = fp_wrapper<RepType>{{400, 300, 300, 100}, {1, 1, 1, 0}, scale_type{-2}};
auto const col2 = fp_wrapper<RepType>{{40, 200, 20, 400}, {1, 0, 1, 0}, scale_type{-1}};
auto const expected = wrapper<bool>{{1, 0, 0, 1}, {1, 1, 1, 1}};
Expand Down
1 change: 0 additions & 1 deletion cpp/tests/copying/concatenate_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ TEST_F(StringColumnTest, ConcatenateTooManyColumns)
std::vector<const char*> expected_strings;
std::vector<cudf::test::strings_column_wrapper> wrappers;
std::vector<cudf::column_view> strings_columns;
std::string expected_string;
for (int i = 0; i < 200; ++i) {
wrappers.emplace_back(h_strings.data(), h_strings.data() + h_strings.size());
strings_columns.push_back(wrappers[i]);
Expand Down
3 changes: 0 additions & 3 deletions cpp/tests/copying/pack_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ std::vector<std::unique_ptr<cudf::column>> generate_structs(bool include_validit
// 1. String "names" column.
std::vector<std::string> names{
"Vimes", "Carrot", "Angua", "Cheery", "Detritus", "Slant", "Fred", "Todd", "Kevin"};
std::vector<bool> names_validity{1, 1, 1, 1, 1, 1, 1, 1, 1};
cudf::test::strings_column_wrapper names_column(names.begin(), names.end());

// 2. Numeric "ages" column.
Expand Down Expand Up @@ -198,7 +197,6 @@ std::vector<std::unique_ptr<cudf::column>> generate_struct_of_list()
// 1. String "names" column.
std::vector<std::string> names{
"Vimes", "Carrot", "Angua", "Cheery", "Detritus", "Slant", "Fred", "Todd", "Kevin"};
std::vector<bool> names_validity{1, 1, 1, 1, 1, 1, 1, 1, 1};
cudf::test::strings_column_wrapper names_column(names.begin(), names.end());

// 2. Numeric "ages" column.
Expand Down Expand Up @@ -251,7 +249,6 @@ std::vector<std::unique_ptr<cudf::column>> generate_list_of_struct()
"Seventeen",
"Dol",
"Est"};
std::vector<bool> names_validity{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1};
cudf::test::strings_column_wrapper names_column(names.begin(), names.end());

// 2. Numeric "ages" column.
Expand Down
4 changes: 2 additions & 2 deletions cpp/tests/copying/slice_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ TYPED_TEST(SliceTest, NumericColumnsWithNullsAsColumn)
auto valids =
cudf::detail::make_counting_transform_iterator(start, [](auto i) { return i % 2 == 0; });

cudf::test::fixed_width_column_wrapper<T> col = create_fixed_columns<T>(start, size, valids);
cudf::test::fixed_width_column_wrapper<T> input = create_fixed_columns<T>(start, size, valids);

std::vector<cudf::size_type> indices{1, 3, 2, 2, 5, 9};
std::vector<cudf::test::fixed_width_column_wrapper<T>> expected =
create_expected_columns<T>(indices, true);
std::vector<cudf::column_view> result = cudf::slice(col, indices);
std::vector<cudf::column_view> result = cudf::slice(input, indices);

EXPECT_EQ(expected.size(), result.size());

Expand Down
1 change: 0 additions & 1 deletion cpp/tests/copying/split_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1978,7 +1978,6 @@ TEST_F(ContiguousSplitNestedTypesTest, ListOfStruct)
"Mark",
"Herman",
"Will"};
std::vector<bool> names_validity{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
cudf::test::strings_column_wrapper names_column(names.begin(), names.end());

// 2. Numeric "ages" column.
Expand Down
2 changes: 0 additions & 2 deletions cpp/tests/dictionary/gather_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ TEST_F(DictionaryGatherTest, SortStrings)
auto dictionary = cudf::dictionary::encode(strings);
cudf::dictionary_column_view view(dictionary->view());

std::vector<cudf::order> column_order{cudf::order::ASCENDING};
auto result = cudf::sort(cudf::table_view{{dictionary->view()}},
std::vector<cudf::order>{cudf::order::ASCENDING})
->release();
Expand All @@ -85,7 +84,6 @@ TEST_F(DictionaryGatherTest, SortFloat)
auto dictionary = cudf::dictionary::encode(data);
cudf::dictionary_column_view view(dictionary->view());

std::vector<cudf::order> column_order{cudf::order::ASCENDING};
auto result = cudf::sort(cudf::table_view{{dictionary->view()}},
std::vector<cudf::order>{cudf::order::ASCENDING})
->release();
Expand Down
2 changes: 1 addition & 1 deletion cpp/tests/io/parquet_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4419,7 +4419,7 @@ TEST_F(ParquetWriterTest, CheckColumnOffsetIndexStruct)

// hard coded schema indices.
// TODO find a way to do this without magic
size_t colidxs[] = {1, 3, 4, 5, 8};
size_t const colidxs[] = {1, 3, 4, 5, 8};
for (size_t r = 0; r < fmd.row_groups.size(); r++) {
auto const& rg = fmd.row_groups[r];
for (size_t c = 0; c < rg.columns.size(); c++) {
Expand Down
16 changes: 4 additions & 12 deletions cpp/tests/io/text/multibyte_split_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,7 @@ TEST_F(MultibyteSplitTest, HandpickedInput)

TEST_F(MultibyteSplitTest, LargeInputMultipleRange)
{
auto host_input = std::string();
auto host_expected = std::vector<std::string>();

auto host_input = std::string();
for (auto i = 0; i < (2 * 32 * 128 * 1024); i++) {
host_input += "...:|";
}
Expand All @@ -293,9 +291,7 @@ TEST_F(MultibyteSplitTest, LargeInputMultipleRange)

TEST_F(MultibyteSplitTest, LargeInputSparseMultipleRange)
{
auto host_input = std::string();
auto host_expected = std::vector<std::string>();

auto host_input = std::string();
for (auto i = 0; i < (2 * 32 * 128 * 1024); i++) {
host_input += ".....";
}
Expand All @@ -321,9 +317,7 @@ TEST_F(MultibyteSplitTest, LargeInputSparseMultipleRange)

TEST_F(MultibyteSplitTest, LargeInputMultipleRangeSingleByte)
{
auto host_input = std::string();
auto host_expected = std::vector<std::string>();

auto host_input = std::string();
for (auto i = 0; i < (2 * 32 * 128 * 1024); i++) {
host_input += "...:|";
}
Expand All @@ -347,9 +341,7 @@ TEST_F(MultibyteSplitTest, LargeInputMultipleRangeSingleByte)

TEST_F(MultibyteSplitTest, LargeInputSparseMultipleRangeSingleByte)
{
auto host_input = std::string();
auto host_expected = std::vector<std::string>();

auto host_input = std::string();
for (auto i = 0; i < (2 * 32 * 128 * 1024); i++) {
host_input += ".....";
}
Expand Down
4 changes: 0 additions & 4 deletions cpp/tests/partitioning/hash_partition_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ TEST_F(HashPartition, IdentityHashFailure)
auto columns_to_hash = std::vector<cudf::size_type>({2});

cudf::size_type const num_partitions = 3;
std::unique_ptr<cudf::table> output;
std::vector<cudf::size_type> offsets;
EXPECT_THROW(
cudf::hash_partition(input, columns_to_hash, num_partitions, cudf::hash_id::HASH_IDENTITY),
cudf::logic_error);
Expand All @@ -203,8 +201,6 @@ TEST_F(HashPartition, UnsupportedHashFunction)
auto columns_to_hash = std::vector<cudf::size_type>({2});

cudf::size_type const num_partitions = 3;
std::unique_ptr<cudf::table> output;
std::vector<cudf::size_type> offsets;
EXPECT_THROW(
cudf::hash_partition(input, columns_to_hash, num_partitions, cudf::hash_id::HASH_MD5),
cudf::logic_error);
Expand Down
16 changes: 8 additions & 8 deletions cpp/tests/reductions/reduction_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1771,8 +1771,8 @@ TYPED_TEST(FixedPointTestAllReps, FixedPointReductionMedianOddNumberOfElements)
using RepType = cudf::device_storage_type_t<decimalXX>;
using fp_wrapper = cudf::test::fixed_point_column_wrapper<RepType>;

for (auto const i : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{i};
for (auto const s : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{s};
auto const column = fp_wrapper{{1, 2, 2, 3, 4}, scale};
auto const out_type = static_cast<cudf::column_view>(column).type();
auto const expected = decimalXX{scaled_integer<RepType>{2, scale}};
Expand All @@ -1792,8 +1792,8 @@ TYPED_TEST(FixedPointTestAllReps, FixedPointReductionMedianEvenNumberOfElements)
using RepType = cudf::device_storage_type_t<decimalXX>;
using fp_wrapper = cudf::test::fixed_point_column_wrapper<RepType>;

for (auto const i : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{i};
for (auto const s : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{s};
auto const column = fp_wrapper{{10, 20, 20, 30, 30, 40}, scale};
auto const out_type = static_cast<cudf::column_view>(column).type();
auto const expected = decimalXX{scaled_integer<RepType>{25, scale}};
Expand All @@ -1813,8 +1813,8 @@ TYPED_TEST(FixedPointTestAllReps, FixedPointReductionQuantile)
using RepType = cudf::device_storage_type_t<decimalXX>;
using fp_wrapper = cudf::test::fixed_point_column_wrapper<RepType>;

for (auto const i : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{i};
for (auto const s : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{s};
auto const column = fp_wrapper{{1, 2, 3, 4, 5}, scale};
auto const out_type = static_cast<cudf::column_view>(column).type();

Expand All @@ -1837,8 +1837,8 @@ TYPED_TEST(FixedPointTestAllReps, FixedPointReductionNthElement)
using RepType = cudf::device_storage_type_t<decimalXX>;
using fp_wrapper = cudf::test::fixed_point_column_wrapper<RepType>;

for (auto const i : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{i};
for (auto const s : {0, -1, -2, -3, -4}) {
auto const scale = scale_type{s};
auto const values = std::vector<RepType>{4104, 42, 1729, 55};
auto const column = fp_wrapper{values.cbegin(), values.cend(), scale};
auto const out_type = static_cast<cudf::column_view>(column).type();
Expand Down
3 changes: 2 additions & 1 deletion cpp/tests/strings/durations_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ TEST_F(StringsDurationsTest, ISOFormatDaysOnly)
auto new_durations1 = cudf::strings::to_durations(cudf::strings_column_view(string_iso),
cudf::data_type(cudf::type_to_id<T>()),
"P%DDT%HH%MM%SS");
new_durations1 = cudf::strings::to_durations(
CUDF_TEST_EXPECT_COLUMNS_EQUAL(*new_durations1, durations);
new_durations1 = cudf::strings::to_durations(
cudf::strings_column_view(expected1), cudf::data_type(cudf::type_to_id<T>()), "P%DDT%HH%MM%SS");
CUDF_TEST_EXPECT_COLUMNS_EQUAL(*new_durations1, durations);
auto new_durations2 = cudf::strings::to_durations(
Expand Down

0 comments on commit ed4c021

Please sign in to comment.