summaryrefslogtreecommitdiffstats
path: root/yql/essentials/minikql/computation/mkql_validate_impl.h
diff options
context:
space:
mode:
authorvvvv <[email protected]>2024-11-07 04:19:26 +0300
committervvvv <[email protected]>2024-11-07 04:29:50 +0300
commit2661be00f3bc47590fda9218bf0386d6355c8c88 (patch)
tree3d316c07519191283d31c5f537efc6aabb42a2f0 /yql/essentials/minikql/computation/mkql_validate_impl.h
parentcf2a23963ac10add28c50cc114fbf48953eca5aa (diff)
Moved yql/minikql YQL-19206
init [nodiff:caesar] commit_hash:d1182ef7d430ccf7e4d37ed933c7126d7bd5d6e4
Diffstat (limited to 'yql/essentials/minikql/computation/mkql_validate_impl.h')
-rw-r--r--yql/essentials/minikql/computation/mkql_validate_impl.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/yql/essentials/minikql/computation/mkql_validate_impl.h b/yql/essentials/minikql/computation/mkql_validate_impl.h
new file mode 100644
index 00000000000..6aa5da928ed
--- /dev/null
+++ b/yql/essentials/minikql/computation/mkql_validate_impl.h
@@ -0,0 +1,52 @@
+#pragma once
+#include <util/string/cast.h>
+
+namespace NKikimr {
+namespace NMiniKQL {
+
+struct TValidateErrorPolicyNone {
+};
+
+struct TUdfValidateException: public yexception {
+};
+
+struct TValidateErrorPolicyThrow {
+ static void Generate(const TString& message) {
+ GenerateExc(TUdfValidateException() << message);
+ }
+
+ template<class TException>
+ static void GenerateExc(const TException& exc) {
+ static_assert(std::is_base_of<yexception, TException>::value, "Must be derived from yexception");
+ ythrow TException() << exc.AsStrBuf();
+ }
+};
+
+struct TValidateErrorPolicyFail {
+ static void Generate(const TString& message) {
+ Y_ABORT("value verify failed: %s", message.c_str());
+ }
+
+ template<class TException>
+ static void GenerateExc(const TException& exc) {
+ Generate(ToString(exc.AsStrBuf()));
+ }
+};
+
+template<class TValidateMode>
+struct TValidate<TValidateErrorPolicyNone, TValidateMode> {
+
+static NUdf::TUnboxedValue Value(const NUdf::IValueBuilder* valueBuilder, const TType* type, NUdf::TUnboxedValue&& value, const TString& message, bool* wrapped) {
+ Y_UNUSED(valueBuilder);
+ Y_UNUSED(type);
+ Y_UNUSED(message);
+ Y_UNUSED(wrapped);
+ return std::move(value);
+}
+
+static void WrapCallable(const TCallableType*, NUdf::TUnboxedValue&, const TString&) {}
+
+};
+
+} // namespace MiniKQL
+} // namespace NKikimr