tusharpatil20 commented on a change in pull request #558: [WIP] Enum based
configs
URL: https://github.com/apache/griffin/pull/558#discussion_r355832991
##########
File path:
measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DqType.scala
##########
@@ -18,101 +18,48 @@ under the License.
*/
package org.apache.griffin.measure.configuration.enums
-import scala.util.matching.Regex
-
-/**
- * effective when dsl type is "griffin-dsl",
- * indicates the dq type of griffin pre-defined measurements
- */
-sealed trait DqType {
- val idPattern: Regex
- val desc: String
-}
-
-object DqType {
- private val dqTypes: List[DqType] = List(
- AccuracyType,
- ProfilingType,
- UniquenessType,
- DistinctnessType,
- TimelinessType,
- CompletenessType,
- UnknownType
- )
- def apply(ptn: String): DqType = {
- dqTypes.find(dqType => ptn match {
- case dqType.idPattern() => true
- case _ => false
- }).getOrElse(UnknownType)
- }
- def unapply(pt: DqType): Option[String] = Some(pt.desc)
-}
-
-/**
- * accuracy: the match percentage of items between source and target
- * count(source items matched with the ones from target) / count(source)
- * e.g.: source [1, 2, 3, 4, 5], target: [1, 2, 3, 4]
- * metric will be: { "total": 5, "miss": 1, "matched": 4 }
- * accuracy is 80%.
- */
- case object AccuracyType extends DqType {
- val idPattern = "^(?i)accuracy$".r
- val desc = "accuracy"
-}
+import org.apache.griffin.measure.configuration.enums
-/**
- * profiling: the statistic data of data source
- * e.g.: max, min, average, group by count, ...
- */
- case object ProfilingType extends DqType {
- val idPattern = "^(?i)profiling$".r
- val desc = "profiling"
-}
-
-/**
- * uniqueness: the uniqueness of data source comparing with itself
- * count(unique items in source) / count(source)
- * e.g.: [1, 2, 3, 3] -> { "unique": 2, "total": 4, "dup-arr": [ "dup": 1,
"num": 1 ] }
- * uniqueness indicates the items without any replica of data
- */
- case object UniquenessType extends DqType {
- val idPattern = "^(?i)uniqueness|duplicate$".r
- val desc = "uniqueness"
-}
+import scala.util.matching.Regex
Review comment:
Made the changes and committed, you can refer this comment
2cd0b5d3d6bc6def5a7cac0092b69b95832df9b1. Please review.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services