westonpace commented on code in PR #35249:
URL: https://github.com/apache/arrow/pull/35249#discussion_r1173952572


##########
cpp/src/arrow/engine/substrait/extension_set.cc:
##########
@@ -944,6 +944,30 @@ ExtensionIdRegistry::SubstraitAggregateToArrow 
DecodeBasicAggregate(
                                call.id().name, " to have at least one 
argument");
       }
       case 1: {
+        std::shared_ptr<compute::FunctionOptions> options = nullptr;
+        if (arrow_function_name == "stddev" || arrow_function_name == 
"variance") {
+          // See the following URL for the spec of stddev and variance:
+          // https://github.com/substrait-io/substrait/blob/
+          // 73228b4112d79eb1011af0ebb41753ce23ca180c/
+          // extensions/functions_arithmetic.yaml#L1240
+          auto maybe_dist = call.GetOption("distribution");
+          if (maybe_dist) {
+            auto& prefs = **maybe_dist;
+            if (prefs.size() != 1) {
+              return Status::Invalid("expected a single preference for ",
+                                     arrow_function_name, " but got ", 
prefs.size());
+            }

Review Comment:
   Technically multiple preferences means the user would prefer the first value 
but will be ok with the second.  In other words, it's similar to 
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept
   
   So you should be able to handle this case.  However, no producers do this 
yet.



-- 
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]

Reply via email to