Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/changelog/139774.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 139774
summary: ES|QL - fix ENRICH command when using dense_vector columns
area: ES|QL
type: bug
issues:
- 137699
5 changes: 5 additions & 0 deletions x-pack/plugin/esql/compute/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,11 @@ tasks.named('stringTemplates').configure {
it.inputFile = enrichResultBuilderInput
it.outputFile = "org/elasticsearch/xpack/compute/operator/lookup/EnrichResultBuilderForBoolean.java"
}
template {
it.properties = floatProperties
it.inputFile = enrichResultBuilderInput
it.outputFile = "org/elasticsearch/xpack/compute/operator/lookup/EnrichResultBuilderForFloat.java"
}

// TODO: add {value}_over_time for other types: boolean, bytes_refs
def generateTimestampAggregatorClasses = { inputFilename, prefix = "" ->
Expand Down

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
Expand Up @@ -55,6 +55,7 @@ static EnrichResultBuilder enrichResultBuilder(ElementType elementType, BlockFac
case INT -> new EnrichResultBuilderForInt(blockFactory, channel);
case LONG -> new EnrichResultBuilderForLong(blockFactory, channel);
case DOUBLE -> new EnrichResultBuilderForDouble(blockFactory, channel);
case FLOAT -> new EnrichResultBuilderForFloat(blockFactory, channel);
case BOOLEAN -> new EnrichResultBuilderForBoolean(blockFactory, channel);
case BYTES_REF -> new EnrichResultBuilderForBytesRef(blockFactory, channel);
default -> throw new IllegalArgumentException("no enrich result builder for [" + elementType + "]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,9 +1018,7 @@ private static boolean supportedInEnrich(DataType t) {
// https://github.com/elastic/elasticsearch/issues/127350
case AGGREGATE_METRIC_DOUBLE, SCALED_FLOAT,
// https://github.com/elastic/elasticsearch/issues/139255
EXPONENTIAL_HISTOGRAM, TDIGEST,
// https://github.com/elastic/elasticsearch/issues/137699
DENSE_VECTOR -> false;
EXPONENTIAL_HISTOGRAM, TDIGEST -> false;
default -> true;
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,40 @@ row hex_str = "0102030405060708090a0b0c0d0e0f"
vector:dense_vector
[1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0]
;

denseVectorWithEnrich
required_capability: enrich_load
required_capability: enrich_dense_vector_bugfix

from colors
| enrich colors_policy
| sort color_name
| limit 10
| keep color_name, cmyk_vector
;

color_name:text | cmyk_vector:dense_vector
aqua marine | [50.0, 0.0, 17.0, 0.0]
azure | [6.0, 0.0, 0.0, 0.0]
beige | [0.0, 0.0, 10.0, 4.0]
bisque | [0.0, 11.0, 23.0, 0.0]
black | [0.0, 0.0, 0.0, 100.0]
blue | [100.0, 100.0, 0.0, 0.0]
brown | [0.0, 75.0, 75.0, 35.0]
burly wood | [0.0, 17.0, 39.0, 13.0]
chartreuse | [50.0, 0.0, 100.0, 0.0]
chocolate | [0.0, 50.0, 86.0, 18.0]
;

denseVectorRowWithEnrich
required_capability: enrich_load
required_capability: enrich_dense_vector_bugfix

row id=0
| enrich colors_policy
| keep color_name, cmyk_vector
;

color_name:text | cmyk_vector:dense_vector
maroon | [0.0, 100.0, 100.0, 50.0]
;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"match": {
"indices": "colors_cmyk",
"match_field": "id",
"enrich_fields": ["color_name"]
"enrich_fields": ["color_name", "cmyk_vector"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -178,27 +178,28 @@ silver | 0.9258201122283936 | [0.0, 0.0, 0.0, 25.0]
cosineSimilarityWithEnrich
required_capability: vector_similarity_functions_pushdown
required_capability: enrich_load
required_capability: enrich_dense_vector_bugfix

from colors
| where color != "black"
| eval s = v_cosine(rgb_vector, [1, 2, 3])
| enrich colors_policy
| keep color_name, s
| keep color_name, cmyk_vector, s
| sort s desc, color_name asc
| limit 10
;

color_name:text | s:double
turquoise | 0.9721468091011047
aqua marine | 0.9580987691879272
cyan | 0.9449111819267273
teal | 0.9449111819267273
lavender | 0.9381157159805298
azure | 0.9347044825553894
mint cream | 0.9287823438644409
gainsboro | 0.9258201122283936
gray | 0.9258201122283936
silver | 0.9258201122283936
color_name:text | cmyk_vector:dense_vector | s:double
turquoise | [71.0, 0.0, 7.0, 12.0] | 0.9721468091011047
aqua marine | [50.0, 0.0, 17.0, 0.0] | 0.9580987691879272
cyan | [100.0, 0.0, 0.0, 0.0] | 0.9449111819267273
teal | [100.0, 0.0, 0.0, 50.0] | 0.9449111819267273
lavender | [8.0, 8.0, 0.0, 2.0] | 0.9381157159805298
azure | [6.0, 0.0, 0.0, 0.0] | 0.9347044825553894
mint cream | [4.0, 0.0, 2.0, 0.0] | 0.9287823438644409
gainsboro | [0.0, 0.0, 0.0, 14.0] | 0.9258201122283936
gray | [0.0, 0.0, 0.0, 50.0] | 0.9258201122283936
silver | [0.0, 0.0, 0.0, 25.0] | 0.9258201122283936
;

similarityWithFork
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,26 +196,27 @@ indigo | 438.0
dotProductWithEnrich
required_capability: vector_similarity_functions_pushdown
required_capability: enrich_load
required_capability: enrich_dense_vector_bugfix

from colors
| eval s = v_dot_product(rgb_vector, [1, 2, 3])
| enrich colors_policy
| keep color_name, s
| keep color_name, cmyk_vector, s
| sort s desc, color_name asc
| limit 10
;

color_name:text | s:double
white | 1530.0
azure | 1515.0
mint cream | 1505.0
snow | 1505.0
ivory | 1485.0
honeydew | 1470.0
sea shell | 1459.0
lavender | 1440.0
old lace | 1433.0
linen | 1420.0
color_name:text | cmyk_vector:dense_vector | s:double
white | [0.0, 0.0, 0.0, 0.0] | 1530.0
azure | [6.0, 0.0, 0.0, 0.0] | 1515.0
mint cream | [4.0, 0.0, 2.0, 0.0] | 1505.0
snow | [0.0, 2.0, 2.0, 0.0] | 1505.0
ivory | [0.0, 0.0, 6.0, 0.0] | 1485.0
honeydew | [6.0, 0.0, 6.0, 0.0] | 1470.0
sea shell | [0.0, 4.0, 7.0, 0.0] | 1459.0
lavender | [8.0, 8.0, 0.0, 2.0] | 1440.0
old lace | [0.0, 3.0, 9.0, 1.0] | 1433.0
linen | [0.0, 4.0, 8.0, 2.0] | 1420.0
;

similarityWithFork
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,26 +196,27 @@ lime | 11.0
hammingWithEnrich
required_capability: vector_similarity_functions_pushdown
required_capability: enrich_load
required_capability: enrich_dense_vector_bugfix

from colors
| eval s = v_hamming(rgb_byte_vector, [1, 2, 3])
| enrich colors_policy
| keep color_name, s
| keep color_name, cmyk_vector, s
| sort s desc, color_name asc
| limit 10
;

color_name:text | s:double
aqua marine | 18.0
coral | 18.0
corn silk | 17.0
ivory | 17.0
sea shell | 17.0
white | 17.0
beige | 16.0
chartreuse | 16.0
crimson | 16.0
gainsboro | 16.0
color_name:text | cmyk_vector:dense_vector | s:double
aqua marine | [50.0, 0.0, 17.0, 0.0] | 18.0
coral | [0.0, 50.0, 69.0, 0.0] | 18.0
corn silk | [0.0, 3.0, 14.0, 0.0] | 17.0
ivory | [0.0, 0.0, 6.0, 0.0] | 17.0
sea shell | [0.0, 4.0, 7.0, 0.0] | 17.0
white | [0.0, 0.0, 0.0, 0.0] | 17.0
beige | [0.0, 0.0, 10.0, 4.0] | 16.0
chartreuse | [50.0, 0.0, 100.0, 0.0] | 16.0
crimson | [0.0, 91.0, 73.0, 14.0] | 16.0
gainsboro | [0.0, 0.0, 0.0, 14.0] | 16.0
;

similarityWithFork
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,26 +196,27 @@ crimson | 170.0
l1NormWithEnrich
required_capability: vector_similarity_functions_pushdown
required_capability: enrich_load
required_capability: enrich_dense_vector_bugfix

from colors
| eval s = v_l1_norm(rgb_vector, [1, 2, 3])
| enrich colors_policy
| keep color_name, s
| keep color_name, cmyk_vector, s
| sort s desc, color_name asc
| limit 10
;

color_name:text | s:double
white | 759.0
snow | 749.0
azure | 744.0
ivory | 744.0
mint cream | 744.0
sea shell | 732.0
honeydew | 729.0
old lace | 722.0
corn silk | 717.0
linen | 714.0
color_name:text | cmyk_vector:dense_vector | s:double
white | [0.0, 0.0, 0.0, 0.0] | 759.0
snow | [0.0, 2.0, 2.0, 0.0] | 749.0
azure | [6.0, 0.0, 0.0, 0.0] | 744.0
ivory | [0.0, 0.0, 6.0, 0.0] | 744.0
mint cream | [4.0, 0.0, 2.0, 0.0] | 744.0
sea shell | [0.0, 4.0, 7.0, 0.0] | 732.0
honeydew | [6.0, 0.0, 6.0, 0.0] | 729.0
old lace | [0.0, 3.0, 9.0, 1.0] | 722.0
corn silk | [0.0, 3.0, 14.0, 0.0] | 717.0
linen | [0.0, 4.0, 8.0, 2.0] | 714.0
;

similarityWithFork
Expand Down
Loading