holdenk commented on a change in pull request #24051: [SPARK-26879][SQL] 
Standardize one-based column indexing for stack and json_tuple function
URL: https://github.com/apache/spark/pull/24051#discussion_r283009776
 
 

 ##########
 File path: sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala
 ##########
 @@ -141,6 +141,13 @@ class SQLQuerySuite extends QueryTest with 
SharedSQLContext {
       Row("1", 1) :: Row("2", 1) :: Row("3", 1) :: Nil)
   }
 
+  test("SPARK-26879 Standardize One-Based column indexing for stack and 
json_tuple function") {
+    val dfstack = sql("SELECT stack(2, 1, 2, 3)")
+    assert(dfstack.columns(0) == "col1" && dfstack.columns(1) == "col2")
+    val dfjson_tuple = sql("SELECT json_tuple('{\"a\":1, \"b\":2}', 'a', 'b')")
+    assert(dfjson_tuple.columns(0) == "col1" && dfjson_tuple.columns(1) == 
"col2")
+  }
 
 Review comment:
   I think the test is not bad to have, this way if we change the behaviour in 
the future unintentionally something will catch it.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to