From 0c63bac4aeb7945a7e5ab7c14fae603a8f31e1e2 Mon Sep 17 00:00:00 2001 From: PHILO-HE Date: Tue, 4 Jun 2024 14:26:50 +0800 Subject: [PATCH] Fix compile error --- velox/functions/sparksql/JsonFunctions.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/velox/functions/sparksql/JsonFunctions.h b/velox/functions/sparksql/JsonFunctions.h index 3e409f5b91ab..8b8c0c0790f7 100644 --- a/velox/functions/sparksql/JsonFunctions.h +++ b/velox/functions/sparksql/JsonFunctions.h @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "velox/functions/prestosql/SIMDJsonFunctions.h" +#include "velox/functions/prestosql/json/SIMDJsonUtil.h" namespace facebook::velox::functions::sparksql { @@ -50,11 +50,15 @@ struct GetJsonObjectFunction { result.append(json); return true; } - ParserContext ctx(json.data(), json.size()); - ctx.parseDocument(); + simdjson::ondemand::document jsonDoc; + simdjson::padded_string paddedJson(json.data(), json.size()); + if (simdjsonParse(paddedJson).get(jsonDoc)) { + return false; + } + auto rawResult = jsonPath_.has_value() - ? ctx.jsonDoc.at_path(jsonPath_.value().data()) - : ctx.jsonDoc.at_path(removeSingleQuotes(jsonPath)); + ? jsonDoc.at_path(jsonPath_.value().data()) + : jsonDoc.at_path(removeSingleQuotes(jsonPath)); if (rawResult.error()) { return false; } @@ -64,7 +68,7 @@ struct GetJsonObjectFunction { } const char* currentPos; - ctx.jsonDoc.current_location().get(currentPos); + jsonDoc.current_location().get(currentPos); return isValidEndingCharacter(currentPos); }