Repository: incubator-griffin
Updated Branches:
  refs/heads/master ed5ac8730 -> 5b0a58fd1


rename field name

Author: William Guo <gu...@apache.org>

Closes #295 from guoyuepeng/2018_06_11_refactor_measure.


Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/5b0a58fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/5b0a58fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/5b0a58fd

Branch: refs/heads/master
Commit: 5b0a58fd13318b69eb909df33e24031869937b0d
Parents: ed5ac87
Author: William Guo <gu...@apache.org>
Authored: Tue Jun 12 15:24:14 2018 +0800
Committer: Lionel Liu <bhlx3l...@163.com>
Committed: Tue Jun 12 15:24:14 2018 +0800

----------------------------------------------------------------------
 .../measure/configuration/enums/DqType.scala    | 20 ++++++++++----------
 .../measure/configuration/enums/DslType.scala   | 10 +++++-----
 .../configuration/enums/NormalizeType.scala     | 12 ++++++------
 .../configuration/enums/ProcessType.scala       |  8 ++++----
 4 files changed, 25 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/5b0a58fd/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DqType.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DqType.scala
 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DqType.scala
index d1e19ef..cee8d98 100644
--- 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DqType.scala
+++ 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DqType.scala
@@ -25,7 +25,7 @@ import scala.util.matching.Regex
   * indicates the dq type of griffin pre-defined measurements
   */
 sealed trait DqType {
-  val regex: Regex
+  val idPattern: Regex
   val desc: String
 }
 
