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

    https://github.com/apache/spark/pull/21240#discussion_r186264379
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/GeneratorFunctionSuite.scala ---
    @@ -307,6 +307,37 @@ class GeneratorFunctionSuite extends QueryTest with 
SharedSQLContext {
           sql("select * from values 1, 2 lateral view outer empty_gen() a as 
b"),
           Row(1, null) :: Row(2, null) :: Nil)
       }
    +
    +  test("ReplicateRows generator") {
    +    val df = spark.range(1)
    +
    +    // Empty DataFrame suppress the result generation
    +    checkAnswer(spark.emptyDataFrame.selectExpr("replicate_rows(1, 1, 2, 
3)"), Nil)
    +
    +    checkAnswer(df.selectExpr("replicate_rows(1, 2.5)"), Row(1, 2.5) :: 
Nil)
    +    checkAnswer(df.selectExpr("replicate_rows(1, null)"), Row(1, null) :: 
Nil)
    +    checkAnswer(df.selectExpr("replicate_rows(3, 'row1')"),
    +      Row(3, "row1") :: Row(3, "row1") :: Row(3, "row1") :: Nil)
    +    checkAnswer(df.selectExpr("replicate_rows(-1, 2.5)"), Nil)
    +
    +    // The data for the same column should have the same type.
    --- End diff --
    
    This copied comment can be removed.


---

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

Reply via email to