Skip to content

Commit

Permalink
[SPARK-39857][SQL] V2ExpressionBuilder uses the wrong LiteralValue da…
Browse files Browse the repository at this point in the history
…ta type for In predicate (Kyligence#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 apache#37271 from huaxingao/inset.

Authored-by: huaxingao <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>

Signed-off-by: Dongjoon Hyun <[email protected]>
Co-authored-by: huaxingao <[email protected]>
  • Loading branch information
2 people authored and hellozepp committed Aug 10, 2023
1 parent e3ba584 commit e390f9c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ 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, in.dataType))).toArray[V2Expression]
(v +: hset.toSeq.map(elem => LiteralValue(elem, child.dataType))).toArray[V2Expression]
new V2Predicate("IN", children)
}
// Because we only convert In to InSet in Optimizer when there are more than certain
Expand Down

0 comments on commit e390f9c

Please sign in to comment.