From 7988c915e2f62d91ace5c886546164c6e5e66b33 Mon Sep 17 00:00:00 2001 From: Zhixiong Chen Date: Fri, 2 Sep 2022 15:44:48 +0800 Subject: [PATCH] [SPARK-39857][SQL] V2ExpressionBuilder uses the wrong LiteralValue data type for In predicate (#535) When building V2 `In` Predicate in `V2ExpressionBuilder`, `InSet.dataType` (which is `BooleanType`) is used to build the `LiteralValue`, `InSet.child.dataType` should be used instead. bug fix no new test Closes #37271 from huaxingao/inset. Authored-by: huaxingao Signed-off-by: Dongjoon Hyun Signed-off-by: Dongjoon Hyun Co-authored-by: huaxingao --- .../apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala b/sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala index acb5110ac708f..041ddf9fd07bc 100644 --- a/sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala +++ b/sql/core/src/main/scala/org/apache/spark/sql/catalyst/util/V2ExpressionBuilder.scala @@ -52,7 +52,7 @@ class V2ExpressionBuilder(e: Expression, isPredicate: Boolean = false) { } else { Some(ref) } - case in @ InSet(child, hset) => + case InSet(child, hset) => generateExpression(child).map { v => val children = (v +: hset.toSeq.map(elem => LiteralValue(elem, child.dataType))).toArray[V2Expression]