Skip to content

Commit 831504c

Browse files
cloud-fanrxin
authored andcommitted
[DataFrame][minor] cleanup unapply methods in DataTypes
Author: Wenchen Fan <[email protected]> Closes #6079 from cloud-fan/unapply and squashes the following commits: 40da442 [Wenchen Fan] one more 7d90a05 [Wenchen Fan] cleanup unapply in DataTypes
1 parent d86ce84 commit 831504c

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/types/DataType.scala

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ abstract class DataType {
4747
* ...
4848
* }}}
4949
*/
50-
private[sql] def unapply(a: Expression): Boolean = a match {
51-
case e: Expression if e.dataType == this => true
52-
case _ => false
53-
}
50+
private[sql] def unapply(e: Expression): Boolean = e.dataType == this
5451

5552
/**
5653
* The default size of a value of this data type, used internally for size estimation.
@@ -137,10 +134,7 @@ private[sql] object IntegralType {
137134
* ...
138135
* }}}
139136
*/
140-
def unapply(a: Expression): Boolean = a match {
141-
case e: Expression if e.dataType.isInstanceOf[IntegralType] => true
142-
case _ => false
143-
}
137+
def unapply(e: Expression): Boolean = e.dataType.isInstanceOf[IntegralType]
144138
}
145139

146140

@@ -157,10 +151,7 @@ private[sql] object FractionalType {
157151
* ...
158152
* }}}
159153
*/
160-
def unapply(a: Expression): Boolean = a match {
161-
case e: Expression if e.dataType.isInstanceOf[FractionalType] => true
162-
case _ => false
163-
}
154+
def unapply(e: Expression): Boolean = e.dataType.isInstanceOf[FractionalType]
164155
}
165156

166157

0 commit comments

Comments
 (0)