Skip to content

Commit 5da2001

Browse files
committed
Clean up dead code, fix misleading comment and test name
- Remove unused VECTOR_OPTION constant from VectorSearchIndex - Clarify buildKnnQuery() comment: quoted fallback is for forward compatibility, all P0 values are already canonicalized as numeric - Rename testMissingSearchModeOptionThrows to testUnknownOptionKeyOnlyThrows to match what it actually tests Signed-off-by: Eric Wei <mengwei.eric@gmail.com>
1 parent 7d2c62a commit 5da2001

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

opensearch/src/main/java/org/opensearch/sql/opensearch/storage/VectorSearchIndex.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
*/
2424
public class VectorSearchIndex extends OpenSearchIndex {
2525

26-
private static final String VECTOR_OPTION = "vector";
27-
2826
private final String field;
2927
private final float[] vector;
3028
private final Map<String, String> options;
@@ -81,7 +79,8 @@ private QueryBuilder buildKnnQuery() {
8179
for (Map.Entry<String, String> entry : options.entrySet()) {
8280
optionsJson.append(",");
8381
String value = entry.getValue();
84-
// Numeric values go unquoted, everything else quoted
82+
// All P0 option values are canonicalized to numeric strings by validateOptions().
83+
// The quoted fallback is retained for forward compatibility with future non-numeric options.
8584
if (isNumeric(value)) {
8685
optionsJson.append(String.format("\"%s\":%s", entry.getKey(), value));
8786
} else {

opensearch/src/test/java/org/opensearch/sql/opensearch/storage/VectorSearchTableFunctionImplementationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ void testApplyArgumentsWithMinScore() {
104104
}
105105

106106
@Test
107-
void testMissingSearchModeOptionThrows() {
107+
void testUnknownOptionKeyOnlyThrows() {
108108
VectorSearchTableFunctionImplementation impl =
109109
createImplWithArgs("my-index", "embedding", "[1.0, 2.0]", "not_a_key=100");
110110
ExpressionEvaluationException ex =

0 commit comments

Comments
 (0)