Github user dongjoon-hyun commented on the issue:
https://github.com/apache/spark/pull/17251
I added `StackCoercision` at
[here](https://github.com/apache/spark/pull/17251/commits/36d90811a77889b19c47347fc591a8e1a6a482f3),
but reverted that.
For `StackCoercision`, we need the schema which is based on the number of
rows (and derived columns) from the first argument. Actually, the content of
the first argument. The validation of the value is done by
`Stack.checkInputDataTypes`. It seems we cannot add `StackCoercision`.
For example, `StackCoercision` will fail for the followings.
```
// The first argument must be a positive constant integer.
val m = intercept[AnalysisException] {
df.selectExpr("stack(1.1, 1, 2, 3)")
}.getMessage
assert(m.contains("The number of rows must be a positive constant
integer."))
val m2 = intercept[AnalysisException] {
df.selectExpr("stack(-1, 1, 2, 3)")
}.getMessage
assert(m2.contains("The number of rows must be a positive constant
integer."))
```
---
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]