You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@griffin.apache.org by GitBox <gi...@apache.org> on 2019/09/25 04:05:31 UTC

[GitHub] [griffin] wankunde commented on a change in pull request #538: [GRIFFIN-289]New feature for griffin COMPLETENESS dq type

wankunde commented on a change in pull request #538: [GRIFFIN-289]New feature for griffin COMPLETENESS dq type
URL: https://github.com/apache/griffin/pull/538#discussion_r327923316
 
 

 ##########
 File path: measure/src/main/scala/org/apache/griffin/measure/configuration/dqdefinition/DQConfig.scala
 ##########
 @@ -206,3 +211,23 @@ case class RuleOutputParam( @JsonProperty("type") private val outputType: String
 
   def validate(): Unit = {}
 }
+
+/**
+  * error configuration parameter
+  * @param columnName the name of the column
+  * @param errorType  the way to match error, regex or enumeration
+  * @param values     error value list
+  */
+@JsonInclude(Include.NON_NULL)
+case class RuleErrorConfParam( @JsonProperty("column.name") private val columnName: String,
+                               @JsonProperty("type") private val errorType: String,
+                               @JsonProperty("values") private val values: List[String]
+                             ) extends Param {
+  def getColumnName: Option[String] = if (StringUtils.isNotBlank(columnName)) Some(columnName) else None
+  def getErrorType: Option[String] = if (StringUtils.isNotBlank(errorType)) Some(errorType) else None
+  def getValues: Seq[String] = if (values != null) values else Nil
+
+  def validate(): Unit = {
+    assert("regex".equals(getErrorType.get) || "enumeration".equals(getErrorType.get), "error error.conf type")
 
 Review comment:
   I think `equalsIgnoreCase` is better than `equals` here, just like in `CompletenessExpr2DQSteps.scala`.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services