Skip to content

Commit bb18108

Browse files
committed
Code review
1 parent 629ec84 commit bb18108

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2075,7 +2075,7 @@ case class ArrayPosition(left: Expression, right: Expression)
20752075
override def checkInputDataTypes(): TypeCheckResult = {
20762076
(left.dataType, right.dataType) match {
20772077
case (ArrayType(e1, _), e2) if e1.sameType(e2) =>
2078-
TypeUtils.checkForOrderingExpr(right.dataType, s"function $prettyName")
2078+
TypeUtils.checkForOrderingExpr(e2, s"function $prettyName")
20792079
case _ => TypeCheckResult.TypeCheckFailure(s"Input to function $prettyName should have " +
20802080
s"been ${ArrayType.simpleString} followed by a value with same element type, but it's " +
20812081
s"[${left.dataType.catalogString}, ${right.dataType.catalogString}].")

sql/core/src/test/scala/org/apache/spark/sql/DataFrameFunctionsSuite.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,11 @@ class DataFrameFunctionsSuite extends QueryTest with SharedSQLContext {
10551055
Seq(Row(1L), Row(1L))
10561056
)
10571057

1058+
checkAnswer(
1059+
df.selectExpr("array_position(array(1.D), 1)"),
1060+
Seq(Row(1L), Row(1L))
1061+
)
1062+
10581063
checkAnswer(
10591064
df.selectExpr("array_position(array(1.23D), 1)"),
10601065
Seq(Row(0L), Row(0L))

0 commit comments

Comments
 (0)