kunal642 commented on a change in pull request #4241: URL: https://github.com/apache/carbondata/pull/4241#discussion_r767436734
########## File path: integration/spark/src/main/scala/org/apache/spark/sql/execution/strategy/CarbonDataSourceScan.scala ########## @@ -143,13 +145,63 @@ case class CarbonDataSourceScan( QueryPlan.normalizePredicates(partitionFiltersWithoutDpp, output), QueryPlan.normalizePredicates(dataFilters, output), null, - null, Seq.empty, + pushDownFiltersStr, + projectionColStr, directScanSupport, extraRDD, tableIdentifier, - selectedCatalogPartitions, + Seq.empty, QueryPlan.normalizePredicates(partitionFiltersWithDpp, output) ) } + + override def equals(other: Any): Boolean = { + + def checkDataFilter(scan: CarbonDataSourceScan): Boolean = { + if (dataFilters == scan.dataFilters) { + true + } else { + // normalize the predicates and compare the plan + val dataFiltersExpr1 = QueryPlan.normalizePredicates(dataFilters, output) + val dataFiltersExpr2 = QueryPlan.normalizePredicates(scan.dataFilters, output) + dataFiltersExpr1 == dataFiltersExpr2 + } + } + + other match { + case scan: CarbonDataSourceScan => + var isScanSame = false + if (scan.relation == relation) { + // In some cases, the plans for comparison is not canonicalized. In that case, comparing + // pushedDownFilters will not match, since objects are different. Do canonicalize + // the plans before comparison, which can reuse exchange for better performance + if (pushedDownFilters.nonEmpty && scan.pushedDownFilters.nonEmpty) { Review comment: can we try to simplify this equals logic? -- 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: dev-unsubscr...@carbondata.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org