Skip to content

Commit 424cf8b

Browse files
committed
Rename project to select
1 parent bb16ca1 commit 424cf8b

File tree

4 files changed

+18
-18
lines changed

4 files changed

+18
-18
lines changed

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import com.google.cloud.firestore.pipeline.FindNearest
2121
import com.google.cloud.firestore.pipeline.Function
2222
import com.google.cloud.firestore.pipeline.Limit
2323
import com.google.cloud.firestore.pipeline.Offset
24-
import com.google.cloud.firestore.pipeline.Project
25-
import com.google.cloud.firestore.pipeline.Projectable
24+
import com.google.cloud.firestore.pipeline.Select
25+
import com.google.cloud.firestore.pipeline.Selectable
2626
import com.google.cloud.firestore.pipeline.Sort
2727
import com.google.cloud.firestore.pipeline.Sort.Ordering
2828
import com.google.cloud.firestore.pipeline.Stage
@@ -173,9 +173,9 @@ class Pipeline private constructor(private val stages: List<Stage>, private val
173173
}
174174
}
175175

176-
private fun projectablesToMap(vararg projectables: Projectable): Map<String, Expr> {
176+
private fun projectablesToMap(vararg selectables: Selectable): Map<String, Expr> {
177177
val projMap = mutableMapOf<String, Expr>()
178-
for (proj in projectables) {
178+
for (proj in selectables) {
179179
when (proj) {
180180
is Field -> projMap[proj.field] = proj
181181
is AggregatorTarget -> projMap[proj.fieldName] = proj.accumulator
@@ -185,12 +185,12 @@ class Pipeline private constructor(private val stages: List<Stage>, private val
185185
return projMap
186186
}
187187

188-
fun addFields(vararg fields: Projectable): Pipeline {
188+
fun addFields(vararg fields: Selectable): Pipeline {
189189
return Pipeline(stages.plus(AddFields(projectablesToMap(*fields))), name)
190190
}
191191

192-
fun select(vararg projections: Projectable): Pipeline {
193-
return Pipeline(stages.plus(Project(projectablesToMap(*projections))), name)
192+
fun select(vararg projections: Selectable): Pipeline {
193+
return Pipeline(stages.plus(Select(projectablesToMap(*projections))), name)
194194
}
195195

196196
fun <T> filter(condition: T): Pipeline where T : Expr, T : Function.FilterCondition {

google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import com.google.cloud.Timestamp;
4242
import com.google.cloud.firestore.Query.QueryOptions.Builder;
4343
import com.google.cloud.firestore.pipeline.Field;
44-
import com.google.cloud.firestore.pipeline.Projectable;
44+
import com.google.cloud.firestore.pipeline.Selectable;
4545
import com.google.cloud.firestore.pipeline.Sort.Density;
4646
import com.google.cloud.firestore.pipeline.Sort.Ordering;
4747
import com.google.cloud.firestore.pipeline.Sort.Truncation;
@@ -1993,7 +1993,7 @@ public Pipeline toPipeline() {
19931993
ppl.select(
19941994
this.options.getFieldProjections().stream()
19951995
.map(fieldReference -> Field.of(fieldReference.getFieldPath()))
1996-
.toArray(Projectable[]::new));
1996+
.toArray(Selectable[]::new));
19971997
}
19981998

19991999
// Orders

google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Expressions.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ internal fun exprToValue(expr: Expr): Value {
4747
}
4848
}
4949

50-
interface Projectable
50+
interface Selectable
5151

52-
internal class ExprWithAlias internal constructor(val alias: String, val expr: Expr) : Projectable
52+
internal class ExprWithAlias internal constructor(val alias: String, val expr: Expr) : Selectable
5353

5454
interface Expr {
5555
// Infix functions returning Function subclasses
@@ -146,7 +146,7 @@ interface Expr {
146146
return Ordering(this, Direction.DESCENDING)
147147
}
148148

149-
fun asAlias(alias: String): Projectable {
149+
fun asAlias(alias: String): Selectable {
150150
return ExprWithAlias(alias, this)
151151
}
152152
}
@@ -252,7 +252,7 @@ data class Field internal constructor(
252252
internal val field: String,
253253
private var pipeline: Pipeline? = null
254254
) :
255-
Expr, Projectable {
255+
Expr, Selectable {
256256
companion object {
257257
const val DOCUMENT_ID: String = "__path__"
258258

@@ -272,7 +272,7 @@ data class Field internal constructor(
272272
}
273273
}
274274

275-
data class Fields internal constructor(internal val fs: List<Field>? = null) : Expr, Projectable {
275+
data class Fields internal constructor(internal val fs: List<Field>? = null) : Expr, Selectable {
276276
companion object {
277277
@JvmStatic
278278
fun of(f1: String, vararg f: String): Fields {
@@ -291,7 +291,7 @@ internal constructor(
291291
internal val accumulator: Function.Accumulator,
292292
internal val fieldName: String,
293293
override var distinct: Boolean,
294-
) : Projectable, Function.Accumulator
294+
) : Selectable, Function.Accumulator
295295

296296
open class Function(val name: String, val params: List<Expr>) : Expr {
297297
interface FilterCondition : Expr

google-cloud-firestore/src/main/java/com/google/cloud/firestore/pipeline/Stages.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ internal data class Documents(internal val documents: List<String>) : Stage {
3131
}
3232
}
3333

34-
internal data class Project(internal val projections: Map<String, Expr>) : Stage {
35-
val name = "project"
34+
internal data class Select(internal val projections: Map<String, Expr>) : Stage {
35+
val name = "select"
3636
}
3737

3838
internal data class AddFields(internal val fields: Map<String, Expr>) : Stage {
@@ -205,7 +205,7 @@ internal fun toStageProto(stage: Stage): com.google.firestore.v1.Pipeline.Stage
205205
.setName(stage.name)
206206
.addAllArgs(stage.documents.map { Value.newBuilder().setReferenceValue(it).build() })
207207
.build()
208-
is Project ->
208+
is Select ->
209209
com.google.firestore.v1.Pipeline.Stage.newBuilder()
210210
.setName(stage.name)
211211
.addArgs(encodeValue(stage.projections))

0 commit comments

Comments
 (0)