diff --git a/cpp/src/io/json/process_tokens.cu b/cpp/src/io/json/process_tokens.cu index 38c16a25057..d41d137a2c9 100644 --- a/cpp/src/io/json/process_tokens.cu +++ b/cpp/src/io/json/process_tokens.cu @@ -97,19 +97,16 @@ void validate_token_stream(device_span d_input, literals.emplace_back("null"); // added these too to single trie literals.emplace_back("true"); literals.emplace_back("false"); - std::vector nonnumeric{"NaN", "Infinity", "+INF", "+Infinity", "-INF", "-Infinity"}; cudf::detail::optional_trie trie_literals = cudf::detail::create_serialized_trie(literals, stream); - auto trie_literals_view = cudf::detail::make_trie_view(trie_literals); - cudf::detail::optional_trie trie_nonnumeric = - cudf::detail::create_serialized_trie(nonnumeric, stream); - auto trie_nonnumeric_view = cudf::detail::make_trie_view(trie_nonnumeric); + cudf::detail::optional_trie trie_nonnumeric = cudf::detail::create_serialized_trie( + {"NaN", "Infinity", "+INF", "+Infinity", "-INF", "-Infinity"}, stream); auto validate_values = cuda::proclaim_return_type( [data = d_input.data(), - trie_literals = trie_literals_view, - trie_nonnumeric = trie_nonnumeric_view, + trie_literals = cudf::detail::make_trie_view(trie_literals), + trie_nonnumeric = cudf::detail::make_trie_view(trie_nonnumeric), allow_numeric_leading_zeros = options.is_allowed_numeric_leading_zeros(), allow_nonnumeric = options.is_allowed_nonnumeric_numbers()] __device__(SymbolOffsetT start, @@ -117,13 +114,14 @@ void validate_token_stream(device_span d_input, // This validates an unquoted value. A value must match https://www.json.org/json-en.html // but the leading and training whitespace should already have been removed, and is not // a string - auto c = data[start]; - auto is_literal = serialized_trie_contains(trie_literals, {data + start, end - start}); + auto const is_literal = serialized_trie_contains(trie_literals, {data + start, end - start}); if (is_literal) { return true; } if (allow_nonnumeric) { - auto is_literal = serialized_trie_contains(trie_nonnumeric, {data + start, end - start}); - if (is_literal) { return true; } + auto const is_nonnumeric = + serialized_trie_contains(trie_nonnumeric, {data + start, end - start}); + if (is_nonnumeric) { return true; } } + auto c = data[start]; if ('-' == c || c <= '9' && 'c' >= '0') { // number auto num_state = number_state::START;