File tree Expand file tree Collapse file tree 3 files changed +30
-9
lines changed
main/scala/com/mapr/db/spark/types
test/scala/com/mapr/db/spark/types Expand file tree Collapse file tree 3 files changed +30
-9
lines changed Original file line number Diff line number Diff line change 26
26
<version >${project.version} </version >
27
27
<scope >provided</scope >
28
28
</dependency >
29
+ <dependency >
30
+ <groupId >org.apache.spark</groupId >
31
+ <artifactId >spark-core_${scala.binary.version}</artifactId >
32
+ <version >${project.version} </version >
33
+ <type >test-jar</type >
34
+ <scope >test</scope >
35
+ </dependency >
29
36
<dependency >
30
37
<groupId >org.apache.spark</groupId >
31
38
<artifactId >spark-streaming_${scala.binary.version}</artifactId >
Original file line number Diff line number Diff line change @@ -67,14 +67,12 @@ private[spark] final class DBMapValue(
67
67
override def hashCode (): Int = this .keySet.size
68
68
69
69
override def equals (other : Any ): Boolean = {
70
- if (other.isInstanceOf [DBMapValue ]) {
71
- val that : DBMapValue = other.asInstanceOf [DBMapValue ]
72
- this == that
73
- } else if (other.isInstanceOf [Map [_, _]]) {
74
- val that : DBMapValue = new DBMapValue (
75
- other.asInstanceOf [Map [String , AnyRef ]])
76
- this .getMap == that
77
- } else false
78
-
70
+ other match {
71
+ case _ : Map [_, _] =>
72
+ val that : DBMapValue = new DBMapValue (
73
+ other.asInstanceOf [Map [String , AnyRef ]])
74
+ this .getMap == that
75
+ case _ => false
76
+ }
79
77
}
80
78
}
Original file line number Diff line number Diff line change
1
+ /* Copyright (c) 2015 & onwards. MapR Tech, Inc., All rights reserved */
2
+ package com .mapr .db .spark .types
3
+
4
+ import org .apache .spark .SparkFunSuite
5
+
6
+ class DBMapValueTest extends SparkFunSuite {
7
+ test(" Check DBMapValue equals method" ) {
8
+ val map = Map (" 1" -> " 2" , " a" -> " b" )
9
+ val dbMapValue = new DBMapValue (map)
10
+ val dbMapValueOther = new DBMapValue (map)
11
+
12
+ assert(! dbMapValue.equals(" StringType" ))
13
+ assert(dbMapValue.equals(map))
14
+ assert(dbMapValue.equals(dbMapValueOther))
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments