Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ abstract class RowBasedChecksum() extends Serializable with Logging {
object RowBasedChecksum {
def getAggregatedChecksumValue(rowBasedChecksums: Array[RowBasedChecksum]): Long = {
Option(rowBasedChecksums)
.map(_.foldLeft(0L)((acc, c) => acc * 31L + c.getValue))
.map(_.foldLeft(0L)((acc, c) => (acc * 31L + c.getValue) & Long.MaxValue))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does & Long.MaxValue help here? The current code is kind of very common and many hash code are also calculated like this.

.getOrElse(0L)
}
}