private boolean tryFilter(final long timestamp, final T value) {
    final long timeDiff = Math.abs(timestamp - lastStoredTimestamp);

    if (timeDiff <= processor.getCompressionMinTimeInterval()) {
      return false;
    }

    if (timeDiff >= processor.getCompressionMaxTimeInterval()) {
      reset(timestamp, value);
      return true;
    }

    // For non-numerical types, we only compare the value
    if (value instanceof Boolean
        || value instanceof String
        || value instanceof Binary
        || value instanceof LocalDate) {
      if (Objects.equals(lastStoredValue, value)) {
        return false;
      }

      reset(timestamp, value);
      return true;
    }

    // For other numerical types, we compare the value difference
    if (Math.abs(
            Double.parseDouble(lastStoredValue.toString()) - Double.parseDouble(value.toString()))
        > processor.getCompressionDeviation()) {
      reset(timestamp, value);
      return true;
    }

    return false;
  }
The last stored time and value we compare current point against lastReadTimestamp and
lastReadValue
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/processor/downsampling/changing/ChangingValueFilter.java