srowen commented on a change in pull request #23373: [SPARK-14023][CORE][SQL] 
Don't reference 'field' in StructField errors for clarity in exceptions
URL: https://github.com/apache/spark/pull/23373#discussion_r243779585
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/types/StructType.scala
 ##########
 @@ -301,8 +300,8 @@ case class StructType(fields: Array[StructField]) extends 
DataType with Seq[Stru
   def fieldIndex(name: String): Int = {
     nameToIndex.getOrElse(name,
       throw new IllegalArgumentException(
-        s"""Field "$name" does not exist.
-           |Available fields: ${fieldNames.mkString(", ")}""".stripMargin))
+        s""""$name" does not exist.
+           |Available: ${fieldNames.mkString("\"", "\", \"", 
"\"")}""".stripMargin))
 
 Review comment:
   Sure, I'll remove quotes around all versions of this exception.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to