Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
wecharyu committed Feb 28, 2025
1 parent 6539746 commit 8834290
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 8 additions & 6 deletions velox/functions/sparksql/ToJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "velox/functions/prestosql/types/JsonType.h"

#include <expression/PeeledEncoding.h>
#include <expression/StringWriter.h>
#include <expression/VectorFunction.h>
#include <functions/lib/DateTimeFormatter.h>
#include <functions/lib/RowsTranslationUtil.h>
#include <functions/lib/TimeUtils.h>
Expand Down Expand Up @@ -167,9 +169,9 @@ size_t convertToString<TypeKind::VARCHAR>(
char* const buffer,
exec::EvalCtx& context,
const TypePtr& type) {
size_t size = escapedStringSize(value.data(), value.size());
size_t size = normalizedSizeForJsonCast(value.data(), value.size());
*buffer = '"';
escapeString(value.data(), size, buffer + 1);
normalizeForJsonCast(value.data(), size, buffer + 1);
*(buffer + size + 1) = '"';
return size + 2;
}
Expand Down Expand Up @@ -347,7 +349,7 @@ struct AsJson {
}

// Appends the json string of the value at i to a string writer.
void append(vector_size_t i, exec::StringWriter<>& proxy) const {
void append(vector_size_t i, exec::StringWriter& proxy) const {
if (decoded_->isNullAt(i)) {
proxy.append("null");
} else {
Expand Down Expand Up @@ -441,7 +443,7 @@ void toJsonFromRow(
return;
}

auto proxy = exec::StringWriter<>(&flatResult, row);
auto proxy = exec::StringWriter(&flatResult, row);

proxy.append("{"_sv);
for (int i = 0; i < childrenSize; ++i) {
Expand Down Expand Up @@ -525,7 +527,7 @@ void toJsonFromArray(
auto offset = inputArray->offsetAt(row);
auto size = inputArray->sizeAt(row);

auto proxy = exec::StringWriter<>(&flatResult, row);
auto proxy = exec::StringWriter(&flatResult, row);

proxy.append("["_sv);
for (int i = offset, end = offset + size; i < end; ++i) {
Expand Down Expand Up @@ -618,7 +620,7 @@ void toJsonFromMap(
}
std::sort(sortedKeys.begin(), sortedKeys.end());

auto proxy = exec::StringWriter<>(&flatResult, row);
auto proxy = exec::StringWriter(&flatResult, row);

proxy.append("{"_sv);
for (auto it = sortedKeys.begin(); it != sortedKeys.end(); ++it) {
Expand Down
1 change: 0 additions & 1 deletion velox/functions/sparksql/registration/RegisterJson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include "velox/functions/lib/RegistrationHelpers.h"
#include "velox/functions/sparksql/GetJsonObject.h"
#include "velox/functions/sparksql/JsonObjectKeys.h"
#include <expression/VectorFunction.h>

namespace facebook::velox::functions::sparksql {

Expand Down

0 comments on commit 8834290

Please sign in to comment.