File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
main/java/org/elasticsearch/xpack/esql/analysis
test/java/org/elasticsearch/xpack/esql/analysis Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 169169import static org .elasticsearch .xpack .esql .core .type .DataType .TIME_DURATION ;
170170import static org .elasticsearch .xpack .esql .core .type .DataType .UNSUPPORTED ;
171171import static org .elasticsearch .xpack .esql .core .type .DataType .VERSION ;
172- import static org .elasticsearch .xpack .esql .core .type .DataType .isString ;
173172import static org .elasticsearch .xpack .esql .core .type .DataType .isTemporalAmount ;
174173import static org .elasticsearch .xpack .esql .telemetry .FeatureMetric .LIMIT ;
175174import static org .elasticsearch .xpack .esql .type .EsqlDataTypeConverter .maybeParseTemporalAmount ;
@@ -1670,8 +1669,8 @@ private static Expression processVectorFunction(org.elasticsearch.xpack.esql.cor
16701669 List <Expression > args = vectorFunction .arguments ();
16711670 List <Expression > newArgs = new ArrayList <>();
16721671 for (Expression arg : args ) {
1673- if (arg .resolved ()) {
1674- if (arg .foldable () && arg . dataType (). isNumeric () ) {
1672+ if (arg .resolved () && arg . dataType (). isNumeric () ) {
1673+ if (arg .foldable ()) {
16751674 Object folded = arg .fold (FoldContext .small () /* TODO remove me */ );
16761675 if (folded instanceof List ) {
16771676 // Convert to floats so blocks are created accordingly
@@ -1685,7 +1684,7 @@ private static Expression processVectorFunction(org.elasticsearch.xpack.esql.cor
16851684 newArgs .add (denseVector );
16861685 continue ;
16871686 }
1688- } else if ( arg . dataType (). isNumeric () || isString ( arg . dataType ())) {
1687+ } else {
16891688 // add casting function
16901689 newArgs .add (new ToDenseVector (arg .source (), arg ));
16911690 continue ;
Original file line number Diff line number Diff line change @@ -2434,10 +2434,10 @@ private void checkDenseVectorImplicitCastingSimilarityFunction(String similarity
24342434 assertEquals ("similarity" , alias .name ());
24352435 var similarity = as (alias .child (), VectorSimilarityFunction .class );
24362436 var left = as (similarity .left (), FieldAttribute .class );
2437- var queryVector = as ( similarity . right ( ), ToDenseVector . class );
2438- assertEquals ( DataType . DENSE_VECTOR , queryVector . dataType () );
2439- var refAttr = as ( queryVector . children (). get ( 0 ), ReferenceAttribute . class );
2440- assertThat (refAttr . name (), is ( "query" ));
2437+ assertThat ( List . of ( "float_vector" , "byte_vector" ), hasItem ( left . name ()) );
2438+ var right = as ( similarity . right (), Literal . class );
2439+ assertThat ( right . dataType (), is ( DENSE_VECTOR ) );
2440+ assertThat (right . value (), equalTo ( expectedElems ));
24412441 }
24422442
24432443 public void testDenseVectorEvalCastingSimilarityFunctions () {
You can’t perform that action at this time.
0 commit comments