pedrumj2 commented on code in PR #13274:
URL: https://github.com/apache/gluten/pull/13274#discussion_r4275699503
##########
cpp/velox/udf/examples/MyUDF.cc:
##########
@@ -108,6 +109,84 @@ class MyUdfPlusOneRegisterer final : public
gluten::UdfRegisterer {
} // namespace myudfplusone
+namespace myudfsumrow {
+
+template <typename T>
+struct MyUdfSumRowFunction {
+ VELOX_DEFINE_FUNCTION_TYPES(T);
+
+ FOLLY_ALWAYS_INLINE bool call(int64_t& result, const arg_type<Row<int64_t,
int64_t>>& row) {
+ const auto a = row.template at<0>();
+ const auto b = row.template at<1>();
+ if (!a.has_value() || !b.has_value()) {
+ return false;
+ }
+ result = a.value() + b.value();
+ return true;
+ }
Review Comment:
Updated, we have null check now:
```
if (row == nullptr) {
return false;
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]