Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion velox/functions/prestosql/json/JsonStringUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ unescapeSizeForJsonFunctions(const char* input, size_t length, bool fully) {
case 'f':
case 'r':
case 't':
case '\\':
case '"': {
if (fully) {
++outSize;
Expand Down Expand Up @@ -598,7 +599,7 @@ size_t unescapeSizeForJsonCast(const char* input, size_t length) {
return unescapeSizeForJsonFunctions(input, length, false);
}

void unescapeForJsonFunctions(
size_t unescapeForJsonFunctions(
const char* input,
size_t length,
char* output,
Expand Down Expand Up @@ -663,6 +664,7 @@ void unescapeForJsonFunctions(
case 'f':
case 'r':
case 't':
case '\\':
case '"': {
if (fully) {
size_t index = 0;
Expand Down Expand Up @@ -706,6 +708,7 @@ void unescapeForJsonFunctions(
}
}
}
return pos - output;
}
void unescapeForJsonCast(const char* input, size_t length, char* output) {
unescapeForJsonFunctions(input, length, output, false);
Expand Down
3 changes: 2 additions & 1 deletion velox/functions/prestosql/json/JsonStringUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ inline bool needNormalizeForJsonParse(const char* input, size_t length) {
/// @param output: Output string to write the unescaped input to.
/// @param fully: If true, unescape all characters. If false, unescape only
/// unicode and forward slash. The false case is used for json cast.
void unescapeForJsonFunctions(
/// @return The number of bytes written to the output.
size_t unescapeForJsonFunctions(
const char* input,
size_t length,
char* output,
Expand Down
Loading