aokolnychyi commented on a change in pull request #32921:
URL: https://github.com/apache/spark/pull/32921#discussion_r662540019
##########
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:
Let me try with object header.
--
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]