All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.timgent.sparkdataquality.checkssuite.ChecksSuiteResultStatusCalculator.scala Maven / Gradle / Ivy

package com.github.timgent.sparkdataquality.checkssuite

import com.github.timgent.sparkdataquality.checks.{CheckResult, CheckStatus}

object ChecksSuiteResultStatusCalculator {

  /**
    * Gets the worst status of the given checkResults
    * @param checkResults
    * @return
    */
  def getWorstCheckStatus(checkResults: Seq[CheckResult]): CheckSuiteStatus = {
    checkResults.map(_.status).foldLeft[CheckSuiteStatus](CheckSuiteStatus.Success) {
      case (_, CheckStatus.Error)   => return CheckSuiteStatus.Error
      case (_, CheckStatus.Warning) => CheckSuiteStatus.Warning
      case (_, CheckStatus.Success) => CheckSuiteStatus.Success
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy