Skip to content

Commit e5f8df5

Browse files
committed
Scaladoc.
1 parent 122d1e7 commit e5f8df5

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,16 @@ import scala.language.dynamics
2121

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

24+
/**
25+
* The data type representing [[DynamicRow]] values.
26+
*/
2427
case object DynamicType extends DataType {
2528
def simpleString: String = "dynamic"
2629
}
2730

31+
/**
32+
* Wrap a [[Row]] as a [[DynamicRow]].
33+
*/
2834
case class WrapDynamic(children: Seq[Attribute]) extends Expression {
2935
type EvaluatedType = DynamicRow
3036

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

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

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/dataTypes.scala

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,13 @@ object ArrayType {
266266
def apply(elementType: DataType): ArrayType = ArrayType(elementType, false)
267267
}
268268

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

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

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

369+
/**
370+
* The data type for Maps. Keys in a map are not allowed to have `null` values.
371+
* @param keyType The data type of map keys.
372+
* @param valueType The data type of map values.
373+
* @param valueContainsNull Indicates if map values have `null` values.
374+
*/
356375
case class MapType(
357376
keyType: DataType,
358377
valueType: DataType,

0 commit comments

Comments
 (0)