From d3d848b0fa10a9ff44fe3753c5c5b28bb9ef40b2 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 31 Aug 2023 13:27:41 -0700 Subject: [PATCH 1/3] Modify empty value into space character --- java/src/main/native/src/TableJni.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/java/src/main/native/src/TableJni.cpp b/java/src/main/native/src/TableJni.cpp index f7ada4305db..68ca3563410 100644 --- a/java/src/main/native/src/TableJni.cpp +++ b/java/src/main/native/src/TableJni.cpp @@ -1592,7 +1592,11 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetBufferBegin( std::map kv_metadata; std::transform(meta_keys.begin(), meta_keys.end(), meta_values.begin(), std::inserter(kv_metadata, kv_metadata.end()), - [](auto const &key, auto const &value) { return std::make_pair(key, value); }); + [](auto const &key, auto const &value) { + // The metadata value will be ignored if it is empty. + // As such, we modify it into a space character instead. + return std::make_pair(key, value.empty() ? std::string(" ") : value); + }); auto stats = std::make_shared(); chunked_parquet_writer_options opts = @@ -1638,7 +1642,11 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetFileBegin( std::map kv_metadata; std::transform(meta_keys.begin(), meta_keys.end(), meta_values.begin(), std::inserter(kv_metadata, kv_metadata.end()), - [](auto const &key, auto const &value) { return std::make_pair(key, value); }); + [](auto const &key, + auto const &value) { // The metadata value will be ignored if it is empty. + // As such, we modify it into a space character instead. + return std::make_pair(key, value.empty() ? std::string(" ") : value); + }); sink_info sink{output_path.get()}; auto stats = std::make_shared(); From 40def49fd2ad3696f3d7ee129d3b62e72ad910bb Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 31 Aug 2023 13:35:44 -0700 Subject: [PATCH 2/3] Fix style --- java/src/main/native/src/TableJni.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/main/native/src/TableJni.cpp b/java/src/main/native/src/TableJni.cpp index 68ca3563410..c64792db963 100644 --- a/java/src/main/native/src/TableJni.cpp +++ b/java/src/main/native/src/TableJni.cpp @@ -1642,8 +1642,8 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetFileBegin( std::map kv_metadata; std::transform(meta_keys.begin(), meta_keys.end(), meta_values.begin(), std::inserter(kv_metadata, kv_metadata.end()), - [](auto const &key, - auto const &value) { // The metadata value will be ignored if it is empty. + [](auto const &key, auto const &value) { + // The metadata value will be ignored if it is empty. // As such, we modify it into a space character instead. return std::make_pair(key, value.empty() ? std::string(" ") : value); }); From fd4d570fca7818e9d82b675cfe14ed3c6ce93ab4 Mon Sep 17 00:00:00 2001 From: Nghia Truong Date: Thu, 31 Aug 2023 14:14:39 -0700 Subject: [PATCH 3/3] Change comment --- java/src/main/native/src/TableJni.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/main/native/src/TableJni.cpp b/java/src/main/native/src/TableJni.cpp index c64792db963..b05fc9b7bc4 100644 --- a/java/src/main/native/src/TableJni.cpp +++ b/java/src/main/native/src/TableJni.cpp @@ -1594,7 +1594,7 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetBufferBegin( std::inserter(kv_metadata, kv_metadata.end()), [](auto const &key, auto const &value) { // The metadata value will be ignored if it is empty. - // As such, we modify it into a space character instead. + // We modify it into a space character to workaround such issue. return std::make_pair(key, value.empty() ? std::string(" ") : value); }); @@ -1644,7 +1644,7 @@ JNIEXPORT long JNICALL Java_ai_rapids_cudf_Table_writeParquetFileBegin( std::inserter(kv_metadata, kv_metadata.end()), [](auto const &key, auto const &value) { // The metadata value will be ignored if it is empty. - // As such, we modify it into a space character instead. + // We modify it into a space character to workaround such issue. return std::make_pair(key, value.empty() ? std::string(" ") : value); });