Skip to content

Commit

Permalink
[GLUTEN-6784][GLUTEN-6828][VL] Add tests for weekOfYear and cast stri…
Browse files Browse the repository at this point in the history
…ng as date (#6888)
  • Loading branch information
zml1206 authored Oct 10, 2024
1 parent f66481e commit 5a1f6f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,17 @@ class MiscOperatorSuite extends VeloxWholeStageTransformerSuite with AdaptiveSpa
}
}

test("Cast string to date") {
withTempView("view") {
Seq("2023-01-01", "2023-01-02", "-1", "-111-01-01")
.toDF("dateColumn")
.createOrReplaceTempView("view")
runQueryAndCompare("SELECT cast(dateColumn as date) from view") {
checkGlutenOperatorMatch[ProjectExecTransformer]
}
}
}

test("Cast date to timestamp") {
withTempPath {
path =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ abstract class ScalarFunctionsValidateSuite extends FunctionsValidateSuite {
test("extract date field") {
withTable("t") {
sql("create table t (dt date) using parquet")
sql("insert into t values(date '2008-02-20')")
sql("insert into t values(date '2008-02-20'), (date '2022-01-01')")
runQueryAndCompare("select weekofyear(dt) from t") {
checkGlutenOperatorMatch[ProjectExecTransformer]
}
Expand Down

0 comments on commit 5a1f6f2

Please sign in to comment.