> 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-1.4.0/functions-1/issubnetof.md).

# isSubnetOf

This section contains reference documentation for the isSubnetOf function.

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

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>
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>
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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pinot.apache.org/release-1.4.0/functions-1/issubnetof.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
