From 45a929fb85c1b9436955ead3b96d22f10af333d9 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Mon, 30 Sep 2024 15:45:35 -0700 Subject: [PATCH] Fix start character Signed-off-by: Nghia Truong --- src/main/cpp/src/json_utils.cu | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/cpp/src/json_utils.cu b/src/main/cpp/src/json_utils.cu index 06865ec81..0edebc42c 100644 --- a/src/main/cpp/src/json_utils.cu +++ b/src/main/cpp/src/json_utils.cu @@ -88,6 +88,14 @@ std::tuple, std::unique_ptr, c if (is_null_literal) { return {false, true}; } auto const not_eol = i < d_str.size_bytes(); + + // If the first row is not null or empty, it should start with `{`. + // Otherwise, we need to replace it by a null. + // This is necessary for libcudf's JSON reader to work. + // Note that if we want to support ARRAY schema, we need to check for either `{` or `[`. + auto constexpr start_character = '{'; + if (not_eol && d_str[i] != start_character) { return {false, true}; } + return {not_eol, not_eol}; });