File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,11 @@ func (s *DataPlatformDataServiceServerImpl) CreateForecast(
182182 roundedStats [k ] = roundedVal
183183 }
184184
185+ // Since CreatePredictedValues uses COPYFROM, manually coerce empty metadata to nil
186+ if value .Metadata != nil && len (value .Metadata .Fields ) == 0 {
187+ value .Metadata = nil
188+ }
189+
185190 var otherStats * structpb.Struct
186191
187192 if len (roundedStats ) > 0 {
Original file line number Diff line number Diff line change @@ -1518,7 +1518,7 @@ func TestCreateForecast(t *testing.T) {
15181518 HorizonMins : uint32 (i * 30 ),
15191519 P50Fraction : 0.0 ,
15201520 OtherStatisticsFractions : map [string ]float32 {},
1521- Metadata : nil ,
1521+ Metadata : & structpb. Struct {} ,
15221522 }
15231523 }
15241524
@@ -1550,7 +1550,7 @@ func TestCreateForecast(t *testing.T) {
15501550 },
15511551 },
15521552 {
1553- name : "Should create forecast with zeroed values" ,
1553+ name : "Should create forecast with zeroed values and metadata " ,
15541554 req : & pb.CreateForecastRequest {
15551555 LocationUuid : siteResp .LocationUuid ,
15561556 Forecaster : fcResp .Forecaster ,
You can’t perform that action at this time.
0 commit comments