From 677bdc873963eb027b19b5db47dab3aaaddfab01 Mon Sep 17 00:00:00 2001 From: currantw Date: Fri, 22 Nov 2024 10:09:43 -0800 Subject: [PATCH] Fix failing tests and add TODOs for #3145 (add support for IP address type). Signed-off-by: currantw --- .../java/org/opensearch/sql/expression/ip/IPFunction.java | 2 ++ .../java/org/opensearch/sql/expression/ip/IPFunctionTest.java | 1 + .../src/test/java/org/opensearch/sql/legacy/JdbcTestIT.java | 4 +++- .../src/test/java/org/opensearch/sql/ppl/IPFunctionIT.java | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/opensearch/sql/expression/ip/IPFunction.java b/core/src/main/java/org/opensearch/sql/expression/ip/IPFunction.java index 48738de54c..855d557916 100644 --- a/core/src/main/java/org/opensearch/sql/expression/ip/IPFunction.java +++ b/core/src/main/java/org/opensearch/sql/expression/ip/IPFunction.java @@ -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)); diff --git a/core/src/test/java/org/opensearch/sql/expression/ip/IPFunctionTest.java b/core/src/test/java/org/opensearch/sql/expression/ip/IPFunctionTest.java index ccee1783d1..b50bf9fd1f 100644 --- a/core/src/test/java/org/opensearch/sql/expression/ip/IPFunctionTest.java +++ b/core/src/test/java/org/opensearch/sql/expression/ip/IPFunctionTest.java @@ -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"); diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/JdbcTestIT.java b/integ-test/src/test/java/org/opensearch/sql/legacy/JdbcTestIT.java index 74acad4f52..005119a9bc 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/JdbcTestIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/JdbcTestIT.java @@ -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\"")); } diff --git a/integ-test/src/test/java/org/opensearch/sql/ppl/IPFunctionIT.java b/integ-test/src/test/java/org/opensearch/sql/ppl/IPFunctionIT.java index 8fe14809ac..adb044d0d2 100644 --- a/integ-test/src/test/java/org/opensearch/sql/ppl/IPFunctionIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/ppl/IPFunctionIT.java @@ -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