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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public class CsvTestsDataLoader {
private static final TestDataset LOGS = new TestDataset("logs");
private static final TestDataset MV_TEXT = new TestDataset("mv_text");
private static final TestDataset DENSE_VECTOR = new TestDataset("dense_vector");
private static final TestDataset COLORS = new TestDataset("colors");

public static final Map<String, TestDataset> CSV_DATASET_MAP = Map.ofEntries(
Map.entry(EMPLOYEES.indexName, EMPLOYEES),
Expand Down Expand Up @@ -204,7 +205,8 @@ public class CsvTestsDataLoader {
Map.entry(SEMANTIC_TEXT.indexName, SEMANTIC_TEXT),
Map.entry(LOGS.indexName, LOGS),
Map.entry(MV_TEXT.indexName, MV_TEXT),
Map.entry(DENSE_VECTOR.indexName, DENSE_VECTOR)
Map.entry(DENSE_VECTOR.indexName, DENSE_VECTOR),
Map.entry(COLORS.indexName, COLORS)
);

private static final EnrichConfig LANGUAGES_ENRICH = new EnrichConfig("languages_policy", "enrich-policy-languages.json");
Expand Down
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this new mapping, as I found easier when working on KNN to have a separate mapping for full text functions than to modify the default mapping - which impacted a lot of other tests.

This way we can be the owners of this mapping in case we want to add later for example sparse_vector field types, and not impact other test cases.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"properties": {
"id": {
"type": "integer"
},
"title": {
"type": "text"
},
"body": {
"type": "text"
},
"tags": {
"type": "keyword"
},
"category": {
"type": "integer"
},
"published_date": {
"type": "date"
},
"vector": {
"type": "dense_vector",
"similarity": "l2_norm"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,23 +204,7 @@ private static void checkFullTextQueryFunctions(LogicalPlan plan, Failures failu
checkCommandsBeforeExpression(
plan,
condition,
Match.class,
lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
m -> "[" + m.functionName() + "] " + m.functionType(),
failures
);
checkCommandsBeforeExpression(
plan,
condition,
MultiMatch.class,
lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
m -> "[" + m.functionName() + "] " + m.functionType(),
failures
);
checkCommandsBeforeExpression(
plan,
condition,
Term.class,
FullTextFunction.class,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simplified this to just run on all FullTextFunctions

lp -> (lp instanceof Limit == false) && (lp instanceof Aggregate == false),
m -> "[" + m.functionName() + "] " + m.functionType(),
failures
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ public String functionName() {
private TypeResolution resolveFields() {
return fields.stream()
.map(
(Expression field) -> isNotNull(field, sourceText(), FIRST).and(
(Expression field) -> isNotNull(field, sourceText(), SECOND).and(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed a bug in MultiMatch when refactoring the tests

isType(
field,
FIELD_DATA_TYPES::contains,
Expand Down
Loading