@@ -554,6 +554,11 @@ jsonStatsConvertArray(Datum jsonbValueArray, JsonStatType type, Oid typid,
554
554
break ;
555
555
556
556
case JsonStatNumeric :
557
+ Assert (jbv .type == jbvNumeric );
558
+ value = NumericGetDatum (jbv .val .numeric );
559
+ break ;
560
+
561
+ case JsonStatFloat4 :
557
562
Assert (jbv .type == jbvNumeric );
558
563
value = DirectFunctionCall1 (numeric_float4 ,
559
564
NumericGetDatum (jbv .val .numeric ));
@@ -638,6 +643,7 @@ jsonPathStatsExtractData(JsonPathStats pstats, JsonStatType stattype,
638
643
eqop = NumericEqOperator ;
639
644
ltop = NumericLtOperator ;
640
645
break ;
646
+ case JsonStatFloat4 : /* special internal stats type */
641
647
default :
642
648
elog (ERROR , "invalid json statistic type %d" , stattype );
643
649
break ;
@@ -666,7 +672,7 @@ jsonPathStatsExtractData(JsonPathStats pstats, JsonStatType stattype,
666
672
slot -> kind = STATISTIC_KIND_MCV ;
667
673
slot -> opid = eqop ;
668
674
slot -> numbers = jsonStatsConvertArray (jsonGetField (mcv , "numbers" ),
669
- JsonStatNumeric , FLOAT4OID ,
675
+ JsonStatFloat4 , FLOAT4OID ,
670
676
1.0 - nullfrac );
671
677
slot -> values = jsonStatsConvertArray (jsonGetField (mcv , "values" ),
672
678
stattype , type , 0 );
@@ -678,7 +684,7 @@ jsonPathStatsExtractData(JsonPathStats pstats, JsonStatType stattype,
678
684
slot -> kind = STATISTIC_KIND_HISTOGRAM ;
679
685
slot -> opid = ltop ;
680
686
slot -> numbers = jsonStatsConvertArray (jsonGetField (hst , "numbers" ),
681
- JsonStatNumeric , FLOAT4OID , 1.0 );
687
+ JsonStatFloat4 , FLOAT4OID , 1.0 );
682
688
slot -> values = jsonStatsConvertArray (jsonGetField (hst , "values" ),
683
689
stattype , type , 0 );
684
690
slot ++ ;
0 commit comments