Repository: spark
Updated Branches:
  refs/heads/branch-1.6 f4af6a8b3 -> 8ac0ce6dd


[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 <[email protected]>

Closes #12758 from freastro/hotfix/SPARK-14965.

(cherry picked from commit 12c360c057f09d13a31c458ad277640b5f6de394)
Signed-off-by: Reynold Xin <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/8ac0ce6d
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/8ac0ce6d
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/8ac0ce6d

Branch: refs/heads/branch-1.6
Commit: 8ac0ce6dd742edc50ceebb65946c24bfa4b4f301
Parents: f4af6a8
Author: Gregory Hart <[email protected]>
Authored: Thu Apr 28 11:21:43 2016 -0700
Committer: Reynold Xin <[email protected]>
Committed: Thu Apr 28 11:22:11 2016 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/sql/types/StructType.scala  | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/8ac0ce6d/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala
----------------------------------------------------------------------
diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala
index 1939633..a3090d8 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala
@@ -204,8 +204,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,
@@ -214,7 +215,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
@@ -227,7 +230,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,


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to