rtpsw commented on code in PR #13880:
URL: https://github.com/apache/arrow/pull/13880#discussion_r946919428
##########
cpp/src/arrow/compute/exec/options.h:
##########
@@ -397,23 +397,33 @@ class ARROW_EXPORT HashJoinNodeOptions : public
ExecNodeOptions {
/// This node will output one row for each row in the left table.
class ARROW_EXPORT AsofJoinNodeOptions : public ExecNodeOptions {
public:
- AsofJoinNodeOptions(FieldRef on_key, FieldRef by_key, int64_t tolerance)
- : on_key(std::move(on_key)), by_key(std::move(by_key)),
tolerance(tolerance) {}
+ AsofJoinNodeOptions(FieldRef on_key, const FieldRef& by_key, int64_t
tolerance)
+ : on_key(std::move(on_key)), by_key(), tolerance(tolerance) {
+ this->by_key.push_back(std::move(by_key));
+ }
+
+ AsofJoinNodeOptions(FieldRef on_key, std::vector<FieldRef> by_key, int64_t
tolerance)
+ : on_key(std::move(on_key)), by_key(by_key), tolerance(tolerance) {}
+
+ // resolves ambiguity between previous constructors when initializer list is
given
+ AsofJoinNodeOptions(FieldRef on_key, std::initializer_list<FieldRef> by_key,
Review Comment:
The other two constructors, one accepting a `FieldRef` parameter and the
other a `std::vector<FieldRef>` parameter, cannot be disambiguated when one
writes something like `AsOfJoinOptions("time", {"key1", "key2"}, tolerance)`
because `{"key1", "key2"}` fits both parameter types `{"key1", "key2"}` with a
single implicit conversion. However, once a constructor with
`std::initializer_list<FieldRef>` is added, this is the constructor the
compiler will pick, since it involves no implicit conversion.
--
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]