Skip to content

Commit

Permalink
Fix compile error
Browse files Browse the repository at this point in the history
  • Loading branch information
PHILO-HE committed Jun 4, 2024
1 parent 7e51834 commit 0c63bac
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions velox/functions/sparksql/JsonFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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;
}
Expand All @@ -64,7 +68,7 @@ struct GetJsonObjectFunction {
}

const char* currentPos;
ctx.jsonDoc.current_location().get(currentPos);
jsonDoc.current_location().get(currentPos);
return isValidEndingCharacter(currentPos);
}

Expand Down

0 comments on commit 0c63bac

Please sign in to comment.