@ Nullable private < S > S runComputeStatistics ( GraqlCompute . Statistics . Value query ) { AttributeType . DataType < ? > targetDataType = validateAndGetTargetDataType ( query ) ; if ( ! targetContainsInstance ( query ) ) return null ; Set < LabelId > extendedScopeTypes = convertLabelsToIds ( extendedScopeTypeLabels ( query ) ) ; Set < LabelId > targetTypes = convertLabelsToIds ( targetTypeLabels ( query ) ) ; VertexProgram program = initStatisticsVertexProgram ( query , targetTypes , targetDataType ) ; StatisticsMapReduce < ? > mapReduce = initStatisticsMapReduce ( query , targetTypes , targetDataType ) ; ComputerResult computerResult = compute ( program , mapReduce , extendedScopeTypes ) ; if ( query . method ( ) . equals ( MEDIAN ) ) { Number result = computerResult . memory ( ) . get ( MedianVertexProgram . MEDIAN ) ; LOG . debug ( "Median = {}" , result ) ; return ( S ) result ; } Map < Serializable , S > resultMap = computerResult . memory ( ) . get ( mapReduce . getClass ( ) . getName ( ) ) ; LOG . debug ( "Result = {}" , resultMap . get ( MapReduce . NullObject . instance ( ) ) ) ; return resultMap . get ( MapReduce . NullObject . instance ( ) ) ; }
The compute statistics base algorithm that is called in every compute statistics query