MySQL user defined function that calculates hi and low value in a numeric JSON array