-
Notifications
You must be signed in to change notification settings - Fork 538
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support col match and change to DatasetMatch (#529)
* update col match and other improvements * review comments * review comments
- Loading branch information
1 parent
4cf8ca6
commit 63e80dc
Showing
10 changed files
with
253 additions
and
185 deletions.
There are no files selected for viewing
48 changes: 0 additions & 48 deletions
48
src/main/scala/com/amazon/deequ/analyzers/DataSynchronizationState.scala
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/scala/com/amazon/deequ/analyzers/DatasetMatchState.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). You may not | ||
* use this file except in compliance with the License. A copy of the License | ||
* is located at | ||
* | ||
* http://aws.amazon.com/apache2.0/ | ||
* | ||
* or in the "license" file accompanying this file. This file 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 com.amazon.deequ.analyzers | ||
|
||
/** | ||
* Represents the state of datasetMatch between two DataFrames in Deequ. | ||
* This state keeps track of the count of matched record count and the total record count. | ||
* It measures how well the data in the two DataFrames matches. | ||
* | ||
* @param matchedDataCount The count of records that are considered match between the two DataFrames. | ||
* @param totalDataCount The total count of records for check. | ||
* | ||
* The `sum` method allows for aggregation of this state with another, combining the counts from both states. | ||
* This is useful in distributed computations where states from different partitions need to be aggregated. | ||
* | ||
* The `metricValue` method computes the synchronization ratio. It is the ratio of `matchedDataCount` to `dataCount`. | ||
* If `dataCount` is zero, which means no data points were examined, the method returns `Double.NaN` to indicate | ||
* the undefined state. | ||
* | ||
*/ | ||
case class DatasetMatchState(matchedDataCount: Long, totalDataCount: Long) | ||
extends DoubleValuedState[DatasetMatchState] { | ||
override def sum(other: DatasetMatchState): DatasetMatchState = { | ||
DatasetMatchState(matchedDataCount + other.matchedDataCount, totalDataCount + other.totalDataCount) | ||
} | ||
|
||
override def metricValue(): Double = { | ||
if (totalDataCount == 0L) Double.NaN else matchedDataCount.toDouble / totalDataCount.toDouble | ||
} | ||
} | ||
|
||
object DatasetMatchState |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.