Skip to content

Commit

Permalink
Fix deprecation warnings for json legacy reader (#15563)
Browse files Browse the repository at this point in the history
Fixes deprecation warnings caused by changes in #15558 
Most are in the `json_test.cpp` and appear like this
```
[150+7+50=206] Building CXX object tests/CMakeFiles/JSON_TEST.dir/io/json_test.cpp.o
/cudf/cpp/tests/io/json_test.cpp: In member function 'virtual void JsonReaderParamTest_BasicJsonLines_Test::TestBody()':
/cudf/cpp/tests/io/json_test.cpp:320:14: warning: 'cudf::io::json_reader_options_builder& cudf::io::json_reader_options_builder::legacy(bool)' is deprecated [-Wdeprecated-declarations]
  317 |     cudf::io::json_reader_options::builder(cudf::io::source_info{data.data(), data.size()})
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  318 |       .dtypes(std::vector<data_type>{dtype<int32_t>(), dtype<double>()})
      |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  319 |       .lines(true)
      |       ~~~~~~~~~~~~
  320 |       .legacy(is_legacy_test(test_opt));
      |       ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /cudf/cpp/tests/io/json_test.cpp:30:

```
Compiler warnings usually result in errors when building libcudf.

This PR removes calls and references to legacy JSON reader features where possible.

Authors:
  - David Wendt (https://github.com/davidwendt)

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

URL: #15563
  • Loading branch information
davidwendt authored Apr 18, 2024
1 parent b8d003e commit 7b9e815
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 117 deletions.
4 changes: 4 additions & 0 deletions cpp/src/io/json/read_json.cu
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,13 @@ table_with_metadata read_json(host_span<std::unique_ptr<datasource>> sources,
{
CUDF_FUNC_RANGE();

// TODO remove this if-statement once legacy is removed
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
if (reader_opts.is_enabled_legacy()) {
return legacy::read_json(sources, reader_opts, stream, mr);
}
#pragma GCC diagnostic pop

if (reader_opts.get_byte_range_offset() != 0 or reader_opts.get_byte_range_size() != 0) {
CUDF_EXPECTS(reader_opts.is_enabled_lines(),
Expand Down
Loading

0 comments on commit 7b9e815

Please sign in to comment.