cloud-fan commented on code in PR #38904:
URL: https://github.com/apache/spark/pull/38904#discussion_r1044220536
##########
sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/InMemoryBaseTable.scala:
##########
@@ -294,7 +307,39 @@ abstract class InMemoryBaseTable(
val objectHeaderSizeInBytes = 12L
val rowSizeInBytes = objectHeaderSizeInBytes + schema.defaultSize
val sizeInBytes = numRows * rowSizeInBytes
- InMemoryStats(OptionalLong.of(sizeInBytes), OptionalLong.of(numRows))
+
+ val numOfCols = tableSchema.fields.length
+ val dataTypes = tableSchema.fields.map(_.dataType)
+ val colValueSets = new Array[util.HashSet[Object]](numOfCols)
+ val numOfNulls = new Array[Long](numOfCols)
+ for (i <- 0 until numOfCols) {
+ colValueSets(i) = new util.HashSet[Object]
+ }
+
+ inputPartitions.foreach(inputPartition =>
+ inputPartition.rows.foreach(row =>
+ for (i <- 0 until numOfCols) {
+ colValueSets(i).add(row.get(i, dataTypes(i)))
+ if (row.isNullAt(i)) {
+ numOfNulls(i) += 1
+ }
+ }
+ )
+ )
+
+ val map = new util.HashMap[NamedReference, ColumnStatistics]()
+ val colNames = tableSchema.fields.map(_.name)
+ var i = 0
+ for (col <- colNames) {
+ val fieldReference = FieldReference(col)
Review Comment:
`FieldReference.column(col)` as it's plain column name, while
`FieldReference.apply` parses the string.
--
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]