Skip to content

Commit

Permalink
Minor documentation to better align with Spark cidrmatch behaviour.
Browse files Browse the repository at this point in the history
Signed-off-by: currantw <[email protected]>
  • Loading branch information
currantw committed Oct 29, 2024
1 parent 5cb25e4 commit b4a233c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ private DefaultFunctionResolver cidrmatch() {
}

/**
* Returns whether the given IP address is within the specified IP address range. Supports both
* IPv4 and IPv6 addresses.
* Returns whether the given IP address is within the specified CIDR IP address range.
* Supports both IPv4 and IPv6 addresses.
*
* @param addressExprValue IP address (e.g. "198.51.100.14" or "2001:0db8::ff00:42:8329").
* @param rangeExprValue IP address range in CIDR notation (e.g. "198.51.100.0/24" or
Expand Down
4 changes: 2 additions & 2 deletions docs/user/ppl/functions/condition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ NULLIF
Description
>>>>>>>>>>>

Usage: nullif(field1, field2) return null if two parameters are same, otherwiser return field1.
Usage: nullif(field1, field2) return null if two parameters are same, otherwise return field1.

Argument type: all the supported data type, (NOTE : if two parameters has different type, if two parameters has different type, you will fail semantic check)

Expand Down Expand Up @@ -152,7 +152,7 @@ IF
Description
>>>>>>>>>>>

Usage: if(condition, expr1, expr2) return expr1 if condition is true, otherwiser return expr2.
Usage: if(condition, expr1, expr2) return expr1 if condition is true, otherwise return expr2.

Argument type: all the supported data type, (NOTE : if expr1 and expr2 are different type, you will fail semantic check

Expand Down
26 changes: 13 additions & 13 deletions docs/user/ppl/functions/ip.rst
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
================
IP Functions
================
====================
IP Address Functions
====================

.. rubric:: Table of contents

.. contents::
:local:
:depth: 1

CIDR
------
CIDRMATCH
---------

Description
>>>>>>>>>>>

Usage: cidr(address, range) returns whether the given IP address is within the specified IP address range. Supports both IPv4 and IPv6 addresses.
Usage: cidrmatch(ip, cidr) returns whether the given IP address is within the specified CIDR IP address range. Supports both IPv4 and IPv6 addresses.

Argument type: STRING, STRING

Return type: BOOLEAN

Example::

os> source=weblogs | where cidr(address, "199.120.110.0/24") | fields host, method, url
fetched rows / total rows = 1/1
+----------------+--------+----------------------------------------------+
| host | method | url |
|----------------+--------+----------------------------------------------+
| 199.120.110.21 | GET | /shuttle/missions/sts-73/mission-sts-73.html |
+----------------+--------+----------------------------------------------+
os> source=weblogs | where cidrmatch(host, "199.120.110.0/24") | fields host
fetched rows / total rows = 1/3
+----------------+
| host |
|----------------+
| 199.120.110.21 |
+----------------+

2 changes: 1 addition & 1 deletion docs/user/ppl/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ The query start with search command and then flowing a set of command delimited

- `System Functions <functions/system.rst>`_

- `IP Functions <functions/ip.rst>`_
- `IP Address Functions <functions/ip.rst>`_

* **Optimization**

Expand Down

0 comments on commit b4a233c

Please sign in to comment.