Skip to content

Commit

Permalink
Merge d3fc4ec into ef84e11
Browse files Browse the repository at this point in the history
  • Loading branch information
marsaly79 authored Jan 25, 2024
2 parents ef84e11 + d3fc4ec commit 032ead9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
6 changes: 1 addition & 5 deletions ydb/library/yql/parser/pg_wrapper/interface/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ bool ParsePgIntervalModifier(const TString& str, i32& ret);
std::unique_ptr<NUdf::IPgBuilder> CreatePgBuilder();
bool HasPgKernel(ui32 procOid);

ui64 HexEncode(const char *src, size_t len, char *dst);
} // NYql

extern "C" {
// copied from postgres/src/include/utils/builtins.h
ui64 hex_encode(const char *src, size_t len, char *dst);
}

1 change: 1 addition & 0 deletions ydb/library/yql/parser/pg_wrapper/pg_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern "C" {

#undef Min
#undef Max
#undef Abs
#undef bind
#undef open
#undef FATAL
Expand Down
14 changes: 14 additions & 0 deletions ydb/library/yql/parser/pg_wrapper/pg_utils_wrappers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <ydb/library/yql/parser/pg_wrapper/interface/interface.h>
#include <ydb/library/yql/parser/pg_wrapper/pg_compat.h>

extern "C" {
#include <utils/builtins.h>
}


namespace NYql {
ui64 HexEncode(const char *src, size_t len, char *dst) {
return ::hex_encode(src, len, dst);
}
}

1 change: 1 addition & 0 deletions ydb/library/yql/parser/pg_wrapper/ya.make
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ SRCS(
config.cpp
cost_mocks.cpp
syscache.cpp
pg_utils_wrappers.cpp
)

IF (ARCH_X86_64)
Expand Down
7 changes: 3 additions & 4 deletions ydb/library/yql/sql/pg_dummy/pg_sql_dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,13 +496,12 @@ TString GetPostgresServerVersionStr() {
return "pg_sql_dummy";
}

} // namespace NKikimr::NPg

ui64 hex_encode(const char *src, size_t len, char *dst) {
ui64 HexEncode(const char *src, size_t len, char *dst) {
Y_UNUSED(src);
Y_UNUSED(len);
Y_UNUSED(dst);

return 0;
throw yexception() << "HexEncode in pg_dummy does nothing";
}

} // namespace NKikimr::NPg
2 changes: 1 addition & 1 deletion ydb/library/yql/tools/pgrun/pgrun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ TString GetCellData(const NYT::TNode& cell, const TColumn& column) {
result.resize(expectedSize);
result[0] = '\\';
result[1] = 'x';
const auto cnt = hex_encode(rawValue.data(), rawValue.size(), result.begin() + 2);
const auto cnt = HexEncode(rawValue.data(), rawValue.size(), result.begin() + 2);

Y_ASSERT(cnt + 2 == expectedSize);

Expand Down

0 comments on commit 032ead9

Please sign in to comment.