Skip to content

feat: add implicit dense_vector casting to coalesce#143695

Open
mromaios wants to merge 14 commits intoelastic:mainfrom
mromaios:add_dense_vector_implicit_casting_to_coalesce
Open

feat: add implicit dense_vector casting to coalesce#143695
mromaios wants to merge 14 commits intoelastic:mainfrom
mromaios:add_dense_vector_implicit_casting_to_coalesce

Conversation

@mromaios
Copy link
Copy Markdown
Contributor

@mromaios mromaios commented Mar 5, 2026

This is an attempt to add dense_vector implicit casting in COALESCE

It also adds an interface that makes it easier for EsqlScalarFunction to add implicit dense_vector casting, while keeping the current VectorFunction for "purely" vector functions.

I realise this is mostly a convenience for handwritten examples such as 3d vectors. For the bulk of cases using to_dense_vector which will be added programmatically it shouldn't be a issue. If it complicates things we can ignore it.

Followup from: #142974
Closes #139928

/**
* If the first resolved non-NULL child is DENSE_VECTOR, cast remaining keyword/numeric children to dense_vector.
*/
private static Expression castChildrenToDenseVector(EsqlScalarFunction f, Configuration configuration) {
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.

❓ Would we need to validate that if a child is of type dense_vector then all other children need to be null or of a type cast-able to dense_vector?

@mromaios mromaios self-assigned this Apr 2, 2026
@mromaios mromaios added the :Search Relevance/ES|QL Search functionality in ES|QL label Apr 2, 2026
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Hi @mromaios, I've created a changelog YAML for you.

@mromaios mromaios marked this pull request as ready for review April 2, 2026 22:55
@elasticsearchmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Apr 2, 2026
@mromaios mromaios requested a review from carlosdelest April 2, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Relevance/ES|QL Search functionality in ES|QL Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ES|QL - Support COALESCE function for dense_vector

2 participants