duckdb / duckdb/duckdb-inet

Question about PRs (I have a new function to contribute)

Open
#4 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
13
Forks
26
PR merge metrics
No merged PRs in 30d

Description

Hey folks!

I make regular use of this extension and have made a function `expand_cidr()` that takes in an IP address (network or bare) and returns the expanded IPs from the CIDR in a list/array. Handles IPv4 & v6.

I'm curious if (a) y'all accept PRs and (b) if so, what should I do to ensure the least amount of work on your end?

A short example:

```
πŸ¦†>SELECT UNNEST(expand_cidr('192.168.1.0/32'::INET)) ip;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ip β”‚
β”‚ inet β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 192.168.1.0 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ¦†>SELECT UNNEST(expand_cidr('192.168.1.0/30'::INET)) ip;
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ ip β”‚
β”‚ inet β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 192.168.1.0 β”‚
β”‚ 192.168.1.1 β”‚
β”‚ 192.168.1.2 β”‚
β”‚ 192.168.1.3 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ¦†>FROM (SELECT UNNEST(expand_cidr('192.168.1.0/16'::INET)) ip) SELECT COUNT(ip);
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ count(ip) β”‚
β”‚ int64 β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 65536 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
πŸ¦†>
```

Please ignore this PR: https://github.com/duckdb/duckdb-inet/pull/3

This is the correct PR: https://github.com/duckdb/duckdb-inet/pull/5

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.