-
Notifications
You must be signed in to change notification settings - Fork 348
Open
Description
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
- Add the following new test to the unit test
algebird/algebird-test/src/test/scala/com/twitter/algebird/SketchMapTest.scala
after line 57
"plus should work commutatively" in {
implicit val m = Monoid.longMonoid
val valueTableLeft =
DenseMatrix(
PARAMS.width,
PARAMS.depth,
rowsByColumns = IndexedSeq(10L) ++ (1 until PARAMS.width * PARAMS.depth).map(_ => 0L)
)
val testLeft = SketchMap[Int, Long](
valuesTable = valueTableLeft,
heavyHitterKeys = List(1),
totalValue = 10
)
val valueTableRight = SparseColumnMatrix(rowsByColumns =
IndexedSeq(
SparseVector(
map = Map(1 -> 1L),
sparseValue = 1L,
length = PARAMS.width * PARAMS.depth
)
)
)
val testRight = SketchMap[Int, Long](
valuesTable = valueTableRight,
heavyHitterKeys = List(1),
totalValue = 1
)
assert(MONOID.plus(testLeft, testRight) == MONOID.plus(testRight, testLeft))
}
- Run the test and it would fail
Expected behavior
The test is expected to pass
Screenshots
N/A
Environment
N/A
Additional context
This is mainly because the algebird/algebird-core/src/main/scala/com/twitter/algebird/matrix/AdaptiveMatrix.scala
doesn't handle the (SparseColumnMatrix, DenseMatrix) input (in that order) correctly.
Metadata
Metadata
Assignees
Labels
No labels