Skip to content

Commit ce1041c

Browse files
Davies Liurxin
authored andcommitted
[SPARK-8346] [SQL] Use InternalRow instread of catalyst.InternalRow
cc rxin marmbrus Author: Davies Liu <[email protected]> Closes apache#6802 from davies/cleanup_internalrow and squashes the following commits: 769d2aa [Davies Liu] remove not needed cast 4acbbe4 [Davies Liu] catalyst.Internal -> InternalRow
1 parent d986fb9 commit ce1041c

22 files changed

+176
-183
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/unresolved.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ case class UnresolvedAttribute(nameParts: Seq[String])
6868
override def withName(newName: String): UnresolvedAttribute = UnresolvedAttribute.quoted(newName)
6969

7070
// Unresolved attributes are transient at compile time and don't get evaluated during execution.
71-
override def eval(input: catalyst.InternalRow = null): Any =
71+
override def eval(input: InternalRow = null): Any =
7272
throw new TreeNodeException(this, s"No function to evaluate expression. type: ${this.nodeName}")
7373

7474
override def toString: String = s"'$name"
@@ -86,7 +86,7 @@ case class UnresolvedFunction(name: String, children: Seq[Expression]) extends E
8686
override lazy val resolved = false
8787

8888
// Unresolved functions are transient at compile time and don't get evaluated during execution.
89-
override def eval(input: catalyst.InternalRow = null): Any =
89+
override def eval(input: InternalRow = null): Any =
9090
throw new TreeNodeException(this, s"No function to evaluate expression. type: ${this.nodeName}")
9191

9292
override def toString: String = s"'$name(${children.mkString(",")})"
@@ -108,7 +108,7 @@ trait Star extends NamedExpression with trees.LeafNode[Expression] {
108108
override lazy val resolved = false
109109

110110
// Star gets expanded at runtime so we never evaluate a Star.
111-
override def eval(input: catalyst.InternalRow = null): Any =
111+
override def eval(input: InternalRow = null): Any =
112112
throw new TreeNodeException(this, s"No function to evaluate expression. type: ${this.nodeName}")
113113

114114
def expand(input: Seq[Attribute], resolver: Resolver): Seq[NamedExpression]
@@ -167,7 +167,7 @@ case class MultiAlias(child: Expression, names: Seq[String])
167167

168168
override lazy val resolved = false
169169

170-
override def eval(input: catalyst.InternalRow = null): Any =
170+
override def eval(input: InternalRow = null): Any =
171171
throw new TreeNodeException(this, s"No function to evaluate expression. type: ${this.nodeName}")
172172

173173
override def toString: String = s"$child AS $names"
@@ -201,7 +201,7 @@ case class UnresolvedExtractValue(child: Expression, extraction: Expression)
201201
override def nullable: Boolean = throw new UnresolvedException(this, "nullable")
202202
override lazy val resolved = false
203203

204-
override def eval(input: catalyst.InternalRow = null): Any =
204+
override def eval(input: InternalRow = null): Any =
205205
throw new TreeNodeException(this, s"No function to evaluate expression. type: ${this.nodeName}")
206206

207207
override def toString: String = s"$child[$extraction]"

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression w
394394
}
395395
// TODO: Could be faster?
396396
val newRow = new GenericMutableRow(from.fields.size)
397-
buildCast[catalyst.InternalRow](_, row => {
397+
buildCast[InternalRow](_, row => {
398398
var i = 0
399399
while (i < row.length) {
400400
val v = row(i)
@@ -426,7 +426,7 @@ case class Cast(child: Expression, dataType: DataType) extends UnaryExpression w
426426

427427
private[this] lazy val cast: Any => Any = cast(child.dataType, dataType)
428428

429-
override def eval(input: catalyst.InternalRow): Any = {
429+
override def eval(input: InternalRow): Any = {
430430
val evaluated = child.eval(input)
431431
if (evaluated == null) null else cast(evaluated)
432432
}

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ExtractValue.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ case class GetStructField(child: Expression, field: StructField, ordinal: Int)
105105
override def foldable: Boolean = child.foldable
106106
override def toString: String = s"$child.${field.name}"
107107

108-
override def eval(input: catalyst.InternalRow): Any = {
109-
val baseValue = child.eval(input).asInstanceOf[catalyst.InternalRow]
108+
override def eval(input: InternalRow): Any = {
109+
val baseValue = child.eval(input).asInstanceOf[InternalRow]
110110
if (baseValue == null) null else baseValue(ordinal)
111111
}
112112
}
@@ -125,8 +125,8 @@ case class GetArrayStructFields(
125125
override def foldable: Boolean = child.foldable
126126
override def toString: String = s"$child.${field.name}"
127127

128-
override def eval(input: catalyst.InternalRow): Any = {
129-
val baseValue = child.eval(input).asInstanceOf[Seq[catalyst.InternalRow]]
128+
override def eval(input: InternalRow): Any = {
129+
val baseValue = child.eval(input).asInstanceOf[Seq[InternalRow]]
130130
if (baseValue == null) null else {
131131
baseValue.map { row =>
132132
if (row == null) null else row(ordinal)
@@ -146,7 +146,7 @@ abstract class ExtractValueWithOrdinal extends ExtractValue {
146146
override def toString: String = s"$child[$ordinal]"
147147
override def children: Seq[Expression] = child :: ordinal :: Nil
148148

149-
override def eval(input: catalyst.InternalRow): Any = {
149+
override def eval(input: InternalRow): Any = {
150150
val value = child.eval(input)
151151
if (value == null) {
152152
null

0 commit comments

Comments
 (0)