vibhatha commented on code in PR #14558:
URL: https://github.com/apache/arrow/pull/14558#discussion_r1010183643


##########
cpp/src/arrow/engine/substrait/relation_internal.cc:
##########
@@ -479,22 +479,38 @@ Result<DeclarationInfo> FromProto(const substrait::Rel& 
rel, const ExtensionSet&
             callptr->function_name);
       }
 
-      // TODO: ARROW-16624 Add Suffix support for Substrait
-      const auto* left_keys = callptr->arguments[0].field_ref();
-      const auto* right_keys = callptr->arguments[1].field_ref();
-      if (!left_keys || !right_keys) {
-        return Status::Invalid("Left keys for join cannot be null");
-      }
-
       // Create output schema from left, right relations and join keys
       FieldVector combined_fields = left.output_schema->fields();
       const FieldVector& right_fields = right.output_schema->fields();
       combined_fields.insert(combined_fields.end(), right_fields.begin(),
                              right_fields.end());
       std::shared_ptr<Schema> join_schema = schema(std::move(combined_fields));
 
+      // adjust the join_keys according to Substrait definition where
+      // the join fields are defined by considering the `join_schema` which
+      // is the combination of the left and right relation schema.
+
+      // TODO: ARROW-16624 Add Suffix support for Substrait
+      const auto* left_keys = callptr->arguments[0].field_ref();
+      const auto* right_keys = callptr->arguments[1].field_ref();
+      // Validating JoinKeys
+      if (!left_keys || !right_keys) {
+        return Status::Invalid("Left keys for join cannot be null");
+      }
+      // TODO: verify this validation

Review Comment:
   @westonpace is this an accurate statement?



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