> For the complete documentation index, see [llms.txt](https://docs.pinot.apache.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pinot.apache.org/release-0.12.1/configuration-reference/functions/issubnetof.md).

# isSubnetOf

Takes 2 arguments of type STRING. The first argument is an `ipPrefix`, and the second argument is a single `ipAddress`. This function handles both IPv4 and IPv6 arguments.

Returns a boolean value checking if `ipAddress` is in the subnet of `ipPrefix`

## Signatures

`isSubnetOf(ipPrefix, ipAddress) -> boolean`

## Usage Examples

Please see the following sample queries where `isSubnetOf` is used in different parts of the query.

<pre class="language-sql"><code class="lang-sql">SELECT isSubnetOf('192.168.0.1/24', '192.168.0.225') 
<strong>AS result
</strong><strong>FROM myTable;
</strong><strong>---> returns true
</strong><strong>
</strong>SELECT isSubnetOf('1.2.3.128/26', '1.2.5.1') 
AS result
FROM myTable;
---> returns false
</code></pre>

```sql
SELECT isSubnetOf('2001:4800:7825:103::/64', '2001:4800:7825:103::2050')
AS result
FROM myTable;
---> returns true

SELECT isSubnetOf('7890:db8:113::8a2e:370:7334/127', '7890:db8:113::8a2e:370:7336') 
AS result
FROM myTable;
---> returns false
```

<pre class="language-sql"><code class="lang-sql"><strong>SELECT count(*) 
</strong><strong>FROM myTable 
</strong><strong>WHERE isSubnetOf('192.168.0.1/24', ipAddressCol);
</strong><strong>
</strong>SELECT count(*) 
FROM myTable 
WHERE isSubnetOf('192.168.0.1/24', ipAddressCol) 
OR isSubnetOf(ipPrefixCol, '7890:db8:113::8a2e:370:7336');
</code></pre>

<pre class="language-sql"><code class="lang-sql">SELECT 
<strong>    CASE 
</strong>        WHEN isSubnetOf('105.25.245.115/27', srcIPAddress) THEN 'case1' 
        WHEN isSubnetOf('105.25.245.115/27', dstIPAddress) THEN 'case2'
        ELSE 'case3' 
    END AS differentFlow
FROM myTable;
</code></pre>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pinot.apache.org/release-0.12.1/configuration-reference/functions/issubnetof.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
