Skip to content

feat(firestore): [PQ] create pipeline from query#13339

Merged
bhshkh merged 2 commits intogoogleapis:feature/fs-pipeline-queriesfrom
bhshkh:feat/fspq-createFrom
Nov 13, 2025
Merged

feat(firestore): [PQ] create pipeline from query#13339
bhshkh merged 2 commits intogoogleapis:feature/fs-pipeline-queriesfrom
bhshkh:feat/fspq-createFrom

Conversation

@bhshkh
Copy link
Copy Markdown
Contributor

@bhshkh bhshkh commented Nov 11, 2025

@product-auto-label product-auto-label Bot added the api: firestore Issues related to the Firestore API. label Nov 11, 2025
@bhshkh bhshkh marked this pull request as ready for review November 11, 2025 02:32
@bhshkh bhshkh requested review from a team November 11, 2025 02:32
Comment thread firestore/query.go
p = p.Select(fields...)
}

// FindNearest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember seeing this in other implementations. Makes sense though. I'll have to look into it more.

How does this interact with other filters? Can we assume a query is either a findNearest query or a standard query? Or do they stack?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They do indeed stack.

For example, a query like coll.Where("published", ">", 1900).FindNearest(...) would first filter for books published after 1900 and then find the nearest neighbors within that subset.

Comment thread firestore/query.go
p = p.Where(allFilters[0])
} else if len(allFilters) > 1 {
p = p.Where(And(allFilters[0], allFilters[1:]...))
}
Copy link
Copy Markdown
Contributor

@daniel-sanche daniel-sanche Nov 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your implementation seems to differ a bit from java.

  • Java does .where(filters).select(projections).where(orders)
  • Yours does where(fitlers and orders).select(projections)

Is this equivalent? (It seems like it might be, but I'm not sure one way or the other)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the Go code builds the pipeline in a slightly different order than the Java version, the resulting pipeline is functionally equivalent and will produce the correct results.

Copy link
Copy Markdown
Contributor

@daniel-sanche daniel-sanche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bhshkh
Copy link
Copy Markdown
Contributor Author

bhshkh commented Nov 13, 2025

Will take Go developer review before public preview

@bhshkh bhshkh merged commit dd603ae into googleapis:feature/fs-pipeline-queries Nov 13, 2025
8 checks passed
@bhshkh bhshkh deleted the feat/fspq-createFrom branch November 13, 2025 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: firestore Issues related to the Firestore API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants