summaryrefslogtreecommitdiffstats
path: root/yql/essentials/udfs/common/json2/parse.h
diff options
context:
space:
mode:
authorvvvv <[email protected]>2025-10-06 13:26:25 +0300
committervvvv <[email protected]>2025-10-06 14:06:25 +0300
commiteca8ce9cb1613d5c983185c4e43c20651a9638aa (patch)
tree61ee5ae779948e61af9a7691d19eaa2c09869121 /yql/essentials/udfs/common/json2/parse.h
parent4adf7eecae16a9b228b28cc5f64c27ef69ad5ec2 (diff)
YQL-20086 udfs
init commit_hash:f9684778bf1ea956965f2360b80b91edb7d4ffbe
Diffstat (limited to 'yql/essentials/udfs/common/json2/parse.h')
-rw-r--r--yql/essentials/udfs/common/json2/parse.h91
1 files changed, 45 insertions, 46 deletions
diff --git a/yql/essentials/udfs/common/json2/parse.h b/yql/essentials/udfs/common/json2/parse.h
index 6df4bce9b0a..72db2106fa5 100644
--- a/yql/essentials/udfs/common/json2/parse.h
+++ b/yql/essentials/udfs/common/json2/parse.h
@@ -9,58 +9,57 @@
#include <library/cpp/json/json_reader.h>
namespace NJson2Udf {
- using namespace NKikimr;
- using namespace NUdf;
- using namespace NYql;
- using namespace NDom;
+using namespace NKikimr;
+using namespace NUdf;
+using namespace NYql;
+using namespace NDom;
- class TParse: public TBoxedValue {
- public:
- TParse(TSourcePosition pos)
- : Pos_(pos)
- {
- }
+class TParse: public TBoxedValue {
+public:
+ TParse(TSourcePosition pos)
+ : Pos_(pos)
+ {
+ }
- static const TStringRef& Name() {
- static auto name = TStringRef::Of("Parse");
- return name;
- }
+ static const TStringRef& Name() {
+ static auto name = TStringRef::Of("Parse");
+ return name;
+ }
- static bool DeclareSignature(
- const TStringRef& name,
- TType* userType,
- IFunctionTypeInfoBuilder& builder,
- bool typesOnly) {
- Y_UNUSED(userType);
- if (name != Name()) {
- return false;
- }
+ static bool DeclareSignature(
+ const TStringRef& name,
+ TType* userType,
+ IFunctionTypeInfoBuilder& builder,
+ bool typesOnly) {
+ Y_UNUSED(userType);
+ if (name != Name()) {
+ return false;
+ }
- builder.Args()
- ->Add<TAutoMap<TJson>>()
- .Done()
- .Returns<TJsonNodeResource>();
+ builder.Args()
+ ->Add<TAutoMap<TJson>>()
+ .Done()
+ .Returns<TJsonNodeResource>();
- if (!typesOnly) {
- builder.Implementation(new TParse(builder.GetSourcePosition()));
- }
- return true;
+ if (!typesOnly) {
+ builder.Implementation(new TParse(builder.GetSourcePosition()));
}
+ return true;
+ }
- private:
- TUnboxedValue Run(
- const IValueBuilder* valueBuilder,
- const TUnboxedValuePod* args) const final {
- Y_UNUSED(valueBuilder);
- try {
- const auto json = args[0].AsStringRef();
- return TryParseJsonDom(json, valueBuilder);
- } catch (const std::exception& e) {
- UdfTerminate((TStringBuilder() << Pos_ << " " << e.what()).c_str());
- }
+private:
+ TUnboxedValue Run(
+ const IValueBuilder* valueBuilder,
+ const TUnboxedValuePod* args) const final {
+ Y_UNUSED(valueBuilder);
+ try {
+ const auto json = args[0].AsStringRef();
+ return TryParseJsonDom(json, valueBuilder);
+ } catch (const std::exception& e) {
+ UdfTerminate((TStringBuilder() << Pos_ << " " << e.what()).c_str());
}
+ }
- TSourcePosition Pos_;
- };
-}
-
+ TSourcePosition Pos_;
+};
+} // namespace NJson2Udf