Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/9762#discussion_r45292131
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala 
---
    @@ -1479,4 +1481,20 @@ class SQLQuerySuite extends QueryTest with 
SQLTestUtils with TestHiveSingleton {
             |FROM (SELECT '{"f1": "value1", "f2": 12}' json, 'hello' as str) 
test
           """.stripMargin), Row("value1", "12", 3.14, "hello"))
       }
    +
    +  // This test case is to verify a bug when making a new instance of 
LogicalRDD.
    +  test ("SPARK-11633: HiveContext throws TreeNode Exception : Failed to 
Copy Node") {
    --- End diff --
    
    some suggestion about the test:
    
    * do not put tests in hive module if it's not hive related. Actually we can 
reproduce this bug by setting the case sensitive config to false and put the 
test in `DataFrameSuite`.
    * do not create new classes unless we have to. For this case we can create 
RDD[Row] and specify the schema for it.
    * clean up temp table at the end of test, or only use the `DataFrame` API
    
    here is an example and hope you can follow it in the future :)
    ```
    withSQLConf(SQLConf.CASE_SENSITIVE.key -> "false") {
      val rdd = sparkContext.makeRDD(Seq(Row(1, 3), Row(2, 1)))
      val df = sqlContext.createDataFrame(
        rdd,
        new StructType().add("f1", IntegerType).add("f2", IntegerType),
        needsConversion = false).select($"F1", $"f2".as("f2"))
      val df1 = df.as("a")
      val df2 = df.as("b")
      checkAnswer(df1.join(df2, $"a.f2" === $"b.f2"), Row(2) :: Row(1) :: Nil)
    }
    ```


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