Skip to content

Commit a77f1a3

Browse files
authored
Correctly handle empty string value in json (apache#130)
1 parent 5cc4082 commit a77f1a3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cpp/src/gandiva/json_holder.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,11 @@ const uint8_t* JsonHolder::operator()(gandiva::ExecutionContext* ctx, const std:
121121
if (error) {
122122
return nullptr;
123123
}
124+
124125
*out_len = res.length();
126+
if (*out_len == 0) {
127+
return reinterpret_cast<const uint8_t*>("");
128+
}
125129
uint8_t* result_buffer = reinterpret_cast<uint8_t*>(ctx->arena()->Allocate(*out_len));
126130
memcpy(result_buffer, res.data(), *out_len);
127131
return result_buffer;

0 commit comments

Comments
 (0)