Skip to content

Commit 0230385

Browse files
committed
Update testdata.go
1 parent da37f95 commit 0230385

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

schema/testdata.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/base64"
66
"fmt"
77
"math/rand"
8+
"net"
89
"strconv"
910
"strings"
1011
"time"
@@ -316,9 +317,11 @@ func (tg TestDataGenerator) getExampleJSON(colName string, dataType arrow.DataTy
316317

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

320323
// Format as an IP address with CIDR notation
321-
return fmt.Sprintf(`"%d.%d.%d.%d/%d"`, ip[0], ip[1], ip[2], ip[3], cidr)
324+
return fmt.Sprintf(`"%s"`, data.String())
322325
}
323326
if arrow.TypeEqual(dataType, types.ExtensionTypes.MAC) {
324327
mac := make([]byte, 6)

0 commit comments

Comments
 (0)