ericm-db commented on code in PR #49304:
URL: https://github.com/apache/spark/pull/49304#discussion_r1901294730
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/state/RocksDB.scala:
##########
@@ -723,20 +888,42 @@ class RocksDB(
iter.seekToFirst()
var keys = 0L
- while (iter.isValid) {
- keys += 1
- iter.next()
+ var internalKeys = 0L
+
+ if (!useColumnFamilies) {
+ while (iter.isValid) {
+ keys += 1
+ iter.next()
+ }
+ } else {
+ while (iter.isValid) {
+ val (_, cfName) = decodeStateRowWithPrefix(iter.key)
+ val cfInfo = getColumnFamilyInfo(cfName)
+ if (cfInfo.isInternal) {
+ internalKeys += 1
+ } else {
+ keys += 1
+ }
+ iter.next()
+ }
}
- keys
+ (keys, internalKeys)
} finally {
iter.close()
}
}
- def prefixScan(prefix: Array[Byte]): Iterator[ByteArrayPair] = {
+ def prefixScan(
+ prefix: Array[Byte],
+ cfName: String = StateStore.DEFAULT_COL_FAMILY_NAME):
Iterator[ByteArrayPair] = {
val iter = db.newIterator()
- iter.seek(prefix)
+ var updatedPrefix = prefix
Review Comment:
```suggestion
val updatedPrefix = if (useColumnFamilies) {
encodeStateRowWithPrefix(prefix, cfName)
} else {
prefix
}
```
--
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]