LukaZdravic commented on code in PR #60570:
URL: https://github.com/apache/spark/pull/60570#discussion_r4596939493
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveAsOfJoin.scala:
##########
@@ -74,10 +75,12 @@ object ResolveAsOfJoin extends Rule[LogicalPlan] with
SQLConfHelper {
case None => joinBase
}
case (Some(leftExpr), None, Some(rightExpr)) =>
+ // A DataFrame key can use a metadata column, such as a `_metadata`
field, that its
+ // input does not output yet. AddMetadataColumns adds it once the
join is resolved.
AsOfJoinMatchConditionResolution.materializeDataFrame(
join = joinBase,
- leftSet = leftSet,
- rightSet = rightSet,
+ leftSet = AttributeSet(left.output ++ left.metadataOutput),
+ rightSet = AttributeSet(right.output ++ right.metadataOutput),
Review Comment:
Fixed! Dataset.joinAsOf now moves metadata columns of each key onto its own
join input (same position, same name only), so unaliased self joins and
filtered copies keyed on _metadata or a DSv2 metadata column run with the
sort-merge flag on (confirmed with a run). With the flag off, the DSv2
unaliased self join returned no rows or one arbitrary right row per left row,
and now returns the aliased rows (confirmed with a run; also wrong on master).
With the flag off, a parquet _metadata key fails in OSS with
AGGREGATE_FUNCTION_MIXED_OUTER_LOCAL_REFERENCES before and after this change,
aliased or not, so the flag-off test uses a DSv2 table.
--
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]