@@ -398,31 +398,47 @@ public void run()
398398 // time series that use millimeters as the unit. Include all
399399 // labels in the results.
400400 var mmFilters = new List < string > { "unit=mm" } ;
401- var res30 = db . TS ( ) . MRange ( "-" , 2 , mmFilters , withLabels : true ) ;
401+
402+ IReadOnlyList <
403+ ( string , IReadOnlyList < TimeSeriesLabel > , IReadOnlyList < TimeSeriesTuple > )
404+ > res30 = db . TS ( ) . MRange (
405+ "-" , 2 , mmFilters , withLabels : true
406+ ) ;
402407 Console . WriteLine ( res30 . Count ) ; // >>> 1
403408
404409 foreach ( var ( key , labels_result , values ) in res30 )
405410 {
406- Console . WriteLine ( $ "{ key } : ({ string . Join ( ", " , labels_result . Select ( l => $ "{ l . Key } ={ l . Value } ") ) } ) { values . Count } data points") ;
411+ Console . WriteLine ( $ "{ key } :") ;
412+ Console . WriteLine ( $ " Labels: ({ string . Join ( ", " , labels_result . Select ( l => $ "{ l . Key } ={ l . Value } ") ) } )") ;
413+ Console . WriteLine ( $ " Values: [{ string . Join ( ", " , values . Select ( t => $ "({ t . Time . Value } , { t . Val } )") ) } ]") ;
407414 }
408- // >>> rg:4: (location=uk, unit=mm) 3 data points
415+ // >>> rg:4:
416+ // >>> Labels:location=uk,unit=mm
417+ // >>> Values: [(1, 23), (2, 21), (3, 19)]
409418
410419 // Retrieve data points from time 1 to time 3 (inclusive) from
411420 // all time series that use centimeters or millimeters as the unit,
412421 // but only return the `location` label. Return the results
413422 // in descending order of timestamp.
414423 var cmMmFilters = new List < string > { "unit=(cm,mm)" } ;
415424 var locationLabels = new List < string > { "location" } ;
416- var res31 = db . TS ( ) . MRevRange ( 1 , 3 , cmMmFilters , selectLabels : locationLabels ) ;
425+ IReadOnlyList <
426+ ( string , IReadOnlyList < TimeSeriesLabel > , IReadOnlyList < TimeSeriesTuple > )
427+ > res31 = db . TS ( ) . MRevRange (
428+ 1 , 3 , cmMmFilters , selectLabels : locationLabels
429+ ) ;
417430 Console . WriteLine ( res31 . Count ) ; // >>> 2
418431
419432 foreach ( var ( key , labels_result , values ) in res31 )
420433 {
421434 var locationLabel = labels_result . FirstOrDefault ( l => l . Key == "location" ) ;
422- Console . WriteLine ( $ "{ key } (location: { locationLabel ? . Value } ): { values . Count } data points") ;
435+ Console . WriteLine ( $ "{ key } (location: { locationLabel ? . Value } )") ;
436+ Console . WriteLine ( $ " Values: [{ string . Join ( ", " , values . Select ( t => $ "({ t . Time . Value } , { t . Val } )") ) } ]") ;
423437 }
424- // >>> rg:4 (location: uk): 3 data points
425- // >>> rg:2 (location: us): 3 data points
438+ // >>> rg:4 (location: uk)
439+ // >>> Values: [(3, 19), (2, 21), (1, 23)]
440+ // >>> rg:2 (location: us)
441+ // >>> Values: [(3, 2.3), (2, 2.1), (1, 1.8)]
426442 // STEP_END
427443 // REMOVE_START
428444 Assert . True ( res20 ) ;
@@ -582,7 +598,9 @@ public void run()
582598 // The result pairs contain the timestamp and the maximum sample value
583599 // for the country at that timestamp.
584600 var countryFilters = new List < string > { "country=(us,uk)" } ;
585- var res44 = db . TS ( ) . MRange (
601+ IReadOnlyList <
602+ ( string , IReadOnlyList < TimeSeriesLabel > , IReadOnlyList < TimeSeriesTuple > )
603+ > res44 = db . TS ( ) . MRange (
586604 "-" , "+" ,
587605 countryFilters ,
588606 groupbyTuple : ( "country" , TsReduce . Max )
@@ -591,14 +609,19 @@ public void run()
591609
592610 foreach ( var ( key , labels_result , values ) in res44 )
593611 {
594- Console . WriteLine ( $ "{ key } : ({ string . Join ( ", " , labels_result . Select ( l => $ "{ l . Key } ={ l . Value } ") ) } ) { values . Count } data points") ;
612+ Console . WriteLine ( $ "{ key } :") ;
613+ Console . WriteLine ( $ " Values: [{ string . Join ( ", " , values . Select ( t => $ "({ t . Time . Value } , { t . Val } )") ) } ]") ;
595614 }
596- // >>> wind:1: (country=uk) 3 data points
597- // >>> wind:3: (country=us) 3 data points
615+ // >>> country=uk
616+ // >>> Values: [(1, 18), (2, 21), (3, 24)]
617+ // >>> country=us
618+ // >>> Values: [(1, 20), (2, 25), (3, 18)]
598619
599620 // The result pairs contain the timestamp and the average sample value
600621 // for the country at that timestamp.
601- var res45 = db . TS ( ) . MRange (
622+ IReadOnlyList <
623+ ( string , IReadOnlyList < TimeSeriesLabel > , IReadOnlyList < TimeSeriesTuple > )
624+ > res45 = db . TS ( ) . MRange (
602625 "-" , "+" ,
603626 countryFilters ,
604627 groupbyTuple : ( "country" , TsReduce . Avg )
@@ -607,10 +630,13 @@ public void run()
607630
608631 foreach ( var ( key , labels_result , values ) in res45 )
609632 {
610- Console . WriteLine ( $ "{ key } : ({ string . Join ( ", " , labels_result . Select ( l => $ "{ l . Key } ={ l . Value } ") ) } ) { values . Count } data points") ;
633+ Console . WriteLine ( $ "{ key } :") ;
634+ Console . WriteLine ( $ " Values: [{ string . Join ( ", " , values . Select ( t => $ "({ t . Time . Value } , { t . Val } )") ) } ]") ;
611635 }
612- // >>> wind:1: (country=uk) 3 data points
613- // >>> wind:3: (country=us) 3 data points
636+ // >>> country=uk
637+ // >>> Values: [(1, 14), (2, 18), (3, 10)]
638+ // >>> country=us
639+ // >>> Values: [(1, 16), (2, 22), (3, 14)]
614640 // STEP_END
615641 // REMOVE_START
616642 Assert . True ( res37 ) ;
0 commit comments