Skip to content

Commit

Permalink
Scaladoc.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuai committed Jul 29, 2014
1 parent 122d1e7 commit e5f8df5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ import scala.language.dynamics

import org.apache.spark.sql.catalyst.types.DataType

/**
* The data type representing [[DynamicRow]] values.
*/
case object DynamicType extends DataType {
def simpleString: String = "dynamic"
}

/**
* Wrap a [[Row]] as a [[DynamicRow]].
*/
case class WrapDynamic(children: Seq[Attribute]) extends Expression {
type EvaluatedType = DynamicRow

Expand All @@ -39,6 +45,11 @@ case class WrapDynamic(children: Seq[Attribute]) extends Expression {
}
}

/**
* DynamicRows use scala's Dynamic trait to emulate an ORM of in a dynamically typed language.
* Since the type of the column is not known at compile time, all attributes are converted to
* strings before being passed to the function.
*/
class DynamicRow(val schema: Seq[Attribute], values: Array[Any])
extends GenericRow(values) with Dynamic {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,13 @@ object ArrayType {
def apply(elementType: DataType): ArrayType = ArrayType(elementType, false)
}

/**
* The data type for collections of multiple values.
* Internally these are represented as columns that contain a ``scala.collection.Seq``.
*
* @param elementType The data type of values.
* @param containsNull Indicates if values have `null` values
*/
case class ArrayType(elementType: DataType, containsNull: Boolean) extends DataType {
private[sql] def buildFormattedString(prefix: String, builder: StringBuilder): Unit = {
builder.append(
Expand All @@ -276,6 +283,12 @@ case class ArrayType(elementType: DataType, containsNull: Boolean) extends DataT
def simpleString: String = "array"
}

/**
* A field inside a StructType.
* @param name The name of this field.
* @param dataType The data type of this field.
* @param nullable Indicates if values of this field can be `null` values.
*/
case class StructField(name: String, dataType: DataType, nullable: Boolean) {

private[sql] def buildFormattedString(prefix: String, builder: StringBuilder): Unit = {
Expand Down Expand Up @@ -353,6 +366,12 @@ object MapType {
MapType(keyType: DataType, valueType: DataType, true)
}

/**
* The data type for Maps. Keys in a map are not allowed to have `null` values.
* @param keyType The data type of map keys.
* @param valueType The data type of map values.
* @param valueContainsNull Indicates if map values have `null` values.
*/
case class MapType(
keyType: DataType,
valueType: DataType,
Expand Down

0 comments on commit e5f8df5

Please sign in to comment.