public void insert(Row row) throws UDFInputSeriesDataTypeNotValidException, IOException {
    switch (dataType) {
      case INT32:
        intArrayList.add(row.getInt(0));
        break;
      case INT64:
        longArrayList.add(row.getLong(0));
        break;
      case FLOAT:
        float vf = row.getFloat(0);
        if (Float.isFinite(vf)) {
          floatArrayList.add(vf);
        }
        break;
      case DOUBLE:
        double vd = row.getDouble(0);
        if (Double.isFinite(vd)) {
          doubleArrayList.add(vd);
        }
        break;
      case DATE:
      case TIMESTAMP:
      case BLOB:
      case BOOLEAN:
      case TEXT:
      case STRING:
      default:
        // This will not happen.
        throw new UDFInputSeriesDataTypeNotValidException(
            0, dataType, Type.INT32, Type.INT64, Type.FLOAT, Type.DOUBLE);
    }
  }
Util for computing median, MAD, percentile.
library-udf/src/main/java/org/apache/iotdb/library/dprofile/util/ExactOrderStatistics.java