Skip to content
Snippets Groups Projects
Commit 12c360c0 authored by Gregory Hart's avatar Gregory Hart Committed by Reynold Xin
Browse files

[SPARK-14965][SQL] Indicate an exception is thrown for a missing struct field

## What changes were proposed in this pull request?

Fix to ScalaDoc for StructType.

## How was this patch tested?

Built locally.

Author: Gregory Hart <greg.hart@thinkbiganalytics.com>

Closes #12758 from freastro/hotfix/SPARK-14965.
parent 89addd40
No related branches found
No related tags found
No related merge requests found
......@@ -206,8 +206,9 @@ case class StructType(fields: Array[StructField]) extends DataType with Seq[Stru
}
/**
* Extracts a [[StructField]] of the given name. If the [[StructType]] object does not
* have a name matching the given name, `null` will be returned.
* Extracts the [[StructField]] with the given name.
*
* @throws IllegalArgumentException if a field with the given name does not exist
*/
def apply(name: String): StructField = {
nameToField.getOrElse(name,
......@@ -216,7 +217,9 @@ case class StructType(fields: Array[StructField]) extends DataType with Seq[Stru
/**
* Returns a [[StructType]] containing [[StructField]]s of the given names, preserving the
* original order of fields. Those names which do not have matching fields will be ignored.
* original order of fields.
*
* @throws IllegalArgumentException if a field cannot be found for any of the given names
*/
def apply(names: Set[String]): StructType = {
val nonExistFields = names -- fieldNamesSet
......@@ -229,7 +232,9 @@ case class StructType(fields: Array[StructField]) extends DataType with Seq[Stru
}
/**
* Returns index of a given field
* Returns the index of a given field.
*
* @throws IllegalArgumentException if a field with the given name does not exist
*/
def fieldIndex(name: String): Int = {
nameToIndex.getOrElse(name,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment