[DataFrame][minor] cleanup unapply methods in DataTypes
Author: Wenchen Fan <cloud0fan@outlook.com>
Closes #6079 from cloud-fan/unapply and squashes the following commits:
40da442 [Wenchen Fan] one more
7d90a05 [Wenchen Fan] cleanup unapply in DataTypes
(cherry picked from commit 831504cf6b
)
Signed-off-by: Reynold Xin <rxin@databricks.com>
This commit is contained in:
parent
653db0a1bd
commit
a9d84a9bf7
|
@ -47,10 +47,7 @@ abstract class DataType {
|
||||||
* ...
|
* ...
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
private[sql] def unapply(a: Expression): Boolean = a match {
|
private[sql] def unapply(e: Expression): Boolean = e.dataType == this
|
||||||
case e: Expression if e.dataType == this => true
|
|
||||||
case _ => false
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default size of a value of this data type, used internally for size estimation.
|
* The default size of a value of this data type, used internally for size estimation.
|
||||||
|
@ -137,10 +134,7 @@ private[sql] object IntegralType {
|
||||||
* ...
|
* ...
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
def unapply(a: Expression): Boolean = a match {
|
def unapply(e: Expression): Boolean = e.dataType.isInstanceOf[IntegralType]
|
||||||
case e: Expression if e.dataType.isInstanceOf[IntegralType] => true
|
|
||||||
case _ => false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,10 +151,7 @@ private[sql] object FractionalType {
|
||||||
* ...
|
* ...
|
||||||
* }}}
|
* }}}
|
||||||
*/
|
*/
|
||||||
def unapply(a: Expression): Boolean = a match {
|
def unapply(e: Expression): Boolean = e.dataType.isInstanceOf[FractionalType]
|
||||||
case e: Expression if e.dataType.isInstanceOf[FractionalType] => true
|
|
||||||
case _ => false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue