MCPcopy Create free account
hub / github.com/PostHog/duckgres / extractArrowValue

Function extractArrowValue

server/flightclient/flight_executor.go:726–810  ·  view source on GitHub ↗

extractArrowValue extracts a Go value from an Arrow array at the given row index.

(col arrow.Array, row int)

Source from the content-addressed store, hash-verified

724 })
725 if err != nil {
726 return err
727 }
728
729 ctx, cancel := context.WithTimeout(context.Background(), queryCloseWaitTimeout)
730 defer cancel()
731 if e.ctx != nil {
732 go func() {
733 select {
734 case <-e.ctx.Done():
735 cancel()
736 case <-ctx.Done():
737 }
738 }()
739 }
740
741 stream, err := e.client.Client.DoAction(
742 e.withSession(ctx),
743 &flight.Action{Type: releaseQueryHandleAction, Body: payload},
744 )
745 if err != nil {
746 if isTerminalSessionIdleWaitError(err) {
747 return nil
748 }
749 return err
750 }
751 for {
752 _, err := stream.Recv()
753 if errors.Is(err, io.EOF) {
754 return nil
755 }
756 if err != nil {
757 if isTerminalSessionIdleWaitError(err) {
758 return nil
759 }
760 return err
761 }
762 }
763}
764
765func (e *FlightExecutor) LastProfilingOutput() string {
766 v := e.lastProfiling.Load()
767 if v == nil {
768 return ""
769 }
770 return v.(string)
771}
772
773const profilingMetadataKey = "x-duckgres-profiling"
774
775func (e *FlightExecutor) storeProfilingFromTrailer(trailer metadata.MD) {
776 if vals := trailer.Get(profilingMetadataKey); len(vals) > 0 {
777 e.lastProfiling.Store(vals[0])
778 } else {
779 e.lastProfiling.Store("")
780 }
781}
782
783// FlightRowSet wraps an Arrow Flight RecordBatch reader to implement RowSet.

Calls 4

timestampToTimeFunction · 0.85
decimalToBigIntFunction · 0.85
monthDayNanoToIntervalFunction · 0.85
AddMethod · 0.80