diff options
Diffstat (limited to 'sql/catalyst')
3 files changed, 12 insertions, 10 deletions
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregates.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregates.scala index 2b364fc1df..3ceb5ecaf6 100755 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregates.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/aggregates.scala @@ -304,7 +304,7 @@ case class Average(child: Expression) extends PartialAggregate with trees.UnaryN child.dataType match { case DecimalType.Fixed(_, _) => - // Turn the results to unlimited decimals for the divsion, before going back to fixed + // Turn the results to unlimited decimals for the division, before going back to fixed val castedSum = Cast(Sum(partialSum.toAttribute), DecimalType.Unlimited) val castedCount = Cast(Sum(partialCount.toAttribute), DecimalType.Unlimited) SplitEvaluation( diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala index 7871a62620..2ff61169a1 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/codegen/GenerateProjection.scala @@ -53,8 +53,8 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { val nullFunctions = q""" private[this] var nullBits = new Array[Boolean](${expressions.size}) - final def setNullAt(i: Int) = { nullBits(i) = true } - final def isNullAt(i: Int) = nullBits(i) + override def setNullAt(i: Int) = { nullBits(i) = true } + override def isNullAt(i: Int) = nullBits(i) """.children val tupleElements = expressions.zipWithIndex.flatMap { @@ -82,7 +82,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { val iLit = ru.Literal(Constant(i)) q"if(isNullAt($iLit)) { null } else { ${newTermName(s"c$i")} }" } - q"final def iterator = Iterator[Any](..$allColumns)" + q"override def iterator = Iterator[Any](..$allColumns)" } val accessorFailure = q"""scala.sys.error("Invalid ordinal:" + i)""" @@ -94,7 +94,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { q"if(i == $ordinal) { if(isNullAt($i)) return null else return $elementName }" } - q"final def apply(i: Int): Any = { ..$cases; $accessorFailure }" + q"override def apply(i: Int): Any = { ..$cases; $accessorFailure }" } val updateFunction = { @@ -114,7 +114,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { return }""" } - q"final def update(i: Int, value: Any): Unit = { ..$cases; $accessorFailure }" + q"override def update(i: Int, value: Any): Unit = { ..$cases; $accessorFailure }" } val specificAccessorFunctions = NativeType.all.map { dataType => @@ -128,7 +128,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { } q""" - final def ${accessorForType(dataType)}(i: Int):${termForType(dataType)} = { + override def ${accessorForType(dataType)}(i: Int):${termForType(dataType)} = { ..$ifStatements; $accessorFailure }""" @@ -145,7 +145,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { } q""" - final def ${mutatorForType(dataType)}(i: Int, value: ${termForType(dataType)}): Unit = { + override def ${mutatorForType(dataType)}(i: Int, value: ${termForType(dataType)}): Unit = { ..$ifStatements; $accessorFailure }""" @@ -193,7 +193,7 @@ object GenerateProjection extends CodeGenerator[Seq[Expression], Projection] { val copyFunction = q""" - final def copy() = new $genericRowType(this.toArray) + override def copy() = new $genericRowType(this.toArray) """ val classBody = diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullFunctions.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullFunctions.scala index 086d0a3e07..84a3567895 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullFunctions.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/nullFunctions.scala @@ -37,7 +37,9 @@ case class Coalesce(children: Seq[Expression]) extends Expression { def dataType = if (resolved) { children.head.dataType } else { - throw new UnresolvedException(this, "Coalesce cannot have children of different types.") + val childTypes = children.map(c => s"$c: ${c.dataType}").mkString(", ") + throw new UnresolvedException( + this, s"Coalesce cannot have children of different types. $childTypes") } override def eval(input: Row): Any = { |