ianmcook commented on code in PR #39081:
URL: https://github.com/apache/arrow/pull/39081#discussion_r1449086865
##########
http/examples/get/client.go:
##########
@@ -0,0 +1,53 @@
+package main
+
+import (
+ "fmt"
+ "net/http"
+ "time"
+
+ "github.com/apache/arrow/go/v15/arrow"
+ "github.com/apache/arrow/go/v15/arrow/ipc"
+ "github.com/apache/arrow/go/v15/arrow/memory"
+)
+
+func main() {
+ start := time.Now()
+ resp, err := http.Get("http://localhost:8000")
+ if err != nil {
+ panic(err)
+ }
+
+ if resp.StatusCode != http.StatusOK {
+ panic(fmt.Errorf("got non-200 status: %d", resp.StatusCode))
+ }
+ defer resp.Body.Close()
+
+ rdr, err := ipc.NewReader(resp.Body,
ipc.WithAllocator(memory.DefaultAllocator))
+ if err != nil {
+ panic(err)
+ }
+ defer rdr.Release()
+
+ batches := make([]arrow.Record, 0)
+ defer func() {
+ for _, b := range batches {
+ b.Release()
+ }
+ }()
+
+ for rdr.Next() {
+ rec := rdr.Record()
+ rec.Retain()
+ batches = append(batches, rec)
+ }
+
+ if rdr.Err() != nil {
+ panic(rdr.Err())
+ }
+
+ execTime := time.Since(start)
+
+ fmt.Println(resp.ContentLength, " bytes recieved")
Review Comment:
Ok thanks; for now I'll just remove it for simplicity, since most of the
other client examples do not print the size of received bytes (due to the added
complication that would be needed).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]