uros-db commented on code in PR #46618:
URL: https://github.com/apache/spark/pull/46618#discussion_r1604612518


##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSQLExpressionsSuite.scala:
##########
@@ -1584,6 +1584,234 @@ class CollationSQLExpressionsSuite
     })
   }
 
+  test("CurrentTimeZone expression with collation") {
+    // Supported collations
+    Seq("UTF8_BINARY", "UTF8_BINARY_LCASE", "UNICODE", 
"UNICODE_CI").foreach(collationName => {
+      val query = "select current_timezone()"
+      // Result

Review Comment:
   (goes for other similar tests too)



##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSQLExpressionsSuite.scala:
##########
@@ -1584,6 +1584,234 @@ class CollationSQLExpressionsSuite
     })
   }
 
+  test("CurrentTimeZone expression with collation") {
+    // Supported collations
+    Seq("UTF8_BINARY", "UTF8_BINARY_LCASE", "UNICODE", 
"UNICODE_CI").foreach(collationName => {
+      val query = "select current_timezone()"
+      // Result
+      withSQLConf(SqlApiConf.DEFAULT_COLLATION -> collationName) {
+        val testQuery = sql(query)
+        val dataType = StringType(collationName)
+        assertResult(dataType)(testQuery.schema.fields.head.dataType)
+      }
+    })
+  }
+
+  test("DayName expression with collation") {
+    // Supported collations
+    Seq("UTF8_BINARY", "UTF8_BINARY_LCASE", "UNICODE", 
"UNICODE_CI").foreach(collationName => {
+      val query = "select dayname(current_date())"
+      // Result
+      withSQLConf(SqlApiConf.DEFAULT_COLLATION -> collationName) {
+        val testQuery = sql(query)
+        val dataType = StringType(collationName)
+        assertResult(dataType)(testQuery.schema.fields.head.dataType)
+      }
+    })
+  }
+
+  test("ToUnixTimestamp expression with collation") {
+    // Supported collations
+    Seq("UTF8_BINARY", "UTF8_BINARY_LCASE", "UNICODE", 
"UNICODE_CI").foreach(collationName => {
+      val query =
+        s"""
+          |select to_unix_timestamp(collate('2021-01-01 00:00:00', 
'${collationName}'),
+          |collate('yyyy-MM-dd HH:mm:ss', '${collationName}'))
+          |""".stripMargin
+      // Result
+      val testQuery = sql(query)
+      val dataType = LongType
+      val expectedResult = 1609488000L
+      assertResult(dataType)(testQuery.schema.fields.head.dataType)
+      assertResult(expectedResult)(testQuery.collect().head.getLong(0))

Review Comment:
   (goes for other similar tests too)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to