When you make a query using Room, you can specify the method to return Flow<T>. It doesn't make any requests until it have a collector, but if you are already subscribed, inserting new data will update the flow. Is it cold or hot? What is under the hood?
If, for instance, I do this:
query().buffer().filter {
api.makeLongFilteringRequest(it)
}.collect {
ui.show(it)
}
Will it execute sequentially (like a hot flow) or concurrently (like a cold flow)?
The source flow from Room is cold because it doesn’t do anything unless collected, and you can collect it multiple times in parallel or sequentially. Each and every time you collect a flow from Room, it queries and emits the current value in the database and also sets up an internal listener that will repeat the query and emit that result. These listeners are invoked every time a change is made to the database. When a collect call is terminated, the listener is destroyed.
Calling buffer or filter on a hot flow (SharedFlow or StateFlow) returns a cold flow that only does the operations on the parent hot flow when they are collected. The hot flow behavior itself is unaffected. It sees collection of the downstream flows just like any other collector and doesn’t know they are doing additional operations on what they collect from it. So as far as your question is concerned, it is irrelevant whether Room returns a hot or cold flow.
The phrasing of your last sentence suggests a misunderstanding of the terms hot and cold. Cold flows are usually sequential unless buffered in which case they have intermediate parallelism. And hot flows can’t really be thought of in terms of sequential vs. buffered because they just keep emitting whether or not collectors are ready or not.