Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-32708] Query optimization fails to reuse exchange with DataSourceV2 #29564

Closed
wants to merge 11 commits into from
Closed
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -22,6 +22,7 @@ import scala.collection.JavaConverters._
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.plans.QueryPlan
import org.apache.spark.sql.catalyst.plans.physical
import org.apache.spark.sql.catalyst.plans.physical.SinglePartition
import org.apache.spark.sql.execution.{ColumnarBatchScan, LeafExecNode, WholeStageCodegenExec}
Expand Down Expand Up @@ -52,6 +53,17 @@ case class DataSourceV2ScanExec(
case _ => false
}

override def doCanonicalize(): DataSourceV2ScanExec = {
DataSourceV2ScanExec(
output.map(QueryPlan.normalizeExprId(_, output)),
source,
options,
QueryPlan.normalizePredicates(
pushedFilters,
AttributeSeq(pushedFilters.flatMap(_.references).distinct)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we use output here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reader)
}

override def hashCode(): Int = {
Seq(output, source, options).hashCode()
}
Expand Down