mirror of
https://github.com/apache/arrow.git
synced 2026-10-29 00:56:31 +08:00
ARROW-5419: [C++] Allow recognizing empty strings as null strings in CSV files
This commit is contained in:
1 parent
f82af62dfd
commit
cb086d1c25
3 files changed
+4
-4
No files matched your search
@@ -15,7 +15,7 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
benchmark
|
||||
benchmark=1.4.1
|
||||
boost-cpp>=1.68.0
|
||||
brotli
|
||||
bzip2
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user