LuciferYang commented on code in PR #60672:
URL: https://github.com/apache/spark/pull/60672#discussion_r4631222373
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala:
##########
@@ -905,17 +905,30 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan]
with PredicateHelper {
* - `pushedOffset` -- pushed OFFSET
* - `pushedSample` -- pushed table sample
* - `sortOrders` -- pushed sort order (top-N / ordering)
+ * - `joinedRelationsPushedDownOperators` -- the same operations pushed
into a side of a join
*
* It decides the `onlyRowWisePushdowns` flag of the plain and the
variant-extraction scans, see
* [[DataSourceV2ScanRelation.onlyRowWisePushdowns]], and blocks merging, see
* [[hasBlockingPushdown]]. A pushed aggregate or join never reaches those
builds, and their scans
- * keep the flag's default.
+ * keep the flag's default. It also decides the `repeatableRead` flag of
every scan this rule
+ * builds, see [[DataSourceV2ScanRelation.repeatableRead]]. Limit, offset
and top-N pushdowns run
+ * before the aggregate and the join builds, so those builds see a limit,
offset or top-N pushed
+ * above an aggregate or join. An operation pushed into a side of a pushed
join is kept with that
+ * side's pushed operators, which this checks too, whichever pushdowns run
before `pushDownJoin`.
*/
private def hasRowSelectingPushdown(holder: ScanBuilderHolder): Boolean =
holder.pushedLimit.isDefined ||
holder.pushedOffset.isDefined ||
holder.pushedSample.isDefined ||
- holder.sortOrders.nonEmpty
+ holder.sortOrders.nonEmpty ||
+
holder.joinedRelationsPushedDownOperators.exists(hasRowSelectingOperators)
+
+ private def hasRowSelectingOperators(operators: PushedDownOperators):
Boolean =
Review Comment:
Done in c53bf5b49cf: `hasRowSelectingPushdown(holder)` is
`hasRowSelectingOperators(getPushedDownOperators(holder))`. With item 4 the
plain build site no longer sets `repeatableRead`, so it evaluates the check
twice, as on master.
##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -338,6 +338,10 @@ class JDBCV2Suite extends SharedSparkSession with
ExplainSuiteHelper {
checkAnswer(df, Seq(Row("amy"), Row("alex"), Row("cathy")))
}
+ private def scanOf(df: DataFrame): DataSourceV2ScanRelation =
Review Comment:
Done in c53bf5b49cf: `checkSchemaNames` uses `scanOf`.
--
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]