danielwei816 commented on code in PR #7508:
URL: https://github.com/apache/datafusion-comet/pull/7508#discussion_r4486671458
##########
spark/src/test/scala/org/apache/spark/sql/comet/CometPlanEqualitySuite.scala:
##########
@@ -36,6 +39,55 @@ import org.apache.comet.util.ClassLoaders
class CometPlanEqualitySuite extends AnyFunSuite {
+ test("native scan fallback preserves additional runtime constructor fields")
{
+ val output = Seq(AttributeReference("id", IntegerType)())
+ val partitionFilters = Seq(GreaterThan(output.head, Literal(1)))
+ val dataFilters = Seq(LessThan(output.head, Literal(10)))
+ val scan = ExtendedFileSourceScanExec(output)
+
+ val nativeScan = CometNativeScanExec(
+ nativeOp = null,
+ relation = scan.relation,
+ output = scan.output,
+ requiredSchema = scan.requiredSchema,
+ partitionFilters = partitionFilters,
+ optionalBucketSet = scan.optionalBucketSet,
+ optionalNumCoalescedBuckets = scan.optionalNumCoalescedBuckets,
+ dataFilters = dataFilters,
+ tableIdentifier = scan.tableIdentifier,
+ disableBucketedScan = scan.disableBucketedScan,
+ originalPlan = scan,
+ serializedPlanOpt = SerializedPlan(None),
+ scan = null,
+ sourceKey = "")
+ val copied = nativeScan
+ .sparkFallback(Nil)
+ .asInstanceOf[FileSourceScanExec]
+
+ assert(copied.getClass == scan.getClass)
+ assert(copied.partitionFilters == partitionFilters)
+ assert(copied.dataFilters == dataFilters)
+ assert(copied.output == output)
+ assert(copied.tableIdentifier == scan.tableIdentifier)
+ assert(copied.disableBucketedScan)
+ assert(copied.productIterator.toSeq.takeRight(2) == Seq(true, output))
+ assert(scan.partitionFilters.isEmpty && scan.dataFilters.isEmpty)
+ }
+
+ test("scan canonicalization retains Spark normalization and removes original
DPP filters") {
+ val output = Seq(AttributeReference("id", IntegerType)())
+ val staticFilter = GreaterThan(output.head, Literal(1))
+ val scan = ExtendedFileSourceScanExec(output).copy(
Review Comment:
Thanks fixed both! MakeDateEvaluation uses the shared helper now and the
canonicalization test constructs the extended scan with its filters directly.
--
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]