Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Nov 5, 2024
1 parent 2ade7f7 commit 901ea92
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMake/resolve_dependency_modules/simdjson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ message(STATUS "Building simdjson from source")
FetchContent_Declare(
simdjson
URL ${VELOX_SIMDJSON_SOURCE_URL}
URL_HASH ${VELOX_SIMDJSON_BUILD_SHA256_CHECKSUM})
URL_HASH ${VELOX_SIMDJSON_BUILD_SHA256_CHECKSUM}
PATCH_COMMAND
git init && git apply
${CMAKE_CURRENT_LIST_DIR}/simdjson/fix-control-char.patch)

FetchContent_MakeAvailable(simdjson)
24 changes: 24 additions & 0 deletions CMake/resolve_dependency_modules/simdjson/fix-control-char.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/src/fallback.cpp b/src/fallback.cpp
index f8e87be0..1bbbd67a 100644
--- a/src/fallback.cpp
+++ b/src/fallback.cpp
@@ -130,7 +130,6 @@ simdjson_inline bool validate_string() {
} else if (simdjson_unlikely(buf[idx] & 0x80)) {
validate_utf8_character();
} else {
- if (buf[idx] < 0x20) { error = UNESCAPED_CHARS; }
idx++;
}
}
diff --git a/src/generic/stage1/json_structural_indexer.h b/src/generic/stage1/json_structural_indexer.h
index cfdedf01..d7c58816 100644
--- a/src/generic/stage1/json_structural_indexer.h
+++ b/src/generic/stage1/json_structural_indexer.h
@@ -243,7 +243,6 @@ simdjson_inline void json_structural_indexer::next(const simd::simd8x64<uint8_t>
#endif
indexer.write(uint32_t(idx-64), prev_structurals); // Output *last* iteration's structurals to the parser
prev_structurals = block.structural_start();
- unescaped_chars_error |= block.non_quote_inside_string(unescaped);
}

simdjson_inline error_code json_structural_indexer::finish(dom_parser_implementation &parser, size_t idx, size_t len, stage1_mode partial) {
3 changes: 3 additions & 0 deletions velox/functions/prestosql/tests/JsonFunctionsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,9 @@ TEST_F(JsonFunctionsTest, jsonExtract) {
VELOX_ASSERT_THROW(
jsonExtract(kJson, "concat($..category)"), "Invalid JSON path");
VELOX_ASSERT_THROW(jsonExtract(kJson, "$.store.keys()"), "Invalid JSON path");

// Test json with control character.
EXPECT_EQ(jsonExtract("{\"c1\":\"ab\ncd\"}", "$.c1"), "\"ab\ncd\"");
}

} // namespace
Expand Down

0 comments on commit 901ea92

Please sign in to comment.