You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/08/16 15:22:47 UTC
[GitHub] [arrow] rtpsw commented on a diff in pull request #13880: ARROW-17412: [C++] AsofJoin multiple keys and types
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 `` 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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org