Skip to content

Commit e1aecf0

Browse files
committed
Fix merge
1 parent bf92cf4 commit e1aecf0

File tree

7 files changed

+10
-9
lines changed

7 files changed

+10
-9
lines changed

x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/plugin/KnnFunctionIT.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.elasticsearch.action.index.IndexRequestBuilder;
1111
import org.elasticsearch.cluster.metadata.IndexMetadata;
1212
import org.elasticsearch.common.settings.Settings;
13-
import org.elasticsearch.search.vectors.KnnVectorQueryBuilder;
1413
import org.elasticsearch.xcontent.XContentBuilder;
1514
import org.elasticsearch.xcontent.XContentFactory;
1615
import org.elasticsearch.xpack.esql.EsqlTestUtils;
@@ -63,8 +62,6 @@ public void testKnnDefaults() {
6362
var score = (Double) row.get(2);
6463
assertNotNull(score);
6564
assertTrue(score > 0.0);
66-
// dense_vector is null for now
67-
assertNull(row.get(3));
6865
}
6966
}
7067
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,12 @@ public enum Cap {
11391139
/**
11401140
* Dense vector field type support
11411141
*/
1142-
DENSE_VECTOR_FIELD_TYPE(EsqlCorePlugin.DENSE_VECTOR_FEATURE_FLAG);
1142+
DENSE_VECTOR_FIELD_TYPE(EsqlCorePlugin.DENSE_VECTOR_FEATURE_FLAG),
1143+
1144+
/**
1145+
* Support knn function
1146+
*/
1147+
KNN_FUNCTION(Build.current().isSnapshot());
11431148

11441149
private final boolean enabled;
11451150

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/PositionToXContent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ protected XContentBuilder valueToXContent(XContentBuilder builder, ToXContent.Pa
191191
}
192192
};
193193
case DATE_PERIOD, TIME_DURATION, DOC_DATA_TYPE, TSID_DATA_TYPE, SHORT, BYTE, OBJECT, FLOAT, HALF_FLOAT, SCALED_FLOAT,
194-
PARTIAL_AGG, DENSE_VECTOR -> throw new IllegalArgumentException("can't convert values of type [" + columnInfo.type() + "]");
194+
PARTIAL_AGG -> throw new IllegalArgumentException("can't convert values of type [" + columnInfo.type() + "]");
195195
};
196196
}
197197
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ResponseValueUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private static Object valueAt(DataType dataType, Block block, int offset, BytesR
150150
}
151151
case DENSE_VECTOR -> ((FloatBlock) block).getFloat(offset);
152152
case SHORT, BYTE, FLOAT, HALF_FLOAT, SCALED_FLOAT, OBJECT, DATE_PERIOD, TIME_DURATION, DOC_DATA_TYPE, TSID_DATA_TYPE, NULL,
153-
PARTIAL_AGG, DENSE_VECTOR -> throw EsqlIllegalArgumentException.illegalDataType(dataType);
153+
PARTIAL_AGG -> throw EsqlIllegalArgumentException.illegalDataType(dataType);
154154
};
155155
}
156156
}

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/vector/Knn.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected TypeResolution resolveParams() {
110110
}
111111

112112
return isNotNull(field(), sourceText(), FIRST).and(isType(field(), dt -> dt == DENSE_VECTOR, sourceText(), FIRST, "dense_vector"))
113-
.and(isType(query(), dt -> dt == DENSE_VECTOR, sourceText(), TypeResolutions.ParamOrdinal.SECOND));
113+
.and(isType(query(), dt -> dt == DENSE_VECTOR, sourceText(), TypeResolutions.ParamOrdinal.SECOND, "dense_vector"));
114114
}
115115

116116
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/planner/LocalExecutionPlanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ private PhysicalOperation planTopN(TopNExec topNExec, LocalExecutionPlannerConte
473473
case GEO_POINT, CARTESIAN_POINT, GEO_SHAPE, CARTESIAN_SHAPE, COUNTER_LONG, COUNTER_INTEGER, COUNTER_DOUBLE, SOURCE,
474474
AGGREGATE_METRIC_DOUBLE, DENSE_VECTOR -> TopNEncoder.DEFAULT_UNSORTABLE;
475475
// unsupported fields are encoded as BytesRef, we'll use the same encoder; all values should be null at this point
476-
case PARTIAL_AGG, DENSE_VECTOR, UNSUPPORTED -> TopNEncoder.UNSUPPORTED;
476+
case PARTIAL_AGG, UNSUPPORTED -> TopNEncoder.UNSUPPORTED;
477477
};
478478
}
479479
List<TopNOperator.SortOrder> orders = topNExec.order().stream().map(order -> {

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/VerifierTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,6 @@ public void testAggregateOnCounter() {
10811081
+ " found value [network.bytes_in] type [counter_long]"
10821082
)
10831083
);
1084-
}
10851084

10861085
assertThat(
10871086
error("FROM tests | STATS max(network.bytes_in)", tsdb),

0 commit comments

Comments
 (0)