Skip to content
Prev Previous commit
Next Next commit
Merge branch 'master' into SPARK-48574
  • Loading branch information
mihailomilosevic2001 authored Jun 17, 2024
commit 17d530d9450fe91f32476357fb78c31554183803
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,7 @@ class CollationSQLExpressionsSuite
})
}

<<<<<<< SPARK-48574
test("ExtractValue expression with collation") {
// Supported collations
testSuppCollations.foreach(collationName => {
Expand All @@ -1870,6 +1871,39 @@ class CollationSQLExpressionsSuite
assert(testQuery.schema.fields.head.dataType.sameType(dataType))
checkAnswer(testQuery, Row(expectedResult))
}
=======
test("Lag expression with collation") {
// Supported collations
testSuppCollations.foreach(collationName => {
val query =
s"""
|SELECT lag(a, -1, 'default' collate $collationName) OVER (PARTITION BY b ORDER BY a)
|FROM VALUES ('A1', 2), ('A2', 1), ('A2', 3), ('A1', 1) tab(a, b);
|""".stripMargin
// Result & data type check
val testQuery = sql(query)
val dataType = StringType(collationName)
val expectedResult = Seq("A2", "default", "default", "default")
assert(testQuery.schema.fields.head.dataType.sameType(dataType))
checkAnswer(testQuery, expectedResult.map(Row(_)))
})
}

test("Lead expression with collation") {
// Supported collations
testSuppCollations.foreach(collationName => {
val query =
s"""
|SELECT lead(a, -1, 'default' collate $collationName) OVER (PARTITION BY b ORDER BY a)
|FROM VALUES ('A1', 2), ('A2', 1), ('A2', 3), ('A1', 1) tab(a, b);
|""".stripMargin
// Result & data type check
val testQuery = sql(query)
val dataType = StringType(collationName)
val expectedResult = Seq("A1", "default", "default", "default")
assert(testQuery.schema.fields.head.dataType.sameType(dataType))
checkAnswer(testQuery, expectedResult.map(Row(_)))
>>>>>>> master
})
}

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.