You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by huaxingao <gi...@git.apache.org> on 2018/10/22 22:03:42 UTC

[GitHub] spark pull request #22788: [SPARK-25769][SQL]escape nested columns by backti...

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

    https://github.com/apache/spark/pull/22788#discussion_r227152273
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala ---
    @@ -2702,7 +2702,7 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
     
           val e = intercept[AnalysisException](sql("SELECT v.i from (SELECT i FROM v)"))
           assert(e.message ==
    -        "cannot resolve '`v.i`' given input columns: [__auto_generated_subquery_name.i]")
    --- End diff --
    
    The out-most backticks is added in 
    ```case _```, in ```case class UnresolvedAttribute(nameParts: Seq[String])```
    ```
      override def sql: String = name match {
        case ParserUtils.escapedIdentifier(_) | ParserUtils.qualifiedEscapedIdentifier(_, _) => name
        case _ => quoteIdentifier(name)
      }
    ```
    the ```nameParts``` is a Seq of ```"v" "i"```, name is ```v.i``` 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org