Skip to content

Commit 61c3cf7

Browse files
committed
[SPARK-8879][SQL] Remove EmptyRow class.
As a baby step towards no megamorphic InternalRow. Author: Reynold Xin <[email protected]> Closes apache#7277 from rxin/remove-empty-row and squashes the following commits: 594100e [Reynold Xin] [SPARK-8879][SQL] Remove EmptyRow class.
1 parent 5d603df commit 61c3cf7

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,6 @@ case class CreateNamedStruct(children: Seq[Expression]) extends Expression {
120120
override def eval(input: InternalRow): Any = {
121121
InternalRow(valExprs.map(_.eval(input)): _*)
122122
}
123+
124+
override def prettyName: String = "named_struct"
123125
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
package org.apache.spark.sql.catalyst
1919

20+
import org.apache.spark.sql.catalyst.expressions._
21+
2022
/**
2123
* A set of classes that can be used to represent trees of relational expressions. A key goal of
2224
* the expression library is to hide the details of naming and scoping from developers who want to
@@ -49,6 +51,11 @@ package org.apache.spark.sql.catalyst
4951
*/
5052
package object expressions {
5153

54+
/**
55+
* Used as input into expressions whose output does not depend on any input value.
56+
*/
57+
val EmptyRow: InternalRow = null
58+
5259
/**
5360
* Converts a [[InternalRow]] to another Row given a sequence of expression that define each
5461
* column of the new row. If the schema of the input row is specified, then the given expression

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,6 @@ abstract class MutableRow extends InternalRow {
5454
}
5555
}
5656

57-
/**
58-
* A row with no data. Calling any methods will result in an error. Can be used as a placeholder.
59-
*/
60-
object EmptyRow extends InternalRow {
61-
override def apply(i: Int): Any = throw new UnsupportedOperationException
62-
override def toSeq: Seq[Any] = Seq.empty
63-
override def length: Int = 0
64-
override def isNullAt(i: Int): Boolean = throw new UnsupportedOperationException
65-
override def getInt(i: Int): Int = throw new UnsupportedOperationException
66-
override def getLong(i: Int): Long = throw new UnsupportedOperationException
67-
override def getDouble(i: Int): Double = throw new UnsupportedOperationException
68-
override def getFloat(i: Int): Float = throw new UnsupportedOperationException
69-
override def getBoolean(i: Int): Boolean = throw new UnsupportedOperationException
70-
override def getShort(i: Int): Short = throw new UnsupportedOperationException
71-
override def getByte(i: Int): Byte = throw new UnsupportedOperationException
72-
override def getString(i: Int): String = throw new UnsupportedOperationException
73-
override def getAs[T](i: Int): T = throw new UnsupportedOperationException
74-
override def copy(): InternalRow = this
75-
}
76-
7757
/**
7858
* A row implementation that uses an array of objects as the underlying storage.
7959
*/

0 commit comments

Comments
 (0)