Skip to content

Commit

Permalink
Added tests for wildcard KEEP
Browse files Browse the repository at this point in the history
  • Loading branch information
craigtaverner committed Dec 13, 2024
1 parent 99dbc09 commit 134a152
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,19 @@ public void testLookupJoinKeep() {
);
}

public void testLookupJoinKeepWildcard() {
assertFieldNames(
"""
FROM employees
| KEEP languages
| RENAME languages AS language_code
| LOOKUP JOIN languages_lookup ON language_code
| KEEP language*""",
Set.of("language*", "languages", "languages.*", "language_code", "language_code.*"),
Set.of() // Since we have KEEP after the LOOKUP, we can use the global field names instead of wildcarding the lookup index
);
}

public void testMultiLookupJoin() {
assertFieldNames(
"""
Expand Down Expand Up @@ -1459,6 +1472,19 @@ public void testMultiLookupJoinKeepAfter() {
);
}

public void testMultiLookupJoinKeepAfterWildcard() {
assertFieldNames(
"""
FROM sample_data
| EVAL client_ip = client_ip::keyword
| LOOKUP JOIN clientips_lookup ON client_ip
| LOOKUP JOIN message_types_lookup ON message
| KEEP *env*, *type*""",
Set.of("*env*", "*type*", "client_ip", "message", "client_ip.*", "message.*"),
Set.of() // Since the KEEP is after both JOINs, we can use the global field names
);
}

public void testMultiLookupJoinSameIndex() {
assertFieldNames(
"""
Expand Down

0 comments on commit 134a152

Please sign in to comment.