Github user liancheng commented on a diff in the pull request:

    https://github.com/apache/spark/pull/5263#discussion_r27744000
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetTypes.scala ---
    @@ -404,7 +405,16 @@ private[parquet] object ParquetTypesConverter extends 
Logging {
         }
       }
     
    +  def checkSpecialCharacters(schema: Seq[Attribute]) = {
    +    // ,;{}()\n\t= and space character are special characters in Parquet 
schema
    +    if (schema.exists(_.name.matches(".*[ ,;{}()\n\t=].*"))) {
    +      sys.error("""Attribute name can not contain any character among " 
,;{}()\n\t=".
    +                   | Use Alias to rename attribute name""".stripMargin)
    --- End diff --
    
    Let's include the attribute name in the error message to make it more 
clear, and reformat the code a bit:
    
    ```scala
      private def checkSpecialCharacter(schema: Seq[Attribute]) = {
        schema.map(_.name).foreach { name =>
          if (name.matches(".*[ ,;{}()\n\t=].*")) {
            sys.error(
              s"""Attribute name "$name" contains invalid character(s) among " 
,;{}()\n\t=".
                 |Please use alias to rename it.
               """.stripMargin.split("\n").mkString)
          }
        }
      }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to