[GRIFFIN-358] Fixed formatting
diff --git a/measure/src/main/scala/org/apache/griffin/measure/execution/Measure.scala b/measure/src/main/scala/org/apache/griffin/measure/execution/Measure.scala
index c387aaa..dbdd81c 100644
--- a/measure/src/main/scala/org/apache/griffin/measure/execution/Measure.scala
+++ b/measure/src/main/scala/org/apache/griffin/measure/execution/Measure.scala
@@ -23,10 +23,10 @@
import org.apache.spark.sql.{Column, DataFrame, SparkSession}
import org.apache.spark.sql.functions._
-import org.apache.griffin.measure.configuration.dqdefinition.MeasureParam
-import org.apache.griffin.measure.utils.ParamUtil._
import org.apache.griffin.measure.Loggable
+import org.apache.griffin.measure.configuration.dqdefinition.MeasureParam
import org.apache.griffin.measure.context.DQContext
+import org.apache.griffin.measure.utils.ParamUtil._
trait Measure extends Loggable {
import Measure._
@@ -34,6 +34,7 @@
val measureParam: MeasureParam
val supportsRecordWrite: Boolean
+
val supportsMetricWrite: Boolean
final val valueColumn = s"${MeasureColPrefix}_${measureParam.getName}"
diff --git a/measure/src/main/scala/org/apache/griffin/measure/execution/MeasureExecutor.scala b/measure/src/main/scala/org/apache/griffin/measure/execution/MeasureExecutor.scala
index f5d939a..ab51a7a 100644
--- a/measure/src/main/scala/org/apache/griffin/measure/execution/MeasureExecutor.scala
+++ b/measure/src/main/scala/org/apache/griffin/measure/execution/MeasureExecutor.scala
@@ -19,8 +19,8 @@
import org.apache.spark.sql.DataFrame
-import org.apache.griffin.measure.configuration.dqdefinition.MeasureParam
import org.apache.griffin.measure.Loggable
+import org.apache.griffin.measure.configuration.dqdefinition.MeasureParam
import org.apache.griffin.measure.configuration.enums.{MeasureTypes, OutputType}
import org.apache.griffin.measure.context.DQContext
import org.apache.griffin.measure.execution.impl._
diff --git a/measure/src/main/scala/org/apache/griffin/measure/execution/impl/ProfilingMeasure.scala b/measure/src/main/scala/org/apache/griffin/measure/execution/impl/ProfilingMeasure.scala
index 61ee948..f04e50d 100644
--- a/measure/src/main/scala/org/apache/griffin/measure/execution/impl/ProfilingMeasure.scala
+++ b/measure/src/main/scala/org/apache/griffin/measure/execution/impl/ProfilingMeasure.scala
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.griffin.measure.execution.impl
import java.util.Locale
@@ -78,13 +95,13 @@
/**
* Options Keys
*/
- final val RoundScaleStr: String = "round.scale"
- final val ApproxDistinctCountStr: String = "approx.distinct.count"
+ final val RoundScaleStr: String = "round.scale"
+ final val ApproxDistinctCountStr: String = "approx.distinct.count"
/**
* Structure Keys
*/
- final val ColumnDetails: String = "column_details"
+ final val ColumnDetails: String = "column_details"
private final val DataTypeStr: String = "data_type"
/**
@@ -129,11 +146,13 @@
val lengthColExpr = col(lengthColFn(colName))
val nullColExpr = col(nullsInColFn(colName))
val (distinctCountName, distinctCountExpr) =
- if (approxDistinctCount)
+ if (approxDistinctCount) {
(
lit(s"$ApproxPrefix$DistinctCount"),
approx_count_distinct(column).as(s"$ApproxPrefix$DistinctCount"))
- else (lit(DistinctCount), countDistinct(column).as(DistinctCount))
+ } else {
+ (lit(DistinctCount), countDistinct(column).as(DistinctCount))
+ }
Seq(
Seq(lit(DataTypeStr), lit(colType.catalogString).as(DataTypeStr)),
diff --git a/measure/src/main/scala/org/apache/griffin/measure/execution/impl/SparkSQLMeasure.scala b/measure/src/main/scala/org/apache/griffin/measure/execution/impl/SparkSQLMeasure.scala
index b32aa42..851cb01 100644
--- a/measure/src/main/scala/org/apache/griffin/measure/execution/impl/SparkSQLMeasure.scala
+++ b/measure/src/main/scala/org/apache/griffin/measure/execution/impl/SparkSQLMeasure.scala
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.griffin.measure.execution.impl
import io.netty.util.internal.StringUtil
diff --git a/measure/src/test/scala/org/apache/griffin/measure/execution/impl/AccuracyMeasureTest.scala b/measure/src/test/scala/org/apache/griffin/measure/execution/impl/AccuracyMeasureTest.scala
index be596e3..fbbfc1b 100644
--- a/measure/src/test/scala/org/apache/griffin/measure/execution/impl/AccuracyMeasureTest.scala
+++ b/measure/src/test/scala/org/apache/griffin/measure/execution/impl/AccuracyMeasureTest.scala
@@ -75,33 +75,15 @@
// Invalid Expr as target.col is missing
assertThrows[AssertionError] {
AccuracyMeasure(
- param.copy(
- config = Map(Expression -> Seq(Map(SourceColStr -> "b")), TargetSourceStr -> "target")))
+ param.copy(config =
+ Map(Expression -> Seq(Map(SourceColStr -> "b")), TargetSourceStr -> "target")))
}
// Invalid Expr as source.col is missing
assertThrows[AssertionError] {
AccuracyMeasure(
- param.copy(
- config = Map(Expression -> Seq(Map(TargetColStr -> "b")), TargetSourceStr -> "target")))
- }
-
- // Invalid Expr as provided source.col is invalid
- assertThrows[AssertionError] {
- AccuracyMeasure(
- param.copy(
- config = Map(
- Expression -> Seq(Map(SourceColStr -> "b", TargetColStr -> "b")),
- TargetSourceStr -> "target")))
- }
-
- // Invalid Expr as provided target.col is invalid
- assertThrows[AssertionError] {
- AccuracyMeasure(
- param.copy(
- config = Map(
- Expression -> Seq(Map(SourceColStr -> "gender", TargetColStr -> "b")),
- TargetSourceStr -> "target")))
+ param.copy(config =
+ Map(Expression -> Seq(Map(TargetColStr -> "b")), TargetSourceStr -> "target")))
}
// Validations for Target source
@@ -109,8 +91,8 @@
// Empty
assertThrows[AssertionError] {
AccuracyMeasure(
- param.copy(
- config = Map(Expression -> Seq(Map("a" -> "b")), TargetSourceStr -> StringUtils.EMPTY)))
+ param.copy(config =
+ Map(Expression -> Seq(Map("a" -> "b")), TargetSourceStr -> StringUtils.EMPTY)))
}
// Incorrect Type
diff --git a/measure/src/test/scala/org/apache/griffin/measure/execution/impl/DuplicationMeasureTest.scala b/measure/src/test/scala/org/apache/griffin/measure/execution/impl/DuplicationMeasureTest.scala
index 7fed3d9..b3c2c4f 100644
--- a/measure/src/test/scala/org/apache/griffin/measure/execution/impl/DuplicationMeasureTest.scala
+++ b/measure/src/test/scala/org/apache/griffin/measure/execution/impl/DuplicationMeasureTest.scala
@@ -67,17 +67,20 @@
// Empty
assertThrows[AssertionError] {
- DuplicationMeasure(param.copy(config = Map(Expression -> "name", BadRecordDefinition -> "")))
+ DuplicationMeasure(
+ param.copy(config = Map(Expression -> "name", BadRecordDefinition -> "")))
}
// Null
assertThrows[AssertionError] {
- DuplicationMeasure(param.copy(config = Map(Expression -> "name", BadRecordDefinition -> null)))
+ DuplicationMeasure(
+ param.copy(config = Map(Expression -> "name", BadRecordDefinition -> null)))
}
// Incorrect Type
assertThrows[AssertionError] {
- DuplicationMeasure(param.copy(config = Map(Expression -> "name", BadRecordDefinition -> 435)))
+ DuplicationMeasure(
+ param.copy(config = Map(Expression -> "name", BadRecordDefinition -> 435)))
}
// Incorrect Value
@@ -113,7 +116,6 @@
assertResult(param.getType.toString)(row.getAs[String](MeasureType))
val metricMap = row.getAs[Map[String, String]](Metrics)
- println(metricMap)
assertResult(metricMap(Duplicate))("0")
assertResult(metricMap(Unique))("5")
assertResult(metricMap(NonUnique))("0")
diff --git a/measure/src/test/scala/org/apache/griffin/measure/execution/impl/SparkSqlMeasureTest.scala b/measure/src/test/scala/org/apache/griffin/measure/execution/impl/SparkSqlMeasureTest.scala
index eed4b46..31f73e7 100644
--- a/measure/src/test/scala/org/apache/griffin/measure/execution/impl/SparkSqlMeasureTest.scala
+++ b/measure/src/test/scala/org/apache/griffin/measure/execution/impl/SparkSqlMeasureTest.scala
@@ -66,8 +66,8 @@
// Empty
assertThrows[AssertionError] {
SparkSQLMeasure(
- param.copy(
- config = Map(Expression -> "select 1", BadRecordDefinition -> StringUtils.EMPTY)))
+ param.copy(config =
+ Map(Expression -> "select 1", BadRecordDefinition -> StringUtils.EMPTY)))
}
// Incorrect Type
@@ -117,8 +117,8 @@
it should "throw runtime error for invalid expr" in {
assertThrows[AssertionError] {
SparkSQLMeasure(
- param.copy(
- config = Map(Expression -> "select * from source", BadRecordDefinition -> "name")))
+ param.copy(config =
+ Map(Expression -> "select * from source", BadRecordDefinition -> "name")))
.execute(context)
}