-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-26879][SQL] Standardize one-based column indexing for stack and json_tuple function #24051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need this test.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the test is not bad to have, this way if we change the behaviour in the future unintentionally something will catch it. |
||
|
|
||
| test("support table.star") { | ||
| checkAnswer( | ||
| sql( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last question, @chakravarthiT. What does Hive's
json_tuplereturns for the column names? I think we matched the column names with Hive when we added this long time ago.