[SQL] Fix Performance Issue in data type casting
Using lazy val object instead of function in the class Cast, which improved the performance nearly by 2X in my local micro-benchmark. Author: Cheng Hao <hao.cheng@intel.com> Closes #679 from chenghao-intel/fix_type_casting and squashes the following commits: 71b0902 [Cheng Hao] using lazy val object instead of function for data type casting
This commit is contained in:
parent
3308722ca0
commit
ca43186867
|
@ -182,7 +182,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression {
|
|||
case x: NumericType => b => x.numeric.asInstanceOf[Numeric[Any]].toFloat(b)
|
||||
}
|
||||
|
||||
def cast: Any => Any = dataType match {
|
||||
private lazy val cast: Any => Any = dataType match {
|
||||
case StringType => castToString
|
||||
case BinaryType => castToBinary
|
||||
case DecimalType => castToDecimal
|
||||
|
|
Loading…
Reference in a new issue