aokolnychyi commented on a change in pull request #32921: URL: https://github.com/apache/spark/pull/32921#discussion_r662534188
########## File path: sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryTable.scala ########## @@ -245,21 +246,76 @@ class InMemoryTable( } } - class InMemoryBatchScan( - data: Array[InputPartition], + case class InMemoryStats(sizeInBytes: OptionalLong, numRows: OptionalLong) extends Statistics + + case class InMemoryBatchScan( + var data: Seq[InputPartition], readSchema: StructType, - tableSchema: StructType) extends Scan with Batch { - override def readSchema(): StructType = readSchema + tableSchema: StructType) + extends Scan with Batch with SupportsRuntimeFiltering with SupportsReportStatistics { override def toBatch: Batch = this - override def planInputPartitions(): Array[InputPartition] = data + override def estimateStatistics(): Statistics = { + if (data.isEmpty) { + return InMemoryStats(OptionalLong.of(0L), OptionalLong.of(0L)) + } + + val inputPartitions = data.map(_.asInstanceOf[BufferedRows]) + val numRows = inputPartitions.map(_.rows.size).sum + // we assume an average object header is 12 bytes Review comment: ``` [info] Run completed in 29 seconds, 324 milliseconds. [info] Total number of tests run: 30 [info] Suites: completed 1, aborted 0 [info] Tests: succeeded 24, failed 6, canceled 0, ignored 0, pending 0 [info] *** 6 TESTS FAILED *** [error] Failed tests: [error] org.apache.spark.sql.DynamicPartitionPruningV2SuiteAEOff [error] (Test / testOnly) sbt.TestsFailedException: Tests unsuccessful ``` -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org