Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions schema/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"encoding/base64"
"fmt"
"math/rand"
"net"
"strconv"
"strings"
"time"
Expand Down Expand Up @@ -317,11 +316,9 @@ func (tg TestDataGenerator) getExampleJSON(colName string, dataType arrow.DataTy

// Generate a CIDR prefix length between 8 and 30
cidr := 8 + rnd.Intn(23)
input := fmt.Sprintf(`%d.%d.%d.%d/%d`, ip[0], ip[1], ip[2], ip[3], cidr)
_, data, _ := net.ParseCIDR(input)

// Format as an IP address with CIDR notation
return fmt.Sprintf(`"%s"`, data.String())
return fmt.Sprintf(`"%d.%d.%d.%d/%d"`, ip[0], ip[1], ip[2], ip[3], cidr)
}
if arrow.TypeEqual(dataType, types.ExtensionTypes.MAC) {
mac := make([]byte, 6)
Expand Down
3 changes: 2 additions & 1 deletion types/inet.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@ func (b *InetBuilder) AppendValueFromString(s string) error {
b.AppendNull()
return nil
}
_, data, err := net.ParseCIDR(s)
ip, data, err := net.ParseCIDR(s)
if err != nil {
return err
}
data.IP = ip
b.Append(data)
return nil
}
Expand Down
Loading