From 7fd5248d98c1613d20df57cac1bd0e8c68e86ba4 Mon Sep 17 00:00:00 2001 From: Travis Date: Tue, 12 Nov 2019 16:13:52 -0600 Subject: [PATCH] makeRows in gRPC hander now handles a bool result This PR adds bool support to the makeRows function in the gRPC handler. --- server/grpc.go | 7 +++++++ server/grpc_internal_test.go | 15 +++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/server/grpc.go b/server/grpc.go index 485f29215..a4027a578 100644 --- a/server/grpc.go +++ b/server/grpc.go @@ -535,6 +535,13 @@ func makeRows(resp pilosa.QueryResponse) chan *pb.RowResponse { Columns: []*pb.ColumnResponse{ &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_Uint64Val{Uint64Val: uint64(r)}}, }} + case bool: + ci := []*pb.ColumnInfo{{Name: "changed", Datatype: "bool"}} + results <- &pb.RowResponse{ + Headers: ci, + Columns: []*pb.ColumnResponse{ + &pb.ColumnResponse{ColumnVal: &pb.ColumnResponse_BoolVal{BoolVal: r}}, + }} default: log.Printf("unhandled %T\n", r) breakLoop = true diff --git a/server/grpc_internal_test.go b/server/grpc_internal_test.go index 8dc1f19d0..fae8c86ea 100644 --- a/server/grpc_internal_test.go +++ b/server/grpc_internal_test.go @@ -204,6 +204,16 @@ func TestGRPC(t *testing.T) { {uint64(123)}, }, }, + // bool + { + true, + []expHeader{ + {"changed", "bool"}, + }, + [][]expColumn{ + {true}, + }, + }, } for ti, test := range tests { @@ -242,6 +252,11 @@ func TestGRPC(t *testing.T) { if val != v { t.Fatalf("test %d expected column val: %v, but got: %v", ti, v, val) } + case bool: + val := column.GetBoolVal() + if val != v { + t.Fatalf("test %d expected column val: %v, but got: %v", ti, v, val) + } default: t.Fatalf("test %d has unhandled data type: %T", ti, v) }