From 4d3f8ec6551ab7cfd14d2e18dfb5501c4d037163 Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Thu, 11 May 2023 10:35:14 +0200 Subject: [PATCH] Use Sneller ION library to decode "columns" meta-query result --- go.mod | 1 - go.sum | 2 -- pkg/plugin/api.go | 4 ++-- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 5c08618..64f224e 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,6 @@ go 1.19 require ( github.com/SnellerInc/sneller v0.0.0-20230505151417-5806cd3a42c7 - github.com/amazon-ion/ion-go v1.2.0 github.com/grafana/grafana-plugin-sdk-go v0.159.0 github.com/patrickmn/go-cache v2.1.0+incompatible go.opentelemetry.io/otel v1.14.0 diff --git a/go.sum b/go.sum index aa15376..6547609 100644 --- a/go.sum +++ b/go.sum @@ -43,8 +43,6 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/SnellerInc/sneller v0.0.0-20230505151417-5806cd3a42c7 h1:3GAYAlEQoiW3q8x88cbi140EM1p3g8vBHxqWS75Oro8= github.com/SnellerInc/sneller v0.0.0-20230505151417-5806cd3a42c7/go.mod h1:BaisUxgu4MI9tL6dwYPccGKsXkBP7+BnMz8fL/F/TNk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= -github.com/amazon-ion/ion-go v1.2.0 h1:EgFy23/7gRxRYdUkJARh/7eZc8BYkFFDZZSqB3PwVqQ= -github.com/amazon-ion/ion-go v1.2.0/go.mod h1:3ZEje8i20TiIPVZlN+KE3B2ppZ1B8d9F/KaT7Dtec+k= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40 h1:q4dksr6ICHXqG5hm0ZW5IHyeEJXoIJSOZeBLmWPNeIQ= github.com/apache/arrow/go/arrow v0.0.0-20211112161151-bc219186db40/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs= diff --git a/pkg/plugin/api.go b/pkg/plugin/api.go index 86605d3..b546ff0 100644 --- a/pkg/plugin/api.go +++ b/pkg/plugin/api.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/amazon-ion/ion-go/ion" + "github.com/SnellerInc/sneller/ion" "github.com/grafana/grafana-plugin-sdk-go/backend/log" "golang.org/x/exp/maps" ) @@ -122,7 +122,7 @@ func (d *Datasource) getColumns(ctx context.Context, database, table string) ([] payload := map[string]any{} - err = ion.UnmarshalFrom(ion.NewReader(resp.Body), &payload) + err = ion.NewDecoder(resp.Body, 1024*1024*10).Decode(&payload) if err != nil { return nil, 500, err }