Github user EntilZha commented on the pull request:
https://github.com/apache/spark/pull/7580#issuecomment-124209251
@rxin and @chenghao-intel, I think I may have found a bug in
`ExpectsInputTypes.scala`. For reference, this is what scala does when zipping
non-equal length collections:
```scala
val a = Array(1, 2, 3)
val b = Array(1)
a.zip(b)
// Array[(Int, Int)] = Array((1, 1))
```
Basically the first array gets shorted. In my case, I was implementing
`inputDataTypes` and having it return `Seq()` on a case where it should error
due to incorrect types. Below is that code segment (namely it should error on
`NullType` to match hive behavior). However, since `Seq()` is length zero, the
zipped collection becomes length zero, so `mismatches` is empty, so
`TypeCheckSuccess` is returned. Should `checkInputDataTypes` be written so it
checks that length matches, or should I write a custom `checkInputDataTypes`
function?
```scala
override def inputTypes: Seq[AbstractDataType] = right.dataType match {
case NullType => Seq() // I want to return a type error on this case
case _ => right.dataType match {
case n @ ArrayType(element, _) => Seq(n, element)
case _ => Seq() // I want to return a type error on this case
}
}
```
---
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]