cloud-fan commented on a change in pull request #28328:
URL: https://github.com/apache/spark/pull/28328#discussion_r415570206
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Column.scala
##########
@@ -828,11 +828,12 @@ class Column(val expr: Expression) extends Logging {
* @since 2.4.0
*/
def isInCollection(values: scala.collection.Iterable[_]): Column = withExpr {
- val hSet = values.toSet[Any]
- if (hSet.size > SQLConf.get.optimizerInSetConversionThreshold) {
- InSet(expr, hSet)
+ val exprValues = values.toSeq.map(lit(_).expr)
+ if (exprValues.size > SQLConf.get.optimizerInSetConversionThreshold) {
+ val elemType = exprValues.headOption.map(_.dataType).getOrElse(NullType)
+ InSet(expr, exprValues.map(_.eval()).toSet, elemType)
Review comment:
How can we make sure the `expr` has the same data type as `exprValues`?
Do we have a type coercion rule for 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]