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/09/13 02:18:31 UTC

Re: [PR] [SPARK-49611][SQL] Introduce TVF string_collations() and remove the `SHOW COLLATIONS` command [spark]

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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/generators.scala:
##########
@@ -618,3 +619,45 @@ case class SQLKeywords() extends LeafExpression with Generator with CodegenFallb
 
   override def prettyName: String = "sql_keywords"
 }
+
+@ExpressionDescription(
+  usage = """_FUNC_() - Get Spark SQL all collations""",
+  examples = """
+    Examples:
+      > SELECT * FROM _FUNC_() LIMIT 2;
+       SYSTEM  BUILTIN  UTF8_BINARY NULL  NULL  ACCENT_SENSITIVE  CASE_SENSITIVE  NO_PAD  NULL
+       SYSTEM  BUILTIN  UTF8_LCASE  NULL  NULL  ACCENT_SENSITIVE  CASE_INSENSITIVE  NO_PAD  NULL
+  """,
+  since = "4.0.0",
+  group = "generator_funcs")
+case class AllCollations() extends LeafExpression with Generator with CodegenFallback {
+  override def elementSchema: StructType = new StructType()
+    .add("COLLATION_CATALOG", StringType, nullable = false)
+    .add("COLLATION_SCHEMA", StringType, nullable = false)
+    .add("COLLATION_NAME", StringType, nullable = false)
+    .add("LANGUAGE", StringType)
+    .add("COUNTRY", StringType)
+    .add("ACCENT_SENSITIVITY", StringType, nullable = false)
+    .add("CASE_SENSITIVITY", StringType, nullable = false)

Review Comment:
   string type is probably better in SHOW command as it's easier for humans to read. Do we still need to use string type in TVF? cc @mihailom-db @srielau 



-- 
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