Skip to content

Commit

Permalink
Fix failing tests and add TODOs for opensearch-project#3145 (add supp…
Browse files Browse the repository at this point in the history
…ort for IP address type).

Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Nov 22, 2024
1 parent e758077 commit 677bdc8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public void register(BuiltinFunctionRepository repository) {
}

private DefaultFunctionResolver cidrmatch() {

// TODO #3145: Add support for IP address data type.
return define(
BuiltinFunctionName.CIDRMATCH.getName(),
impl(nullMissingHandling(IPFunction::exprCidrMatch), BOOLEAN, STRING, STRING));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class IPFunctionTest {
private static final ExprValue IPv4Range = ExprValueUtils.stringValue("198.51.100.0/24");
private static final ExprValue IPv6Range = ExprValueUtils.stringValue("2001:0db8::/32");

// TODO #3145: Add tests for IP address data type.
private static final ExprValue IPv4AddressBelow = ExprValueUtils.stringValue("198.51.99.1");
private static final ExprValue IPv4AddressWithin = ExprValueUtils.stringValue("198.51.100.1");
private static final ExprValue IPv4AddressAbove = ExprValueUtils.stringValue("198.51.101.2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ public void dateFunctionNameCaseInsensitiveTest() {
public void ipTypeShouldPassJdbcFormatter() {
assertThat(
executeQuery(
"SELECT host AS hostIP FROM " + TestsConstants.TEST_INDEX_WEBLOG + " ORDER BY hostIP",
"SELECT host_ip AS hostIP FROM "
+ TestsConstants.TEST_INDEX_WEBLOG
+ " ORDER BY hostIP",
"jdbc"),
containsString("\"type\": \"ip\""));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void init() throws IOException {
@Test
public void test_cidrmatch() throws IOException {

// TODO #3145: Add tests for IP address data type.
JSONObject result;

// No matches
Expand Down

0 comments on commit 677bdc8

Please sign in to comment.