Skip to content
Snippets Groups Projects
Commit ca431868 authored by Cheng Hao's avatar Cheng Hao Committed by Reynold Xin
Browse files

[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
parent 3308722c
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment