You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "cloud-fan (via GitHub)" <gi...@apache.org> on 2024/03/01 14:07:23 UTC

Re: [PR] [SPARK-47168][SQL] Disable parquet filter pushdown when working with non default collated strings [spark]

cloud-fan commented on code in PR #45262:
URL: https://github.com/apache/spark/pull/45262#discussion_r1509060591


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/util/SchemaUtils.scala:
##########
@@ -293,4 +293,29 @@ private[spark] object SchemaUtils {
    * @return The escaped string.
    */
   def escapeMetaCharacters(str: String): String = SparkSchemaUtils.escapeMetaCharacters(str)
+
+  /**
+   * Checks if a given data type has a non-default collation string type.
+   */
+  def hasNonDefaultCollatedString(dt: DataType): Boolean = {
+    typeExistsRecursively(dt) {
+      case st: StringType => !st.isDefaultCollation
+      case _ => false
+    }
+  }
+
+  /**
+   * Recursively checks whether a given predicate holds true for any data type
+   * within the specified data type.
+   */
+  def typeExistsRecursively(dt: DataType)(f: DataType => Boolean): Boolean = dt match {

Review Comment:
   isn't it just `DataType#existsRecursively`?



-- 
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-unsubscribe@spark.apache.org

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


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