This is an automated email from the ASF dual-hosted git repository.

emkornfield pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 1643c1e  ARROW-5419: [C++] Allow recognizing empty strings as null 
strings in CSV files
1643c1e is described below

commit 1643c1ecb3eac7db0b273097f9476621f8297a9c
Author: Antoine Pitrou <anto...@python.org>
AuthorDate: Tue May 28 23:22:28 2019 -0700

    ARROW-5419: [C++] Allow recognizing empty strings as null strings in CSV 
files
    
    Author: Antoine Pitrou <anto...@python.org>
    
    Closes #4396 from pitrou/ARROW-5419-csv-empty-null-strings and squashes the 
following commits:
    
    cb086d1c <Antoine Pitrou> ARROW-5419:  Allow recognizing empty strings as 
null strings in CSV files
---
 cpp/src/arrow/csv/converter-test.cc | 4 ++--
 cpp/src/arrow/csv/converter.cc      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpp/src/arrow/csv/converter-test.cc 
b/cpp/src/arrow/csv/converter-test.cc
index e3612e7..105131f 100644
--- a/cpp/src/arrow/csv/converter-test.cc
+++ b/cpp/src/arrow/csv/converter-test.cc
@@ -130,7 +130,7 @@ TEST(BinaryConversion, Nulls) {
   options.strings_can_be_null = true;
   AssertConversion<BinaryType, std::string>(binary(), {"ab,N/A\n", "NULL,\n"},
                                             {{"ab", ""}, {"", ""}},
-                                            {{true, false}, {false, true}}, 
options);
+                                            {{true, false}, {false, false}}, 
options);
 }
 
 TEST(StringConversion, Basics) {
@@ -152,7 +152,7 @@ TEST(StringConversion, Nulls) {
   options.strings_can_be_null = true;
   AssertConversion<StringType, std::string>(utf8(), {"ab,N/A\n", "NULL,\n"},
                                             {{"ab", ""}, {"", ""}},
-                                            {{true, false}, {false, true}}, 
options);
+                                            {{true, false}, {false, false}}, 
options);
 }
 
 TEST(StringConversion, Errors) {
diff --git a/cpp/src/arrow/csv/converter.cc b/cpp/src/arrow/csv/converter.cc
index d1ff8d7..6304c55 100644
--- a/cpp/src/arrow/csv/converter.cc
+++ b/cpp/src/arrow/csv/converter.cc
@@ -144,7 +144,7 @@ class VarSizeBinaryConverter : public ConcreteConverter {
 
     if (options_.strings_can_be_null) {
       auto visit = [&](const uint8_t* data, uint32_t size, bool quoted) -> 
Status {
-        if (size > 0 && IsNull(data, size, false /* quoted */)) {
+        if (IsNull(data, size, false /* quoted */)) {
           builder.UnsafeAppendNull();
           return Status::OK();
         } else {

Reply via email to