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

    https://github.com/apache/spark/pull/6074#discussion_r30204274
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala 
---
    @@ -458,6 +458,35 @@ class DataFrameSuite extends QueryTest {
         assert(complexData.filter(complexData("s")("key") === 1).count() == 1)
       }
     
    +  test("SPARK-7551: support backticks for DataFrame attribute resolution") 
{
    +    val df = TestSQLContext.jsonRDD(TestSQLContext.sparkContext.makeRDD(
    +      """{"a.b": {"c": {"d..e": {"f": 1}}}}""" :: Nil))
    +    checkAnswer(
    +      df.select(df("`a.b`.c.`d..e`.`f`")),
    +      Row(1)
    +    )
    +
    +    val df2 = TestSQLContext.jsonRDD(TestSQLContext.sparkContext.makeRDD(
    +      """{"a  b": {"c": {"d  e": {"f": 1}}}}""" :: Nil))
    +    checkAnswer(
    +      df2.select(df2("`a  b`.c.`d  e`.f")),
    +      Row(1)
    +    )
    +
    +    def checkError(testFun: => Unit): Unit = {
    +      val e = intercept[org.apache.spark.sql.AnalysisException] {
    +        testFun
    +      }
    +      assert(e.getMessage.contains("syntax error in attribute name:"))
    +    }
    +    checkError(df("`abc.`c`"))
    +    checkError(df("`abc`..d"))
    +    checkError(df("`a`.b."))
    +    checkError(df("`a.b`.c.`d"))
    +    checkError(df2("`a  b`.c.d  e.f"))
    --- End diff --
    
    basically just move the test case into allowed, and revert your very last 
commit.


---
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