Skip to content

Commit d831d75

Browse files
committed
Rename sample stage parameter to "count"
1 parent 17896b8 commit d831d75

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

firebase-firestore/src/main/java/com/google/firebase/firestore/Pipeline.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ private constructor(
512512
* @param documents The number of documents to emit.
513513
* @return A new [Pipeline] object with this stage appended to the stage list.
514514
*/
515-
fun sample(documents: Int): Pipeline = append(SampleStage.withDocLimit(documents))
515+
fun sample(documents: Int): Pipeline = append(SampleStage.withCount(documents))
516516

517517
/**
518518
* Performs a pseudo-random sampling of the input documents.

firebase-firestore/src/main/java/com/google/firebase/firestore/pipeline/stage.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import com.google.firebase.firestore.util.Preconditions
2929
import com.google.firestore.v1.Pipeline
3030
import com.google.firestore.v1.Value
3131
import kotlinx.coroutines.flow.Flow
32-
import kotlinx.coroutines.flow.drop
3332
import kotlinx.coroutines.flow.emptyFlow
3433
import kotlinx.coroutines.flow.filter
3534
import kotlinx.coroutines.flow.flow
@@ -727,15 +726,15 @@ private constructor(
727726
/**
728727
* Creates [SampleStage] with size limited to number of documents.
729728
*
730-
* The [documents] parameter represents the target number of documents to produce and must be a
729+
* The [count] parameter represents the target number of documents to produce and must be a
731730
* non-negative integer value. If the previous stage produces less than size documents, the
732731
* entire previous results are returned. If the previous stage produces more than size, this
733732
* outputs a sample of exactly size entries where any sample is equally likely.
734733
*
735-
* @param documents The number of documents to emit.
736-
* @return [SampleStage] with specified [documents].
734+
* @param count The number of documents to emit.
735+
* @return [SampleStage] with specified [count].
737736
*/
738-
@JvmStatic fun withDocLimit(documents: Int) = SampleStage(documents, Mode.DOCUMENTS)
737+
@JvmStatic fun withCount(count: Int) = SampleStage(count, Mode.DOCUMENTS)
739738
}
740739
override fun args(userDataReader: UserDataReader): Sequence<Value> =
741740
sequenceOf(encodeValue(size), mode.proto)

0 commit comments

Comments
 (0)