summaryrefslogtreecommitdiffstats
path: root/yql/essentials/parser/pg_wrapper/ctors.cpp
diff options
context:
space:
mode:
authorvvvv <[email protected]>2024-11-07 12:29:36 +0300
committervvvv <[email protected]>2024-11-07 13:49:47 +0300
commitd4c258e9431675bab6745c8638df6e3dfd4dca6b (patch)
treeb5efcfa11351152a4c872fccaea35749141c0b11 /yql/essentials/parser/pg_wrapper/ctors.cpp
parent13a4f274caef5cfdaf0263b24e4d6bdd5521472b (diff)
Moved other yql/essentials libs YQL-19206
init commit_hash:7d4c435602078407bbf20dd3c32f9c90d2bbcbc0
Diffstat (limited to 'yql/essentials/parser/pg_wrapper/ctors.cpp')
-rw-r--r--yql/essentials/parser/pg_wrapper/ctors.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/yql/essentials/parser/pg_wrapper/ctors.cpp b/yql/essentials/parser/pg_wrapper/ctors.cpp
new file mode 100644
index 00000000000..90c62ea7c5c
--- /dev/null
+++ b/yql/essentials/parser/pg_wrapper/ctors.cpp
@@ -0,0 +1,58 @@
+#include "ctors.h"
+#include <yql/essentials/parser/pg_catalog/catalog.h>
+
+extern "C" {
+#include "postgres.h"
+#include "fmgr.h"
+#include "varatt.h"
+}
+
+#undef Max
+#include "utils.h"
+
+namespace NYql {
+
+namespace {
+
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const bool value) { return NUdf::TUnboxedValuePod(Datum(BoolGetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const i8 value) { return NUdf::TUnboxedValuePod(Datum(Int8GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const i16 value) { return NUdf::TUnboxedValuePod(Datum(Int16GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const i32 value) { return NUdf::TUnboxedValuePod(Datum(Int32GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const i64 value) { return NUdf::TUnboxedValuePod(Datum(Int64GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const ui8 value) { return NUdf::TUnboxedValuePod(Datum(UInt8GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const ui16 value) { return NUdf::TUnboxedValuePod(Datum(UInt16GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const ui32 value) { return NUdf::TUnboxedValuePod(Datum(UInt32GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const ui64 value) { return NUdf::TUnboxedValuePod(Datum(UInt64GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const float value) { return NUdf::TUnboxedValuePod(Datum(Float4GetDatum(value))); }
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const double value) { return NUdf::TUnboxedValuePod(Datum(Float8GetDatum(value))); }
+
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const NUdf::TStringRef value) {
+ return PointerDatumToPod(Datum(MakeVar(value)));
+}
+
+NUdf::TUnboxedValuePod ScalarValueToPodImpl(const std::string_view value) {
+ return ScalarValueToPodImpl(NUdf::TStringRef(value));
+}
+
+}
+
+template<typename ValueType>
+NUdf::TUnboxedValuePod ScalarValueToPod(const ValueType value) {
+ return ScalarValueToPodImpl(value);
+}
+
+template NUdf::TUnboxedValuePod ScalarValueToPod(const bool value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const i8 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const i16 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const i32 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const i64 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const ui8 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const ui16 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const ui32 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const ui64 value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const float value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const double value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const std::string_view value);
+template NUdf::TUnboxedValuePod ScalarValueToPod(const NUdf::TStringRef value);
+
+}