File tree Expand file tree Collapse file tree
core/src/main/java/org/opensearch/sql/expression/function/udf/ip Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020import org .opensearch .sql .expression .function .ImplementorUDF ;
2121import 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+ */
2332public 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 }
You can’t perform that action at this time.
0 commit comments