Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-17832

TableIdentifier.quotedString creates un-parseable names when name contains a backtick

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.2, 2.1.0
    • Component/s: SQL
    • Labels:
      None

      Description

      The quotedString method in TableIdentifier and FunctionIdentifier produce an illegal (un-parseable) name when the name contains a backtick. For example:

      import org.apache.spark.sql.catalyst.parser.CatalystSqlParser._
      import org.apache.spark.sql.catalyst.TableIdentifier
      import org.apache.spark.sql.catalyst.analysis.UnresolvedAttribute
      val complexName = TableIdentifier("`weird`table`name", Some("`d`b`1"))
      parseTableIdentifier(complexName.unquotedString) // Does not work
      parseTableIdentifier(complexName.quotedString) // Does not work
      UnresolvedAttribute.parseAttributeName(complexName.unquotedString) // Does not work
      UnresolvedAttribute.parseAttributeName(complexName.quotedString) // Does not work
      

      The quotedString method should escape backticks properly.

        Attachments

          Activity

            People

            • Assignee:
              jiangxb1987 Xingbo Jiang
              Reporter:
              hvanhovell Herman van Hovell
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: