viirya commented on code in PR #60746:
URL: https://github.com/apache/spark/pull/60746#discussion_r4646645195


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/PrepareExternalLookupJoin.scala:
##########
@@ -372,16 +374,22 @@ object PrepareExternalLookupJoin extends 
Rule[LogicalPlan] with PredicateHelper
   }
 
   /**
-   * Maps the connector's selection back to the offered candidates, in the 
connector's order, which
-   * defines the fields of each request parameter row. Selections are matched 
by object identity
-   * rather than by equality, so two candidates of the same shape, for example 
the same lookup field
-   * compared with two different join-side values, remain distinguishable.
+   * Maps the connector's selection, positions in the offered array, back to 
the offered
+   * candidates, in the connector's order, which defines the fields of each 
request parameter row.
+   * Positions keep two candidates of the same shape, for example the same 
lookup field compared
+   * with two different join-side values, distinguishable. `passed` is the 
copy of `offered` that
+   * the connector received; it must still hold the offered predicates in the 
offered order.
    */
   private def selectedCandidates(
       tableName: String,
       offered: Array[V2Predicate],
-      candidates: Seq[OfferedLookupPredicate],
-      selected: Array[V2Predicate]): Seq[OfferedLookupPredicate] = {
+      candidates: IndexedSeq[OfferedLookupPredicate],
+      passed: Array[V2Predicate],
+      selected: Array[Int]): Seq[OfferedLookupPredicate] = {
+    if (!offered.indices.forall(index => passed(index) eq offered(index))) {

Review Comment:
   Done, `passed.corresponds(offered)(_ == _)`.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to