override def persist[S <: State[_]]()

in src/main/scala/com/amazon/deequ/analyzers/StateProvider.scala [86:141]


  override def persist[S <: State[_]](analyzer: Analyzer[S, _], state: S): Unit = {

    val identifier = toIdentifier(analyzer)

    analyzer match {
      case _: Size =>
        persistLongState(state.asInstanceOf[NumMatches].numMatches, identifier)

      case _ : Completeness | _ : Compliance | _ : PatternMatch =>
        persistLongLongState(state.asInstanceOf[NumMatchesAndCount], identifier)

      case _: Sum =>
        persistDoubleState(state.asInstanceOf[SumState].sum, identifier)

      case _: Mean =>
        persistDoubleLongState(state.asInstanceOf[MeanState], identifier)

      case _: Minimum =>
        persistDoubleState(state.asInstanceOf[MinState].minValue, identifier)

      case _: Maximum =>
        persistDoubleState(state.asInstanceOf[MaxState].maxValue, identifier)

      case _: MaxLength =>
        persistDoubleState(state.asInstanceOf[MaxState].maxValue, identifier)

      case _: MinLength =>
        persistDoubleState(state.asInstanceOf[MinState].minValue, identifier)

      case _ : FrequencyBasedAnalyzer | _ : Histogram =>
        persistDataframeLongState(state.asInstanceOf[FrequenciesAndNumRows], identifier)

      case _: DataType =>
        val histogram = state.asInstanceOf[DataTypeHistogram]
        persistBytes(DataTypeHistogram.toBytes(histogram.numNull, histogram.numFractional,
          histogram.numIntegral, histogram.numBoolean, histogram.numString), identifier)

      case _: ApproxCountDistinct =>
        val counters = state.asInstanceOf[ApproxCountDistinctState]
        persistBytes(DeequHyperLogLogPlusPlusUtils.wordsToBytes(counters.words), identifier)

      case _ : Correlation =>
        persistCorrelationState(state.asInstanceOf[CorrelationState], identifier)

      case _ : StandardDeviation =>
        persistStandardDeviationState(state.asInstanceOf[StandardDeviationState], identifier)

      case _: ApproxQuantile =>
        val percentileDigest = state.asInstanceOf[ApproxQuantileState].percentileDigest
        val serializedDigest = ApproximatePercentile.serializer.serialize(percentileDigest)
        persistBytes(serializedDigest, identifier)

      case _ =>
        throw new IllegalArgumentException(s"Unable to persist state for analyzer $analyzer.")
    }
  }