-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24633][SQL] Fix codegen when split is required for arrays_zip #21621
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 |
|---|---|---|
|
|
@@ -556,6 +556,17 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSQLContext { | |
| checkAnswer(df8.selectExpr("arrays_zip(v1, v2)"), expectedValue8) | ||
| } | ||
|
|
||
| test("SPARK-24633: arrays_zip splits input processing correctly") { | ||
| Seq("true", "false").foreach { wholestageCodegenEnabled => | ||
| withSQLConf(SQLConf.WHOLESTAGE_CODEGEN_ENABLED.key -> wholestageCodegenEnabled) { | ||
| val df = spark.range(1) | ||
| val exprs = (0 to 5).map(x => array($"id" + lit(x))) | ||
|
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. This wasn't splitting input processing for me. Maybe splitExpressionsWithCurrentInputs has a bigger threshold than splitExpressions. Even at 90, it still had not split the input processing. At 100, it finally did. So someplace between 90 and 100, it starts splitting. I might be looking at the wrong thing. Check at your end. val exprs = (0 to 100).map(x => array($"id" + lit(x)))
checkAnswer(df.select(arrays_zip(exprs: _*)),
Row(Seq(Row(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100))))
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. With/Without this PR, I see the split methods in the generated code using the original test cases (i.e.
Contributor
Author
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. @bersprockets it is not splitting if you have wholestagecodegen enabled because in that case we are not able (at the moment at least) to split methods using current inputs.
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. @mgaido91 Got it, you were testing that it does not split when wholestagecodegen is enabled. |
||
| checkAnswer(df.select(arrays_zip(exprs: _*)), | ||
| Row(Seq(Row(0, 1, 2, 3, 4, 5)))) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| test("map size function") { | ||
| val df = Seq( | ||
| (Map[Int, Int](1 -> 1, 2 -> 2), "x"), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Direct call of
splitExpressionshere has two problems:splitExpressionscan't work under wholestage codegen.argumentsfor non wholestage codegen.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.
yes, you're 100% right. That's why in the UT I added I am testing both cases.