Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/7003#discussion_r33224283
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/InternalRow.scala ---
@@ -19,14 +19,54 @@ package org.apache.spark.sql.catalyst
import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.expressions._
+import org.apache.spark.unsafe.types.UTF8String
/**
* An abstract class for row used internal in Spark SQL, which only
contain the columns as
* internal types.
*/
abstract class InternalRow extends Row {
+
+ // default implementation for codegen (for a Row which does not have
those types)
+ override def getBoolean(i: Int): Boolean = throw new
UnsupportedOperationException
+ override def getByte(i: Int): Byte = throw new
UnsupportedOperationException
+ override def getShort(i: Int): Short = throw new
UnsupportedOperationException
+ override def getInt(i: Int): Int = throw new
UnsupportedOperationException
+ override def getLong(i: Int): Long = throw new
UnsupportedOperationException
+ override def getFloat(i: Int): Float = throw new
UnsupportedOperationException
+ override def getDouble(i: Int): Double = throw new
UnsupportedOperationException
+
+ // This is only use for test
+ override def getString(i: Int): String = getAs[UTF8String](i).toString
+
+ // These expensive API should not be used internally.
+ override def getDecimal(i: Int): java.math.BigDecimal = throw new
UnsupportedOperationException
+ override def getDate(i: Int): java.sql.Date = throw new
UnsupportedOperationException
+ override def getTimestamp(i: Int): java.sql.Timestamp = throw new
UnsupportedOperationException
+ override def getSeq[T](i: Int): Seq[T] = throw new
UnsupportedOperationException
+ override def getList[T](i: Int): java.util.List[T] = throw new
UnsupportedOperationException
+ override def getMap[K, V](i: Int): scala.collection.Map[K, V] =
+ throw new UnsupportedOperationException
+ override def getJavaMap[K, V](i: Int): java.util.Map[K, V] =
+ throw new UnsupportedOperationException
+ override def getStruct(i: Int): InternalRow = throw new
UnsupportedOperationException
+ override def getAs[T](fieldName: String): T = throw new
UnsupportedOperationException
+ override def getValuesMap[T](fieldNames: Seq[String]): Map[String, T] =
--- End diff --
should we add `final` to make sure all `InternalRow` implementations can
not define these functions?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]