stefankandic commented on code in PR #46801:
URL: https://github.com/apache/spark/pull/46801#discussion_r1625986861


##########
sql/core/src/test/scala/org/apache/spark/sql/CollationSuite.scala:
##########
@@ -948,6 +952,210 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
     }
   }
 
+  test("SPARK-48280: Expression Walker for Testing") {
+    // This test does following:
+    // 1) Take all expressions
+    // 2) Filter out ones that have at least one argument of StringType
+    // 3) Use reflection to create an instance of the expression using first 
constructor
+    //    (test other as well).
+    // 4) Check if the expression is of type ExpectsInputTypes (should make 
this a bit broader)
+    // 5) Run eval against literals with strings under:
+    //    a) UTF8_BINARY, "dummy string" as input.
+    //    b) UTF8_BINARY_LCASE, "DuMmY sTrInG" as input.
+    // 6) Check if both expressions throw an exception.
+    // 7) If no exception, check if the result is the same.
+    // 8) There is a list of allowed expressions that can differ (e.g. hex)
+    def hasStringType(inputType: AbstractDataType): Boolean = {
+      inputType match {
+        case _: StringType | StringTypeAnyCollation | StringTypeBinaryLcase | 
AnyDataType =>
+          true
+        case ArrayType => true
+        case ArrayType(elementType, _) => hasStringType(elementType)

Review Comment:
   do we care about `MapType`?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to