@@ -34,8 +34,8 @@ object DqType {
     AccuracyType, ProfilingType, UniquenessType, DistinctnessType, 
TimelinessType, CompletenessType, UnknownType
   )
   def apply(ptn: String): DqType = {
-    dqTypes.find(tp => ptn match {
-      case tp.regex() => true
+    dqTypes.find(dqType => ptn match {
+      case dqType.idPattern() => true
       case _ => false
     }).getOrElse(UnknownType)
   }
@@ -50,7 +50,7 @@ object DqType {
   *       accuracy is 80%.
   */
  case object AccuracyType extends DqType {
-  val regex = "^(?i)accuracy$".r
+  val idPattern = "^(?i)accuracy$".r
   val desc = "accuracy"
 }
 
@@ -59,7 +59,7 @@ object DqType {
   * e.g.: max, min, average, group by count, ...
   */
  case object ProfilingType extends DqType {
-  val regex = "^(?i)profiling$".r
+  val idPattern = "^(?i)profiling$".r
   val desc = "profiling"
 }
 
@@ -70,7 +70,7 @@ object DqType {
   * uniqueness indicates the items without any replica of data
   */
  case object UniquenessType extends DqType {
-  val regex = "^(?i)uniqueness|duplicate$".r
+  val idPattern = "^(?i)uniqueness|duplicate$".r
   val desc = "uniqueness"
 }
 
@@ -82,7 +82,7 @@ object DqType {
   * comparing with uniqueness, distinctness is more meaningful
   */
  case object DistinctnessType extends DqType {
-  val regex = "^(?i)distinct$".r
+  val idPattern = "^(?i)distinct$".r
   val desc = "distinct"
 }
 
@@ -93,7 +93,7 @@ object DqType {
   * even more, it can record the items with latency above threshold you 
configured
   */
  case object TimelinessType extends DqType {
-  val regex = "^(?i)timeliness$".r
+  val idPattern = "^(?i)timeliness$".r
   val desc = "timeliness"
 }
 
@@ -102,11 +102,11 @@ object DqType {
   * the columns you measure is incomplete if it is null
   */
  case object CompletenessType extends DqType {
-  val regex = "^(?i)completeness$".r
+  val idPattern = "^(?i)completeness$".r
   val desc = "completeness"
 }
 
  case object UnknownType extends DqType {
-  val regex = "".r
+  val idPattern = "".r
   val desc = "unknown"
 }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/5b0a58fd/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DslType.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DslType.scala
 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DslType.scala
index d65c316..c9a1172 100644
--- 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DslType.scala
+++ 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/DslType.scala
@@ -24,7 +24,7 @@ import scala.util.matching.Regex
   * dsl type indicates the language type of rule param
   */
 sealed trait DslType {
-  val regex: Regex
+  val idPattern: Regex
   val desc: String
 }
 
@@ -32,7 +32,7 @@ object DslType {
   private val dslTypes: List[DslType] = List(SparkSqlType, GriffinDslType, 
DataFrameOpsType)
   def apply(ptn: String): DslType = {
     dslTypes.find(tp => ptn match {
-      case tp.regex() => true
+      case tp.idPattern() => true
       case _ => false
     }).getOrElse(GriffinDslType)
   }
@@ -43,7 +43,7 @@ object DslType {
   * spark-sql: rule defined in "SPARK-SQL" directly
   */
  case object SparkSqlType extends DslType {
-  val regex = "^(?i)spark-?sql$".r
+  val idPattern = "^(?i)spark-?sql$".r
   val desc = "spark-sql"
 }
 
@@ -51,7 +51,7 @@ object DslType {
   * df-ops: data frame operations rule, support some pre-defined data frame ops
   */
  case object DataFrameOpsType extends DslType {
-  val regex = "^(?i)df-?(?:op|opr|ops)$".r
+  val idPattern = "^(?i)df-?(?:op|opr|ops)$".r
   val desc = "df-opr"
 }
 
@@ -59,6 +59,6 @@ object DslType {
   * griffin-dsl: griffin dsl rule, to define dq measurements easier
   */
  case object GriffinDslType extends DslType {
-  val regex = "^(?i)griffin-?dsl$".r
+  val idPattern = "^(?i)griffin-?dsl$".r
   val desc = "griffin-dsl"
 }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/5b0a58fd/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/NormalizeType.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/NormalizeType.scala
 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/NormalizeType.scala
index df86fac..b353cbc 100644
--- 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/NormalizeType.scala
+++ 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/NormalizeType.scala
@@ -24,7 +24,7 @@ import scala.util.matching.Regex
   * the normalize strategy to collect metric
   */
 sealed trait NormalizeType {
-  val regex: Regex
+  val idPattern: Regex
   val desc: String
 }
 
@@ -32,7 +32,7 @@ object NormalizeType {
   private val normalizeTypes: List[NormalizeType] = List(DefaultNormalizeType, 
EntriesNormalizeType, ArrayNormalizeType, MapNormalizeType)
   def apply(ptn: String): NormalizeType = {
     normalizeTypes.find(tp => ptn match {
-      case tp.regex() => true
+      case tp.idPattern() => true
       case _ => false
     }).getOrElse(DefaultNormalizeType)
   }
@@ -48,7 +48,7 @@ object NormalizeType {
   * all rows
   */
  case object DefaultNormalizeType extends NormalizeType {
-  val regex: Regex = "".r
+  val idPattern: Regex = "".r
   val desc: String = "default"
 }
 
@@ -59,7 +59,7 @@ object NormalizeType {
   * the first row only
   */
  case object EntriesNormalizeType extends NormalizeType {
-  val regex: Regex = "^(?i)entries$".r
+  val idPattern: Regex = "^(?i)entries$".r
   val desc: String = "entries"
 }
 
@@ -70,7 +70,7 @@ object NormalizeType {
   * all rows
   */
  case object ArrayNormalizeType extends NormalizeType {
-  val regex: Regex = "^(?i)array|list$".r
+  val idPattern: Regex = "^(?i)array|list$".r
   val desc: String = "array"
 }
 
@@ -81,6 +81,6 @@ object NormalizeType {
   * the first row only
   */
  case object MapNormalizeType extends NormalizeType {
-  val regex: Regex = "^(?i)map$".r
+  val idPattern: Regex = "^(?i)map$".r
   val desc: String = "map"
 }

http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/5b0a58fd/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/ProcessType.scala
----------------------------------------------------------------------
diff --git 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/ProcessType.scala
 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/ProcessType.scala
index 4bec659..4f799ed 100644
--- 
a/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/ProcessType.scala
+++ 
b/measure/src/main/scala/org/apache/griffin/measure/configuration/enums/ProcessType.scala
@@ -24,7 +24,7 @@ import scala.util.matching.Regex
   * process type enum
   */
 sealed trait ProcessType {
-  val regex: Regex
+  val idPattern: Regex
   val desc: String
 }
 
@@ -32,7 +32,7 @@ object ProcessType {
   private val procTypes: List[ProcessType] = List(BatchProcessType, 
StreamingProcessType)
   def apply(ptn: String): ProcessType = {
     procTypes.find(tp => ptn match {
-      case tp.regex() => true
+      case tp.idPattern() => true
       case _ => false
     }).getOrElse(BatchProcessType)
   }
@@ -43,7 +43,7 @@ object ProcessType {
   * process in batch mode
   */
  case object BatchProcessType extends ProcessType {
-  val regex = """^(?i)batch$""".r
+  val idPattern = """^(?i)batch$""".r
   val desc = "batch"
 }
 
@@ -51,6 +51,6 @@ object ProcessType {
   * process in streaming mode
   */
  case object StreamingProcessType extends ProcessType {
-  val regex = """^(?i)streaming$""".r
+  val idPattern = """^(?i)streaming$""".r
   val desc = "streaming"
 }

Reply via email to