-
Notifications
You must be signed in to change notification settings - Fork 25.8k
feat(es|ql): add dense_vector support in coalesce #142974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
867161c
b6b740c
a2e4f0b
6bf4da9
74c9c6b
a673382
8b8e759
a07a68c
493150a
8a05fe0
f4937d1
67488d0
5b25fb6
15b12ef
d9968dc
899e61a
66cdc44
b9053d1
a7b1bdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| area: ES|QL | ||
| issues: | ||
| - 139928 | ||
| pr: 142974 | ||
| summary: Add support for `dense_vector` in `COALESCE` | ||
| type: enhancement |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| id:l, float_vector:dense_vector, float_vector_2:dense_vector, byte_vector:dense_vector, byte_vector_2:dense_vector, bit_vector:dense_vector, bit_vector_2:dense_vector, bfloat16_vector:dense_vector, bfloat16_vector_2:dense_vector | ||
| 0, [1.0, 2.0, 3.0], [0.0, 0.0, 0.0], [10, 20, 30], [0, 0, 0], [13, 112], [0, 1], [1.0, 2.0, 3.0], [0.0, 0.0, 0.0] | ||
| 1, [4.0, 5.0, 6.0], [0.0, 0.0, 0.0], [40, 50, 60], [0, 0, 0], [45, 9], [2, 3], [4.0, 5.0, 6.0], [0.0, 0.0, 0.0] | ||
| 2, [9.0, 8.0, 7.0], [0.0, 0.0, 0.0], [90, 80, 70], [0, 0, 0], [127, 0], [4, 5], [9.0, 8.0, 7.0], [0.0, 0.0, 0.0] | ||
| 3, [0.054, 0.032, 0.012], [0.0, 0.0, 0.0], [100, 110, 120], [0, 0, 0], [88, 53], [6, 7], [1.0, 5.0, 7.0], [0.0, 0.0, 0.0] | ||
| 4, , [0.5, 0.5, 0.5], , [1, 2, 3], , [99, 100], , [1.0, 2.0, 3.0] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,6 +56,39 @@ id:l | new_vector:dense_vector | |
| 4 | null | ||
| ; | ||
|
|
||
| coalesceBfloat16VectorWithFallback | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❓ 💭 Do we need |
||
| required_capability: coalesce_dense_vector | ||
|
|
||
| FROM dense_vector_coalesce | ||
| | EVAL v = COALESCE(bfloat16_vector, to_dense_vector([0, 0, 0])) | ||
| | KEEP id, v | ||
| | SORT id | ||
| ; | ||
|
|
||
| id:l | v:dense_vector | ||
| 0 | [1.0, 2.0, 3.0] | ||
| 1 | [4.0, 5.0, 6.0] | ||
| 2 | [9.0, 8.0, 7.0] | ||
| 3 | [1.0, 5.0, 7.0] | ||
| 4 | [0.0, 0.0, 0.0] | ||
| ; | ||
|
|
||
| coalesceBfloat16VectorTwoColumns | ||
| required_capability: coalesce_dense_vector | ||
|
|
||
| FROM dense_vector_coalesce | ||
| | EVAL v = COALESCE(bfloat16_vector, bfloat16_vector_2) | ||
| | KEEP id, v | ||
| | SORT id | ||
| ; | ||
|
|
||
| id:l | v:dense_vector | ||
| 0 | [1.0, 2.0, 3.0] | ||
| 1 | [4.0, 5.0, 6.0] | ||
| 2 | [9.0, 8.0, 7.0] | ||
| 3 | [1.0, 5.0, 7.0] | ||
| 4 | [1.0, 2.0, 3.0] | ||
| ; | ||
|
|
||
| denseVectorAggregationFunctions | ||
| required_capability: dense_vector_agg_functions | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,3 +35,4 @@ | |
| } | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| { | ||
| "properties": { | ||
| "id": { | ||
| "type": "long" | ||
| }, | ||
| "float_vector": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "float_vector_2": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "byte_vector": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "element_type": "byte", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "byte_vector_2": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "element_type": "byte", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "bit_vector": { | ||
| "type": "dense_vector", | ||
| "dims": 16, | ||
| "similarity": "l2_norm", | ||
| "element_type": "bit", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "bit_vector_2": { | ||
| "type": "dense_vector", | ||
| "dims": 16, | ||
| "similarity": "l2_norm", | ||
| "element_type": "bit", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "bfloat16_vector": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "element_type": "bfloat16", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| }, | ||
| "bfloat16_vector_2": { | ||
| "type": "dense_vector", | ||
| "similarity": "l2_norm", | ||
| "element_type": "bfloat16", | ||
| "index_options": { | ||
| "type": "hnsw", | ||
| "m": 16, | ||
| "ef_construction": 100 | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check: https://github.com/elastic/elasticsearch/pull/142974/changes#r2848341088
A question about whether we want
coalescetests in the dense_vector*.csv-spec tests.