Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/20394#discussion_r163939019
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/CacheManager.scala ---
@@ -169,14 +169,17 @@ class CacheManager extends Logging {
/** Replaces segments of the given logical plan with cached versions
where possible. */
def useCachedData(plan: LogicalPlan): LogicalPlan = {
val newPlan = plan transformDown {
+ // Do not lookup the cache by hint node. Hint node is special, we
should ignore it when
+ // canonicalizing plans, so that plans which are same except hint
can hit the same cache.
+ // However, we also want to keep the hint info after cache lookup.
Here we skip the hint
+ // node, so that the returned caching plan won't replace the hint
node and drop the hint info
+ // from the original plan.
+ case hint: ResolvedHint => hint
+
case currentFragment =>
- lookupCachedData(currentFragment).map { cached =>
- val cachedPlan =
cached.cachedRepresentation.withOutput(currentFragment.output)
- currentFragment match {
- case hint: ResolvedHint => ResolvedHint(cachedPlan, hint.hints)
- case _ => cachedPlan
- }
- }.getOrElse(currentFragment)
+ lookupCachedData(currentFragment)
+ .map(_.cachedRepresentation.withOutput(currentFragment.output))
+ .getOrElse(currentFragment)
--- End diff --
Thank you for pinging me, @cloud-fan .
I see. So, this is reverted back from #20365 .
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]