rtpsw commented on code in PR #13880:
URL: https://github.com/apache/arrow/pull/13880#discussion_r954643605


##########
cpp/src/arrow/compute/exec/asof_join_node.cc:
##########
@@ -657,34 +986,85 @@ class AsofJoinNode : public ExecNode {
     return std::make_shared<arrow::Schema>(fields);
   }
 
+  static inline Result<col_index_t> FindColIndex(const Schema& schema,
+                                                 const FieldRef& field_ref,
+                                                 const util::string_view& 
key_kind) {
+    auto match_res = field_ref.FindOne(schema);
+    if (!match_res.ok()) {
+      return Status::Invalid("Bad join key on table : ", 
match_res.status().message());
+    }
+    auto match = match_res.ValueOrDie();
+    if (match.indices().size() != 1) {
+      return Status::Invalid("AsOfJoinNode does not support a nested ",
+                             to_string(key_kind), "-key ", 
field_ref.ToString());
+    }
+    return match.indices()[0];
+  }
+
   static arrow::Result<ExecNode*> Make(ExecPlan* plan, std::vector<ExecNode*> 
inputs,
                                        const ExecNodeOptions& options) {
     DCHECK_GE(inputs.size(), 2) << "Must have at least two inputs";
 
     const auto& join_options = checked_cast<const 
AsofJoinNodeOptions&>(options);
-    ARROW_ASSIGN_OR_RAISE(std::shared_ptr<Schema> output_schema,
-                          MakeOutputSchema(inputs, join_options));
+    if (join_options.by_key.size() == 0) {
+      return Status::Invalid("AsOfJoin by_key must not be empty");
+    }

Review Comment:
   Good question. It wasn't optional prior to this change; only a single-by-key 
was accepted. Now that a multi-by-key is accepted, we could make it optional. 
@icexelloss, your thoughts? 



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