@@ -695,7 +695,7 @@ type IteratorOptions struct {
695695 // and close as soon as possible.
696696 InterruptCh <- chan struct {}
697697
698- // Authorizer can limit acccess to data
698+ // Authorizer can limit access to data
699699 Authorizer Authorizer
700700}
701701
@@ -1025,15 +1025,17 @@ func encodeIteratorOptions(opt *IteratorOptions) *internal.IteratorOptions {
10251025 }
10261026
10271027 // Convert and encode aux fields as variable references.
1028- pb .Fields = make ([]* internal.VarRef , len (opt .Aux ))
1029- pb .Aux = make ([]string , len (opt .Aux ))
1030- for i , ref := range opt .Aux {
1031- pb .Fields [i ] = encodeVarRef (ref )
1032- pb .Aux [i ] = ref .Val
1028+ if opt .Aux != nil {
1029+ pb .Fields = make ([]* internal.VarRef , len (opt .Aux ))
1030+ pb .Aux = make ([]string , len (opt .Aux ))
1031+ for i , ref := range opt .Aux {
1032+ pb .Fields [i ] = encodeVarRef (ref )
1033+ pb .Aux [i ] = ref .Val
1034+ }
10331035 }
10341036
10351037 // Encode group by dimensions from a map.
1036- if pb .GroupBy != nil {
1038+ if opt .GroupBy != nil {
10371039 dimensions := make ([]string , 0 , len (opt .GroupBy ))
10381040 for dim := range opt .GroupBy {
10391041 dimensions = append (dimensions , dim )
@@ -1069,7 +1071,6 @@ func decodeIteratorOptions(pb *internal.IteratorOptions) (*IteratorOptions, erro
10691071 Interval : decodeInterval (pb .GetInterval ()),
10701072 Dimensions : pb .GetDimensions (),
10711073 Fill : FillOption (pb .GetFill ()),
1072- FillValue : pb .GetFillValue (),
10731074 StartTime : pb .GetStartTime (),
10741075 EndTime : pb .GetEndTime (),
10751076 Ascending : pb .GetAscending (),
@@ -1105,9 +1106,9 @@ func decodeIteratorOptions(pb *internal.IteratorOptions) (*IteratorOptions, erro
11051106 for i , ref := range fields {
11061107 opt .Aux [i ] = decodeVarRef (ref )
11071108 }
1108- } else {
1109- opt .Aux = make ([]VarRef , len (pb . GetAux () ))
1110- for i , name := range pb . GetAux () {
1109+ } else if aux := pb . GetAux (); aux != nil {
1110+ opt .Aux = make ([]VarRef , len (aux ))
1111+ for i , name := range aux {
11111112 opt .Aux [i ] = VarRef {Val : name }
11121113 }
11131114 }
@@ -1134,6 +1135,11 @@ func decodeIteratorOptions(pb *internal.IteratorOptions) (*IteratorOptions, erro
11341135 opt .GroupBy = dimensions
11351136 }
11361137
1138+ // Set the fill value, if set.
1139+ if pb .FillValue != nil {
1140+ opt .FillValue = pb .GetFillValue ()
1141+ }
1142+
11371143 // Set condition, if set.
11381144 if pb .Condition != nil {
11391145 expr , err := ParseExpr (pb .GetCondition ())
0 commit comments