Skip to content

Commit fe42887

Browse files
Update unitTest
Signed-off-by: Andy Kwok <[email protected]>
1 parent e78b358 commit fe42887

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

core/src/test/java/org/opensearch/sql/expression/ip/GeoIPFunctionTest.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,20 @@ public class GeoIPFunctionTest {
2828
@Mock private Environment<Expression, ExprValue> env;
2929

3030
@Test
31-
public void geoIpDefaultImplementation() {
32-
UnsupportedOperationException exception =
33-
assertThrows(
34-
UnsupportedOperationException.class,
35-
() ->
36-
DSL.geoip(DSL.literal("HARDCODED_DATASOURCE_NAME"), DSL.ref("ip_address", STRING))
37-
.valueOf(env));
38-
assertTrue(exception.getMessage().matches(".*no default implementation available"));
39-
}
40-
41-
@Test
42-
public void testGeoipFnctionSignature() {
31+
public void testGeoipFunctionSignature() {
4332
var geoip = DSL.geoip(DSL.literal("HARDCODED_DATASOURCE_NAME"), DSL.ref("ip_address", STRING));
4433
assertEquals(BOOLEAN, geoip.type());
4534
}
4635

4736
/** To make sure no logic being evaluated when no environment being passed. */
4837
@Test
4938
public void testDefaultValueOf() {
50-
var geoip = DSL.geoip(DSL.literal("HARDCODED_DATASOURCE_NAME"), DSL.ref("ip_address", STRING));
51-
assertNull(geoip.valueOf());
39+
UnsupportedOperationException exception =
40+
assertThrows(
41+
UnsupportedOperationException.class,
42+
() ->
43+
DSL.geoip(DSL.literal("HARDCODED_DATASOURCE_NAME"), DSL.ref("ip_address", STRING))
44+
.valueOf(env));
45+
assertTrue(exception.getMessage().contains("OpenSearch defined function [geoip] is only supported in WHERE clause, HAVING clause and Eval operation."));
5246
}
5347
}

docs/category.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
"user/ppl/functions/condition.rst",
3434
"user/ppl/functions/datetime.rst",
3535
"user/ppl/functions/expressions.rst",
36-
"user/ppl/functions/ip.rst",
3736
"user/ppl/functions/json.rst",
3837
"user/ppl/functions/math.rst",
3938
"user/ppl/functions/relevance.rst",

0 commit comments

Comments
 (0)