Skip to content

Commit 8a305b4

Browse files
committed
Add class documentation for cidrmatch udf
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent e8215b8 commit 8a305b4

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

core/src/main/java/org/opensearch/sql/expression/function/udf/ip/CidrMatchFunction.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@
2020
import org.opensearch.sql.expression.function.ImplementorUDF;
2121
import org.opensearch.sql.expression.ip.IPFunctions;
2222

23+
/**
24+
* {@code cidrmatch(ip, cidr)} checks if ip is within the specified cidr range.
25+
*
26+
* <p>Signature:
27+
*
28+
* <ul>
29+
* <li>(STRING, STRING) -> BOOLEAN
30+
* </ul>
31+
*/
2332
public class CidrMatchFunction extends ImplementorUDF {
2433
public CidrMatchFunction() {
2534
super(new CidrMatchImplementor(), NullPolicy.ANY);
@@ -37,12 +46,12 @@ public Expression implement(
3746
return Expressions.call(CidrMatchImplementor.class, "cidrMatch", translatedOperands);
3847
}
3948

40-
public static Object cidrMatch(ExprIpValue ip, String cidr) {
49+
public static boolean cidrMatch(ExprIpValue ip, String cidr) {
4150
ExprValue cidrValue = ExprValueUtils.stringValue(cidr);
42-
return IPFunctions.exprCidrMatch(ip, cidrValue).valueForCalcite();
51+
return (boolean) IPFunctions.exprCidrMatch(ip, cidrValue).valueForCalcite();
4352
}
4453

45-
public static Object cidrMatch(String ip, String cidr) {
54+
public static boolean cidrMatch(String ip, String cidr) {
4655
ExprIpValue ipValue = (ExprIpValue) ExprValueUtils.ipValue(ip);
4756
return cidrMatch(ipValue, cidr);
4857
}

0 commit comments

Comments
 (0)