This is an automated email from the ASF dual-hosted git repository.

wenchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 39fef73e45e3 [SPARK-55372][SQL] Fix `SHOW CREATE TABLE` for tables / 
views with default collation
39fef73e45e3 is described below

commit 39fef73e45e3104db327041f9bdf3b64d2186be0
Author: ilicmarkodb <[email protected]>
AuthorDate: Tue Feb 17 00:55:48 2026 +0800

    [SPARK-55372][SQL] Fix `SHOW CREATE TABLE` for tables / views with default 
collation
    
    ### What changes were proposed in this pull request?
    Fixed `SHOW CREATE TABLE` for tables / views to correctly print `DEFAULT 
COLLATION collationName`.
    For example: `CREATE TABLE t (c1 STRING) DEFAULT COLLATION UTF8_LCASE`. 
Previously, it was printing `COLLATE 'UTF8_LCASE'`, which produces a parsing 
error.
    
    For `UTF8_BINARY` collated / non collated columns (for example, `c1`), the 
output of `SHOW CREATE TABLE` should print `c1 STRING COLLATE UTF8_BINARY`, so 
that we don’t inherit the collation from the table or schema, if defined.
    
    To achieve this, I changed `typeName` in `StringType` to print `COLLATE 
UTF8_BINARY` for explicitly collated `UTF8_BINARY` columns. For non-collated 
`StringType` (case object), `typeName` does not print `COLLATE UTF8_BINARY`, 
which matches the old behaviour.
    
    ### Why are the changes needed?
    Bug fix.
    
    ### Does this PR introduce _any_ user-facing change?
    Yes, corrects `SHOW CREATE TABLE` command.
    
    ### How was this patch tested?
    `show-create-table.sql` golden file.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No.
    
    Closes #54159 from ilicmarkodb/fix_show_create_table.
    
    Authored-by: ilicmarkodb <[email protected]>
    Signed-off-by: Wenchen Fan <[email protected]>
---
 .../org/apache/spark/sql/types/CharType.scala      |  4 +-
 .../org/apache/spark/sql/types/StringType.scala    | 10 ++-
 .../org/apache/spark/sql/types/VarcharType.scala   |  4 +-
 .../spark/sql/catalyst/types/DataTypeUtils.scala   | 19 +++++
 .../apache/spark/sql/PlanGenerationTestSuite.scala | 24 +++++-
 .../connect/ColumnNodeToProtoConverterSuite.scala  |  6 +-
 .../connect/common/DataTypeProtoConverter.scala    | 14 ++--
 .../explain-results/function_typedLit.explain      |  2 +-
 .../spark/sql/execution/command/tables.scala       | 15 +++-
 .../datasources/v2/ShowCreateTableExec.scala       | 10 ++-
 .../analyzer-results/collations-basic.sql.out      | 12 +--
 .../collations-padding-trim.sql.out                | 22 ++---
 .../collations-string-functions.sql.out            | 62 +++++++-------
 .../analyzer-results/show-create-table.sql.out     | 42 ++++++++++
 .../sql-tests/inputs/show-create-table.sql         | 12 +++
 .../sql-tests/results/charvarchar.sql.out          | 12 +--
 .../sql-tests/results/collations-basic.sql.out     | 42 +++++-----
 .../results/collations-padding-trim.sql.out        | 52 ++++++------
 .../results/collations-string-functions.sql.out    | 96 +++++++++++-----------
 .../results/identifier-clause-legacy.sql.out       |  2 +-
 .../sql-tests/results/identifier-clause.sql.out    |  2 +-
 .../sql-tests/results/show-create-table.sql.out    | 79 ++++++++++++++++--
 .../sql/collation/CollationSQLRegexpSuite.scala    |  2 +-
 .../spark/sql/collation/CollationSuite.scala       | 13 ++-
 .../command/ShowCreateTableSuiteBase.scala         | 21 ++---
 .../command/v1/ShowCreateTableSuite.scala          | 15 ++--
 .../command/v2/ShowCreateTableSuite.scala          | 11 +--
 27 files changed, 388 insertions(+), 217 deletions(-)

diff --git a/sql/api/src/main/scala/org/apache/spark/sql/types/CharType.scala 
b/sql/api/src/main/scala/org/apache/spark/sql/types/CharType.scala
index c26d7cdb899b..71b7216d9a93 100644
--- a/sql/api/src/main/scala/org/apache/spark/sql/types/CharType.scala
+++ b/sql/api/src/main/scala/org/apache/spark/sql/types/CharType.scala
@@ -39,10 +39,10 @@ case class CharType private[sql] (length: Int, collation: 
Option[Int])
 
   override def defaultSize: Int = length
   override def typeName: String =
-    if (isUTF8BinaryCollation) s"char($length)"
+    if (collation.isEmpty) s"char($length)"
     else s"char($length) collate $collationName"
   override def toString: String =
-    if (isUTF8BinaryCollation) s"CharType($length)"
+    if (collation.isEmpty) s"CharType($length)"
     else s"CharType($length, $collationName)"
   private[spark] override def asNullable: CharType = this
 
diff --git a/sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala 
b/sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala
index 89bcbc90b4c3..9f52f647a57a 100644
--- a/sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala
+++ b/sql/api/src/main/scala/org/apache/spark/sql/types/StringType.scala
@@ -78,12 +78,10 @@ class StringType private[sql] (
    * `string` due to backwards compatibility.
    */
   override def typeName: String =
-    if (isUTF8BinaryCollation) "string"
-    else s"string collate $collationName"
+    s"string collate $collationName"
 
   override def toString: String =
-    if (isUTF8BinaryCollation) "StringType"
-    else s"StringType($collationName)"
+    s"StringType($collationName)"
 
   private[sql] def collationName: String =
     CollationFactory.fetchCollation(collationId).collationName
@@ -119,6 +117,10 @@ case object StringType
     val collationId = CollationFactory.collationNameToId(collation)
     new StringType(collationId)
   }
+
+  override def typeName: String = "string"
+
+  override def toString: String = "StringType"
 }
 
 /**
diff --git 
a/sql/api/src/main/scala/org/apache/spark/sql/types/VarcharType.scala 
b/sql/api/src/main/scala/org/apache/spark/sql/types/VarcharType.scala
index 70d538e8b46b..11d5bc79fd9b 100644
--- a/sql/api/src/main/scala/org/apache/spark/sql/types/VarcharType.scala
+++ b/sql/api/src/main/scala/org/apache/spark/sql/types/VarcharType.scala
@@ -38,10 +38,10 @@ case class VarcharType private[sql] (length: Int, 
collation: Option[Int])
 
   override def defaultSize: Int = length
   override def typeName: String =
-    if (isUTF8BinaryCollation) s"varchar($length)"
+    if (collation.isEmpty) s"varchar($length)"
     else s"varchar($length) collate $collationName"
   override def toString: String =
-    if (isUTF8BinaryCollation) s"VarcharType($length)"
+    if (collation.isEmpty) s"VarcharType($length)"
     else s"VarcharType($length, $collationName)"
   private[spark] override def asNullable: VarcharType = this
 
diff --git 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/DataTypeUtils.scala
 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/DataTypeUtils.scala
index c02650b20903..20f2f97fea6c 100644
--- 
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/DataTypeUtils.scala
+++ 
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/types/DataTypeUtils.scala
@@ -18,6 +18,7 @@ package org.apache.spark.sql.catalyst.types
 
 import org.apache.spark.sql.catalyst.analysis.Resolver
 import org.apache.spark.sql.catalyst.expressions.{Attribute, 
AttributeReference, Cast, Literal}
+import org.apache.spark.sql.catalyst.util.CollationFactory
 import org.apache.spark.sql.catalyst.util.TypeUtils.toSQLId
 import org.apache.spark.sql.errors.QueryCompilationErrors
 import org.apache.spark.sql.internal.SQLConf.StoreAssignmentPolicy
@@ -327,5 +328,23 @@ object DataTypeUtils {
       case _ => false
     }
   }
+
+  /**
+   * Recursively replaces all STRING, CHAR and VARCHAR types that do not have 
an explicit collation
+   * with the same type but with explicit `UTF8_BINARY` collation.
+   *
+   * Used for cases like `SHOW CREATE TABLE`, where we want to show the exact 
collation of the
+   * columns, because the default collation of the table may change the type 
of the column.
+   */
+  def replaceNonCollatedTypesWithExplicitUTF8Binary(dataType: DataType): 
DataType = {
+    dataType.transformRecursively {
+      case charType: CharType if isDefaultStringCharOrVarcharType(charType) =>
+        CharType(charType.length, CollationFactory.UTF8_BINARY_COLLATION_ID)
+      case varcharType: VarcharType if 
isDefaultStringCharOrVarcharType(varcharType) =>
+        VarcharType(varcharType.length, 
CollationFactory.UTF8_BINARY_COLLATION_ID)
+      case stringType: StringType if 
isDefaultStringCharOrVarcharType(stringType) =>
+        StringType(CollationFactory.UTF8_BINARY_COLLATION_ID)
+    }
+  }
 }
 
diff --git 
a/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala
 
b/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala
index 852e832ded85..1a1b7cd1e24e 100644
--- 
a/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala
+++ 
b/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/PlanGenerationTestSuite.scala
@@ -143,7 +143,7 @@ class PlanGenerationTestSuite extends ConnectFunSuite with 
Logging {
   }
 
   private def test(name: String)(f: => Dataset[_]): Unit = super.test(name) {
-    val actual = trimJvmOriginFields(f.plan.getRoot)
+    val actual = normalizeProtoForComparison(f.plan.getRoot)
     val goldenFile = queryFilePath.resolve(name.replace(' ', '_') + 
".proto.bin")
     Try(readRelation(goldenFile)) match {
       case Success(expected) if expected == actual =>
@@ -195,7 +195,12 @@ class PlanGenerationTestSuite extends ConnectFunSuite with 
Logging {
     }
   }
 
-  private def trimJvmOriginFields[T <: protobuf.Message](message: T): T = {
+  /**
+   * Normalize proto messages for stable comparison:
+   *   - Trim JVM origin fields (lines, stack traces, anonymous function names)
+   *   - Populate default StringType collation when missing (UTF8_BINARY)
+   */
+  private def normalizeProtoForComparison[T <: protobuf.Message](message: T): 
T = {
     def trim(builder: proto.JvmOrigin.Builder): Unit = {
       builder
         .clearLine()
@@ -216,6 +221,17 @@ class PlanGenerationTestSuite extends ConnectFunSuite with 
Logging {
     val builder = message.toBuilder
 
     builder match {
+      // For comparison only, we add UTF8_BINARY when StringType collation is 
missing
+      // to ensure deterministic plan equality across environments.
+      case dt: proto.DataType.Builder if dt.getKindCase == 
proto.DataType.KindCase.STRING =>
+        val sb = dt.getStringBuilder
+        if (sb.getCollation.isEmpty) {
+          val defaultCollationName =
+            CollationFactory
+              .fetchCollation(CollationFactory.UTF8_BINARY_COLLATION_ID)
+              .collationName
+          sb.setCollation(defaultCollationName)
+        }
       case exp: proto.Relation.Builder
           if exp.hasCommon && exp.getCommon.hasOrigin && 
exp.getCommon.getOrigin.hasJvmOrigin =>
         trim(exp.getCommonBuilder.getOriginBuilder.getJvmOriginBuilder)
@@ -227,10 +243,10 @@ class PlanGenerationTestSuite extends ConnectFunSuite 
with Logging {
 
     builder.getAllFields.asScala.foreach {
       case (desc, msg: protobuf.Message) =>
-        builder.setField(desc, trimJvmOriginFields(msg))
+        builder.setField(desc, normalizeProtoForComparison(msg))
       case (desc, list: java.util.List[_]) =>
         val newList = list.asScala.map {
-          case msg: protobuf.Message => trimJvmOriginFields(msg)
+          case msg: protobuf.Message => normalizeProtoForComparison(msg)
           case other => other // Primitive types
         }
         builder.setField(desc, newList.asJava)
diff --git 
a/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/ColumnNodeToProtoConverterSuite.scala
 
b/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/ColumnNodeToProtoConverterSuite.scala
index 389b3a5c52ac..ed2a94bbcef5 100644
--- 
a/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/ColumnNodeToProtoConverterSuite.scala
+++ 
b/sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/connect/ColumnNodeToProtoConverterSuite.scala
@@ -68,12 +68,12 @@ class ColumnNodeToProtoConverterSuite extends 
ConnectFunSuite {
       expr(_.getLiteralBuilder.setString("foo").build()))
     val dataType = new StructType()
       .add("_1", DoubleType)
-      .add("_2", StringType)
+      .add("_2", StringType("UTF8_LCASE"))
       .add("_3", DoubleType)
-      .add("_4", StringType)
+      .add("_4", StringType("UTF8_LCASE"))
     val stringTypeWithCollation = proto.DataType
       .newBuilder()
-      
.setString(proto.DataType.String.newBuilder().setCollation("UTF8_BINARY"))
+      .setString(proto.DataType.String.newBuilder().setCollation("UTF8_LCASE"))
       .build()
     testConversion(
       Literal((12.0, "north", 60.0, "west"), Option(dataType)),
diff --git 
a/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/common/DataTypeProtoConverter.scala
 
b/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/common/DataTypeProtoConverter.scala
index b77bbbe50e55..0500ca478dad 100644
--- 
a/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/common/DataTypeProtoConverter.scala
+++ 
b/sql/connect/common/src/main/scala/org/apache/spark/sql/connect/common/DataTypeProtoConverter.scala
@@ -102,7 +102,7 @@ object DataTypeProtoConverter {
   }
 
   private def toCatalystStringType(t: proto.DataType.String): StringType =
-    StringType(if (t.getCollation.nonEmpty) t.getCollation else "UTF8_BINARY")
+    if (t.getCollation.nonEmpty) StringType(t.getCollation) else StringType
 
   private def toCatalystYearMonthIntervalType(t: 
proto.DataType.YearMonthInterval) = {
     (t.hasStartField, t.hasEndField) match {
@@ -214,13 +214,15 @@ object DataTypeProtoConverter {
 
       // StringType must be matched after CharType and VarcharType
       case s: StringType =>
+        val stringBuilder = proto.DataType.String.newBuilder()
+        // Send collation only for explicit collations (including explicit 
UTF8_BINARY).
+        // Default STRING (case object) has no explicit collation and should 
omit it.
+        if (!s.eq(StringType)) {
+          
stringBuilder.setCollation(CollationFactory.fetchCollation(s.collationId).collationName)
+        }
         proto.DataType
           .newBuilder()
-          .setString(
-            proto.DataType.String
-              .newBuilder()
-              
.setCollation(CollationFactory.fetchCollation(s.collationId).collationName)
-              .build())
+          .setString(stringBuilder.build())
           .build()
 
       case DateType => ProtoDataTypes.DateType
diff --git 
a/sql/connect/common/src/test/resources/query-tests/explain-results/function_typedLit.explain
 
b/sql/connect/common/src/test/resources/query-tests/explain-results/function_typedLit.explain
index 3c878be34143..5a827ca88ee7 100644
--- 
a/sql/connect/common/src/test/resources/query-tests/explain-results/function_typedLit.explain
+++ 
b/sql/connect/common/src/test/resources/query-tests/explain-results/function_typedLit.explain
@@ -1,2 +1,2 @@
-Project [id#0L, id#0L, 1 AS 1#0, null AS NULL#0, true AS true#0, 68 AS 68#0, 
9872 AS 9872#0, -8726532 AS -8726532#0, 7834609328726532 AS 
7834609328726532#0L, 2.718281828459045 AS 2.718281828459045#0, -0.8 AS -0.8#0, 
89.97620 AS 89.97620#0, 89889.7667231 AS 89889.7667231#0, connect! AS 
connect!#0, T AS T#0, ABCDEFGHIJ AS ABCDEFGHIJ#0, 
0x78797A7B7C7D7E7F808182838485868788898A8B8C8D8E AS 
X'78797A7B7C7D7E7F808182838485868788898A8B8C8D8E'#0, 0x0806 AS X'0806'#0, [8,6] 
AS ARRAY(8, 6)#0, null A [...]
+Project [id#0L, id#0L, 1 AS 1#0, null AS NULL#0, true AS true#0, 68 AS 68#0, 
9872 AS 9872#0, -8726532 AS -8726532#0, 7834609328726532 AS 
7834609328726532#0L, 2.718281828459045 AS 2.718281828459045#0, -0.8 AS -0.8#0, 
89.97620 AS 89.97620#0, 89889.7667231 AS 89889.7667231#0, connect! AS 
connect!#0, T AS T#0, ABCDEFGHIJ AS ABCDEFGHIJ#0, 
0x78797A7B7C7D7E7F808182838485868788898A8B8C8D8E AS 
X'78797A7B7C7D7E7F808182838485868788898A8B8C8D8E'#0, 0x0806 AS X'0806'#0, [8,6] 
AS ARRAY(8, 6)#0, null A [...]
 +- LocalRelation <empty>, [id#0L, a#0, b#0]
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
index abb434b838a5..ac74228caae8 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
@@ -35,10 +35,12 @@ import 
org.apache.spark.sql.catalyst.catalog.CatalogTypes.TablePartitionSpec
 import org.apache.spark.sql.catalyst.expressions.Attribute
 import org.apache.spark.sql.catalyst.plans.DescribeCommandSchema
 import org.apache.spark.sql.catalyst.plans.logical._
+import org.apache.spark.sql.catalyst.types.DataTypeUtils
 import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, 
quoteIfNeeded, CaseInsensitiveMap, CharVarcharUtils, DateTimeUtils, 
ResolveDefaultColumns}
 import 
org.apache.spark.sql.catalyst.util.ResolveDefaultColumns.CURRENT_DEFAULT_COLUMN_METADATA_KEY
 import org.apache.spark.sql.classic.ClassicConversions.castToImpl
 import 
org.apache.spark.sql.connector.catalog.CatalogV2Implicits.TableIdentifierHelper
+import org.apache.spark.sql.connector.catalog.TableCatalog
 import org.apache.spark.sql.errors.{QueryCompilationErrors, 
QueryExecutionErrors}
 import org.apache.spark.sql.execution.CommandExecutionMode
 import org.apache.spark.sql.execution.datasources.DataSource
@@ -1078,6 +1080,11 @@ trait ShowCreateTableCommandBase extends SQLConfHelper {
       .foreach(builder.append)
   }
 
+  protected def showTableCollation(metadata: CatalogTable, builder: 
StringBuilder): Unit = {
+    metadata.collation.map(collation => "DEFAULT COLLATION " + collation + 
"\n")
+      .foreach(builder.append)
+  }
+
   protected def showTableProperties(metadata: CatalogTable, builder: 
StringBuilder): Unit = {
     if (metadata.properties.nonEmpty) {
       val props =
@@ -1099,6 +1106,7 @@ trait ShowCreateTableCommandBase extends SQLConfHelper {
   protected def showCreateView(metadata: CatalogTable, builder: 
StringBuilder): Unit = {
     showViewDataColumns(metadata, builder)
     showTableComment(metadata, builder)
+    showTableCollation(metadata, builder)
     showViewProperties(metadata, builder)
     showViewSchemaBinding(metadata, builder)
     showViewText(metadata, builder)
@@ -1121,6 +1129,7 @@ trait ShowCreateTableCommandBase extends SQLConfHelper {
   private def showViewProperties(metadata: CatalogTable, builder: 
StringBuilder): Unit = {
     val viewProps = metadata.properties
       .filter { case (k, _) => !k.startsWith(CatalogTable.VIEW_PREFIX) }
+      .filter { case (k, _) => !k.startsWith(TableCatalog.PROP_COLLATION) }
     if (viewProps.nonEmpty) {
       val props = viewProps.toSeq.sortBy(_._1).map { case (key, value) =>
         s"'${escapeSingleQuotedString(key)}' = 
'${escapeSingleQuotedString(value)}'"
@@ -1235,7 +1244,10 @@ case class ShowCreateTableCommand(
 
   private def showDataSourceTableDataColumns(
       metadata: CatalogTable, builder: StringBuilder): Unit = {
-    val columns = metadata.schema.fields.map(_.toDDL)
+    val rawSchema = CharVarcharUtils.getRawSchema(metadata.schema, conf)
+    val schemaWithExplicitCollations = 
DataTypeUtils.replaceNonCollatedTypesWithExplicitUTF8Binary(
+      rawSchema).asInstanceOf[StructType]
+    val columns = schemaWithExplicitCollations.fields.map(_.toDDL)
     builder ++= concatByMultiLines(columns)
   }
 
@@ -1280,6 +1292,7 @@ case class ShowCreateTableCommand(
     showDataSourceTableOptions(metadata, builder)
     showDataSourceTableNonDataColumns(metadata, builder)
     showTableComment(metadata, builder)
+    showTableCollation(metadata, builder)
     showTableLocation(metadata, builder)
     showTableProperties(metadata, builder)
   }
diff --git 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala
 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala
index 56e786d3e933..d1496bfa4c0c 100644
--- 
a/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala
+++ 
b/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ShowCreateTableExec.scala
@@ -24,10 +24,12 @@ import org.apache.spark.sql.catalyst.InternalRow
 import org.apache.spark.sql.catalyst.analysis.ResolvedTable
 import org.apache.spark.sql.catalyst.catalog.BucketSpec
 import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.catalyst.types.DataTypeUtils
 import org.apache.spark.sql.catalyst.util.{escapeSingleQuotedString, 
CharVarcharUtils}
 import org.apache.spark.sql.connector.catalog.{CatalogV2Util, Table, 
TableCatalog}
 import org.apache.spark.sql.connector.expressions.BucketTransform
 import org.apache.spark.sql.execution.LeafExecNode
+import org.apache.spark.sql.types.StructType
 import org.apache.spark.unsafe.types.UTF8String
 
 /**
@@ -64,7 +66,10 @@ case class ShowCreateTableExec(
 
   private def showTableDataColumns(table: Table, builder: StringBuilder): Unit 
= {
     import org.apache.spark.sql.connector.catalog.CatalogV2Implicits._
-    val columns = CharVarcharUtils.getRawSchema(table.columns.asSchema, 
conf).fields.map(_.toDDL)
+    val rawSchema = CharVarcharUtils.getRawSchema(table.columns.asSchema, conf)
+    val schemaWithExplicitCollations = 
DataTypeUtils.replaceNonCollatedTypesWithExplicitUTF8Binary(
+        rawSchema).asInstanceOf[StructType]
+    val columns = schemaWithExplicitCollations.fields.map(_.toDDL)
     val constraints = table.constraints().map(_.toDDL)
     builder ++= concatByMultiLines(columns ++ constraints)
   }
@@ -159,8 +164,7 @@ case class ShowCreateTableExec(
 
   private def showTableCollation(table: Table, builder: StringBuilder): Unit = 
{
     Option(table.properties.get(TableCatalog.PROP_COLLATION))
-      .map("COLLATION '" + escapeSingleQuotedString(_) + "'\n")
-      .foreach(builder.append)
+      .map("DEFAULT COLLATION " + _ + "\n").foreach(builder.append)
   }
 
   private def concatByMultiLines(iter: Iterable[String]): String = {
diff --git 
a/sql/core/src/test/resources/sql-tests/analyzer-results/collations-basic.sql.out
 
b/sql/core/src/test/resources/sql-tests/analyzer-results/collations-basic.sql.out
index 74320fa4dfc3..2fc24cdfa1ea 100644
--- 
a/sql/core/src/test/resources/sql-tests/analyzer-results/collations-basic.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/analyzer-results/collations-basic.sql.out
@@ -546,7 +546,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -806,7 +806,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -822,7 +822,7 @@ Project [elt(1, collate(utf8_binary#x, utf8_binary), 
collate(utf8_lcase#x, utf8_
 -- !query
 select elt(1, utf8_binary collate utf8_binary, utf8_lcase) from t1
 -- !query analysis
-Project [elt(1, collate(utf8_binary#x, utf8_binary), cast(utf8_lcase#x as 
string), true) AS elt(1, collate(utf8_binary, utf8_binary), utf8_lcase)#x]
+Project [elt(1, collate(utf8_binary#x, utf8_binary), cast(utf8_lcase#x as 
string collate UTF8_BINARY), true) AS elt(1, collate(utf8_binary, utf8_binary), 
utf8_lcase)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -838,7 +838,7 @@ Project [elt(1, utf8_binary#x, word, true) AS elt(1, 
utf8_binary, word)#x, elt(1
 -- !query
 select elt(1, utf8_binary, 'word' collate utf8_lcase), elt(1, utf8_lcase, 
'word' collate utf8_binary) from t1
 -- !query analysis
-Project [elt(1, cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(word, utf8_lcase), true) AS elt(1, utf8_binary, collate(word, 
utf8_lcase))#x, elt(1, cast(utf8_lcase#x as string), collate(word, 
utf8_binary), true) AS elt(1, utf8_lcase, collate(word, utf8_binary))#x]
+Project [elt(1, cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(word, utf8_lcase), true) AS elt(1, utf8_binary, collate(word, 
utf8_lcase))#x, elt(1, cast(utf8_lcase#x as string collate UTF8_BINARY), 
collate(word, utf8_binary), true) AS elt(1, utf8_lcase, collate(word, 
utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -1003,7 +1003,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1035,7 +1035,7 @@ Project [levenshtein(utf8_binary#x, a, None) AS 
levenshtein(utf8_binary, a)#x, l
 -- !query
 select levenshtein(utf8_binary, 'AaAA' collate utf8_lcase, 3), 
levenshtein(utf8_lcase, 'AAa' collate utf8_binary, 4) from t1
 -- !query analysis
-Project [levenshtein(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), Some(3)) AS levenshtein(utf8_binary, collate(AaAA, 
utf8_lcase), 3)#x, levenshtein(cast(utf8_lcase#x as string), collate(AAa, 
utf8_binary), Some(4)) AS levenshtein(utf8_lcase, collate(AAa, utf8_binary), 
4)#x]
+Project [levenshtein(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), Some(3)) AS levenshtein(utf8_binary, collate(AaAA, 
utf8_lcase), 3)#x, levenshtein(cast(utf8_lcase#x as string collate 
UTF8_BINARY), collate(AAa, utf8_binary), Some(4)) AS levenshtein(utf8_lcase, 
collate(AAa, utf8_binary), 4)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
diff --git 
a/sql/core/src/test/resources/sql-tests/analyzer-results/collations-padding-trim.sql.out
 
b/sql/core/src/test/resources/sql-tests/analyzer-results/collations-padding-trim.sql.out
index 626c4e57e14b..966641170e2d 100644
--- 
a/sql/core/src/test/resources/sql-tests/analyzer-results/collations-padding-trim.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/analyzer-results/collations-padding-trim.sql.out
@@ -149,7 +149,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -189,7 +189,7 @@ Project [rpad(utf8_binary#x, 8, a) AS rpad(utf8_binary, 8, 
a)#x, rpad(utf8_lcase
 -- !query
 select rpad(utf8_binary, 8, 'AaAA' collate utf8_lcase), rpad(utf8_lcase, 8, 
'AAa' collate utf8_binary) from t1
 -- !query analysis
-Project [rpad(cast(utf8_binary#x as string collate UTF8_LCASE), 8, 
collate(AaAA, utf8_lcase)) AS rpad(utf8_binary, 8, collate(AaAA, 
utf8_lcase))#x, rpad(cast(utf8_lcase#x as string), 8, collate(AAa, 
utf8_binary)) AS rpad(utf8_lcase, 8, collate(AAa, utf8_binary))#x]
+Project [rpad(cast(utf8_binary#x as string collate UTF8_LCASE), 8, 
collate(AaAA, utf8_lcase)) AS rpad(utf8_binary, 8, collate(AaAA, 
utf8_lcase))#x, rpad(cast(utf8_lcase#x as string collate UTF8_BINARY), 8, 
collate(AAa, utf8_binary)) AS rpad(utf8_lcase, 8, collate(AAa, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -218,7 +218,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -258,7 +258,7 @@ Project [lpad(utf8_binary#x, 8, a) AS lpad(utf8_binary, 8, 
a)#x, lpad(utf8_lcase
 -- !query
 select lpad(utf8_binary, 8, 'AaAA' collate utf8_lcase), lpad(utf8_lcase, 8, 
'AAa' collate utf8_binary) from t1
 -- !query analysis
-Project [lpad(cast(utf8_binary#x as string collate UTF8_LCASE), 8, 
collate(AaAA, utf8_lcase)) AS lpad(utf8_binary, 8, collate(AaAA, 
utf8_lcase))#x, lpad(cast(utf8_lcase#x as string), 8, collate(AAa, 
utf8_binary)) AS lpad(utf8_lcase, 8, collate(AAa, utf8_binary))#x]
+Project [lpad(cast(utf8_binary#x as string collate UTF8_LCASE), 8, 
collate(AaAA, utf8_lcase)) AS lpad(utf8_binary, 8, collate(AaAA, 
utf8_lcase))#x, lpad(cast(utf8_lcase#x as string collate UTF8_BINARY), 8, 
collate(AAa, utf8_binary)) AS lpad(utf8_lcase, 8, collate(AAa, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -299,7 +299,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -363,7 +363,7 @@ Project [trim(utf8_binary#x, Some(ABc)) AS TRIM(BOTH ABc 
FROM utf8_binary)#x, tr
 -- !query
 select TRIM('ABc' collate utf8_lcase, utf8_binary), TRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query analysis
-Project [trim(cast(utf8_binary#x as string collate UTF8_LCASE), 
Some(collate(ABc, utf8_lcase))) AS TRIM(BOTH collate(ABc, utf8_lcase) FROM 
utf8_binary)#x, trim(cast(utf8_lcase#x as string), Some(collate(AAa, 
utf8_binary))) AS TRIM(BOTH collate(AAa, utf8_binary) FROM utf8_lcase)#x]
+Project [trim(cast(utf8_binary#x as string collate UTF8_LCASE), 
Some(collate(ABc, utf8_lcase))) AS TRIM(BOTH collate(ABc, utf8_lcase) FROM 
utf8_binary)#x, trim(cast(utf8_lcase#x as string collate UTF8_BINARY), 
Some(collate(AAa, utf8_binary))) AS TRIM(BOTH collate(AAa, utf8_binary) FROM 
utf8_lcase)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -404,7 +404,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -509,7 +509,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -573,7 +573,7 @@ Project [ltrim(utf8_binary#x, Some(ABc)) AS TRIM(LEADING 
ABc FROM utf8_binary)#x
 -- !query
 select LTRIM('ABc' collate utf8_lcase, utf8_binary), LTRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query analysis
-Project [ltrim(cast(utf8_binary#x as string collate UTF8_LCASE), 
Some(collate(ABc, utf8_lcase))) AS TRIM(LEADING collate(ABc, utf8_lcase) FROM 
utf8_binary)#x, ltrim(cast(utf8_lcase#x as string), Some(collate(AAa, 
utf8_binary))) AS TRIM(LEADING collate(AAa, utf8_binary) FROM utf8_lcase)#x]
+Project [ltrim(cast(utf8_binary#x as string collate UTF8_LCASE), 
Some(collate(ABc, utf8_lcase))) AS TRIM(LEADING collate(ABc, utf8_lcase) FROM 
utf8_binary)#x, ltrim(cast(utf8_lcase#x as string collate UTF8_BINARY), 
Some(collate(AAa, utf8_binary))) AS TRIM(LEADING collate(AAa, utf8_binary) FROM 
utf8_lcase)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -614,7 +614,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -678,7 +678,7 @@ Project [rtrim(utf8_binary#x, Some(ABc)) AS TRIM(TRAILING 
ABc FROM utf8_binary)#
 -- !query
 select RTRIM('ABc' collate utf8_lcase, utf8_binary), RTRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query analysis
-Project [rtrim(cast(utf8_binary#x as string collate UTF8_LCASE), 
Some(collate(ABc, utf8_lcase))) AS TRIM(TRAILING collate(ABc, utf8_lcase) FROM 
utf8_binary)#x, rtrim(cast(utf8_lcase#x as string), Some(collate(AAa, 
utf8_binary))) AS TRIM(TRAILING collate(AAa, utf8_binary) FROM utf8_lcase)#x]
+Project [rtrim(cast(utf8_binary#x as string collate UTF8_LCASE), 
Some(collate(ABc, utf8_lcase))) AS TRIM(TRAILING collate(ABc, utf8_lcase) FROM 
utf8_binary)#x, rtrim(cast(utf8_lcase#x as string collate UTF8_BINARY), 
Some(collate(AAa, utf8_binary))) AS TRIM(TRAILING collate(AAa, utf8_binary) 
FROM utf8_lcase)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
diff --git 
a/sql/core/src/test/resources/sql-tests/analyzer-results/collations-string-functions.sql.out
 
b/sql/core/src/test/resources/sql-tests/analyzer-results/collations-string-functions.sql.out
index f7d2d595a581..5cda6267432d 100644
--- 
a/sql/core/src/test/resources/sql-tests/analyzer-results/collations-string-functions.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/analyzer-results/collations-string-functions.sql.out
@@ -185,7 +185,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -209,7 +209,7 @@ Project [concat_ws(,, utf8_lcase#x, word) AS concat_ws(',' 
collate UTF8_LCASE, u
 -- !query
 select concat_ws(',', utf8_lcase, 'word' collate utf8_binary), concat_ws(',', 
utf8_binary, 'word' collate utf8_lcase) from t1
 -- !query analysis
-Project [concat_ws(,, cast(utf8_lcase#x as string), collate(word, 
utf8_binary)) AS concat_ws(,, utf8_lcase, collate(word, utf8_binary))#x, 
concat_ws(,, cast(utf8_binary#x as string collate UTF8_LCASE), collate(word, 
utf8_lcase)) AS concat_ws(',' collate UTF8_LCASE, utf8_binary, collate(word, 
utf8_lcase))#x]
+Project [concat_ws(,, cast(utf8_lcase#x as string collate UTF8_BINARY), 
collate(word, utf8_binary)) AS concat_ws(,, utf8_lcase, collate(word, 
utf8_binary))#x, concat_ws(,, cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(word, utf8_lcase)) AS concat_ws(',' collate UTF8_LCASE, utf8_binary, 
collate(word, utf8_lcase))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -238,7 +238,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -294,7 +294,7 @@ Project [split_part(utf8_binary#x, a, 3) AS 
split_part(utf8_binary, a, 3)#x, spl
 -- !query
 select split_part(utf8_binary, 'a' collate utf8_lcase, 3), 
split_part(utf8_lcase, 'a' collate utf8_binary, 3) from t1
 -- !query analysis
-Project [split_part(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(a, utf8_lcase), 3) AS split_part(utf8_binary, collate(a, utf8_lcase), 
3)#x, split_part(cast(utf8_lcase#x as string), collate(a, utf8_binary), 3) AS 
split_part(utf8_lcase, collate(a, utf8_binary), 3)#x]
+Project [split_part(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(a, utf8_lcase), 3) AS split_part(utf8_binary, collate(a, utf8_lcase), 
3)#x, split_part(cast(utf8_lcase#x as string collate UTF8_BINARY), collate(a, 
utf8_binary), 3) AS split_part(utf8_lcase, collate(a, utf8_binary), 3)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -302,7 +302,7 @@ Project [split_part(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(a,
 -- !query
 select split_part(utf8_binary, 'a ' collate utf8_lcase_rtrim, 3), 
split_part(utf8_lcase, 'a' collate utf8_binary, 3) from t1
 -- !query analysis
-Project [split_part(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(a , utf8_lcase_rtrim), 3) AS split_part(utf8_binary, collate(a , 
utf8_lcase_rtrim), 3)#x, split_part(cast(utf8_lcase#x as string), collate(a, 
utf8_binary), 3) AS split_part(utf8_lcase, collate(a, utf8_binary), 3)#x]
+Project [split_part(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(a , utf8_lcase_rtrim), 3) AS split_part(utf8_binary, collate(a , 
utf8_lcase_rtrim), 3)#x, split_part(cast(utf8_lcase#x as string collate 
UTF8_BINARY), collate(a, utf8_binary), 3) AS split_part(utf8_lcase, collate(a, 
utf8_binary), 3)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -343,7 +343,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -399,7 +399,7 @@ Project [Contains(utf8_binary#x, a) AS 
contains(utf8_binary, a)#x, Contains(utf8
 -- !query
 select contains(utf8_binary, 'AaAA' collate utf8_lcase), contains(utf8_lcase, 
'AAa' collate utf8_binary) from t1
 -- !query analysis
-Project [Contains(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase)) AS contains(utf8_binary, collate(AaAA, 
utf8_lcase))#x, Contains(cast(utf8_lcase#x as string), collate(AAa, 
utf8_binary)) AS contains(utf8_lcase, collate(AAa, utf8_binary))#x]
+Project [Contains(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase)) AS contains(utf8_binary, collate(AaAA, 
utf8_lcase))#x, Contains(cast(utf8_lcase#x as string collate UTF8_BINARY), 
collate(AAa, utf8_binary)) AS contains(utf8_lcase, collate(AAa, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -448,7 +448,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -504,7 +504,7 @@ Project [substring_index(utf8_binary#x, a, 2) AS 
substring_index(utf8_binary, a,
 -- !query
 select substring_index(utf8_binary, 'AaAA' collate utf8_lcase, 2), 
substring_index(utf8_lcase, 'AAa' collate utf8_binary, 2) from t1
 -- !query analysis
-Project [substring_index(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), 2) AS substring_index(utf8_binary, collate(AaAA, 
utf8_lcase), 2)#x, substring_index(cast(utf8_lcase#x as string), collate(AAa, 
utf8_binary), 2) AS substring_index(utf8_lcase, collate(AAa, utf8_binary), 2)#x]
+Project [substring_index(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), 2) AS substring_index(utf8_binary, collate(AaAA, 
utf8_lcase), 2)#x, substring_index(cast(utf8_lcase#x as string collate 
UTF8_BINARY), collate(AAa, utf8_binary), 2) AS substring_index(utf8_lcase, 
collate(AAa, utf8_binary), 2)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -512,7 +512,7 @@ Project [substring_index(cast(utf8_binary#x as string 
collate UTF8_LCASE), colla
 -- !query
 select substring_index(utf8_binary, 'AaAA ' collate utf8_lcase_rtrim, 2), 
substring_index(utf8_lcase, 'AAa' collate utf8_binary, 2) from t1
 -- !query analysis
-Project [substring_index(cast(utf8_binary#x as string collate 
UTF8_LCASE_RTRIM), collate(AaAA , utf8_lcase_rtrim), 2) AS 
substring_index(utf8_binary, collate(AaAA , utf8_lcase_rtrim), 2)#x, 
substring_index(cast(utf8_lcase#x as string), collate(AAa, utf8_binary), 2) AS 
substring_index(utf8_lcase, collate(AAa, utf8_binary), 2)#x]
+Project [substring_index(cast(utf8_binary#x as string collate 
UTF8_LCASE_RTRIM), collate(AaAA , utf8_lcase_rtrim), 2) AS 
substring_index(utf8_binary, collate(AaAA , utf8_lcase_rtrim), 2)#x, 
substring_index(cast(utf8_lcase#x as string collate UTF8_BINARY), collate(AAa, 
utf8_binary), 2) AS substring_index(utf8_lcase, collate(AAa, utf8_binary), 2)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -553,7 +553,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -609,7 +609,7 @@ Project [instr(utf8_binary#x, a) AS instr(utf8_binary, 
a)#x, instr(utf8_lcase#x,
 -- !query
 select instr(utf8_binary, 'AaAA' collate utf8_lcase), instr(utf8_lcase, 'AAa' 
collate utf8_binary) from t1
 -- !query analysis
-Project [instr(cast(utf8_binary#x as string collate UTF8_LCASE), collate(AaAA, 
utf8_lcase)) AS instr(utf8_binary, collate(AaAA, utf8_lcase))#x, 
instr(cast(utf8_lcase#x as string), collate(AAa, utf8_binary)) AS 
instr(utf8_lcase, collate(AAa, utf8_binary))#x]
+Project [instr(cast(utf8_binary#x as string collate UTF8_LCASE), collate(AaAA, 
utf8_lcase)) AS instr(utf8_binary, collate(AaAA, utf8_lcase))#x, 
instr(cast(utf8_lcase#x as string collate UTF8_BINARY), collate(AAa, 
utf8_binary)) AS instr(utf8_lcase, collate(AAa, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -650,7 +650,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -682,7 +682,7 @@ Project [find_in_set(utf8_binary#x, aaAaaAaA,i̇o) AS 
find_in_set(utf8_binary, a
 -- !query
 select find_in_set(utf8_binary, 'aaAaaAaA,i̇o' collate utf8_lcase), 
find_in_set(utf8_lcase, 'aaAaaAaA,i̇o' collate utf8_binary) from t1
 -- !query analysis
-Project [find_in_set(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA,i̇o, utf8_lcase)) AS find_in_set(utf8_binary, 
collate(aaAaaAaA,i̇o, utf8_lcase))#x, find_in_set(cast(utf8_lcase#x as string), 
collate(aaAaaAaA,i̇o, utf8_binary)) AS find_in_set(utf8_lcase, 
collate(aaAaaAaA,i̇o, utf8_binary))#x]
+Project [find_in_set(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA,i̇o, utf8_lcase)) AS find_in_set(utf8_binary, 
collate(aaAaaAaA,i̇o, utf8_lcase))#x, find_in_set(cast(utf8_lcase#x as string 
collate UTF8_BINARY), collate(aaAaaAaA,i̇o, utf8_binary)) AS 
find_in_set(utf8_lcase, collate(aaAaaAaA,i̇o, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -690,7 +690,7 @@ Project [find_in_set(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(a
 -- !query
 select find_in_set(utf8_binary, 'aaAaaAaA,i̇o ' collate utf8_lcase_rtrim), 
find_in_set(utf8_lcase, 'aaAaaAaA,i̇o' collate utf8_binary) from t1
 -- !query analysis
-Project [find_in_set(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA,i̇o , utf8_lcase_rtrim)) AS find_in_set(utf8_binary, 
collate(aaAaaAaA,i̇o , utf8_lcase_rtrim))#x, find_in_set(cast(utf8_lcase#x as 
string), collate(aaAaaAaA,i̇o, utf8_binary)) AS find_in_set(utf8_lcase, 
collate(aaAaaAaA,i̇o, utf8_binary))#x]
+Project [find_in_set(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA,i̇o , utf8_lcase_rtrim)) AS find_in_set(utf8_binary, 
collate(aaAaaAaA,i̇o , utf8_lcase_rtrim))#x, find_in_set(cast(utf8_lcase#x as 
string collate UTF8_BINARY), collate(aaAaaAaA,i̇o, utf8_binary)) AS 
find_in_set(utf8_lcase, collate(aaAaaAaA,i̇o, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -731,7 +731,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -787,7 +787,7 @@ Project [StartsWith(utf8_binary#x, aaAaaAaA) AS 
startswith(utf8_binary, aaAaaAaA
 -- !query
 select startswith(utf8_binary, 'aaAaaAaA' collate utf8_lcase), 
startswith(utf8_lcase, 'aaAaaAaA' collate utf8_binary) from t1
 -- !query analysis
-Project [StartsWith(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA, utf8_lcase)) AS startswith(utf8_binary, collate(aaAaaAaA, 
utf8_lcase))#x, StartsWith(cast(utf8_lcase#x as string), collate(aaAaaAaA, 
utf8_binary)) AS startswith(utf8_lcase, collate(aaAaaAaA, utf8_binary))#x]
+Project [StartsWith(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA, utf8_lcase)) AS startswith(utf8_binary, collate(aaAaaAaA, 
utf8_lcase))#x, StartsWith(cast(utf8_lcase#x as string collate UTF8_BINARY), 
collate(aaAaaAaA, utf8_binary)) AS startswith(utf8_lcase, collate(aaAaaAaA, 
utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -795,7 +795,7 @@ Project [StartsWith(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(aa
 -- !query
 select startswith(utf8_binary, 'aaAaaAaA ' collate utf8_lcase_rtrim), 
startswith(utf8_lcase, 'aaAaaAaA' collate utf8_binary) from t1
 -- !query analysis
-Project [StartsWith(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA , utf8_lcase_rtrim)) AS startswith(utf8_binary, 
collate(aaAaaAaA , utf8_lcase_rtrim))#x, StartsWith(cast(utf8_lcase#x as 
string), collate(aaAaaAaA, utf8_binary)) AS startswith(utf8_lcase, 
collate(aaAaaAaA, utf8_binary))#x]
+Project [StartsWith(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA , utf8_lcase_rtrim)) AS startswith(utf8_binary, 
collate(aaAaaAaA , utf8_lcase_rtrim))#x, StartsWith(cast(utf8_lcase#x as string 
collate UTF8_BINARY), collate(aaAaaAaA, utf8_binary)) AS startswith(utf8_lcase, 
collate(aaAaaAaA, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -836,7 +836,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -884,7 +884,7 @@ Project [translate(utf8_lcase#x, aaAaaAaA, 12345) AS 
translate(utf8_lcase, 'aaAa
 -- !query
 select translate(utf8_lcase, 'aBc' collate utf8_binary, '12345'), 
translate(utf8_binary, 'aBc' collate utf8_lcase, '12345') from t1
 -- !query analysis
-Project [translate(cast(utf8_lcase#x as string), collate(aBc, utf8_binary), 
12345) AS translate(utf8_lcase, collate(aBc, utf8_binary), 12345)#x, 
translate(cast(utf8_binary#x as string collate UTF8_LCASE), collate(aBc, 
utf8_lcase), 12345) AS translate(utf8_binary, collate(aBc, utf8_lcase), '12345' 
collate UTF8_LCASE)#x]
+Project [translate(cast(utf8_lcase#x as string collate UTF8_BINARY), 
collate(aBc, utf8_binary), 12345) AS translate(utf8_lcase, collate(aBc, 
utf8_binary), 12345)#x, translate(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(aBc, utf8_lcase), 12345) AS translate(utf8_binary, 
collate(aBc, utf8_lcase), '12345' collate UTF8_LCASE)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -933,7 +933,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -989,7 +989,7 @@ Project [replace(utf8_binary#x, aaAaaAaA, abc) AS 
replace(utf8_binary, aaAaaAaA,
 -- !query
 select replace(utf8_binary, 'aaAaaAaA' collate utf8_lcase, 'abc'), 
replace(utf8_lcase, 'aaAaaAaA' collate utf8_binary, 'abc') from t1
 -- !query analysis
-Project [replace(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA, utf8_lcase), abc) AS replace(utf8_binary, collate(aaAaaAaA, 
utf8_lcase), 'abc' collate UTF8_LCASE)#x, replace(cast(utf8_lcase#x as string), 
collate(aaAaaAaA, utf8_binary), abc) AS replace(utf8_lcase, collate(aaAaaAaA, 
utf8_binary), abc)#x]
+Project [replace(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA, utf8_lcase), abc) AS replace(utf8_binary, collate(aaAaaAaA, 
utf8_lcase), 'abc' collate UTF8_LCASE)#x, replace(cast(utf8_lcase#x as string 
collate UTF8_BINARY), collate(aaAaaAaA, utf8_binary), abc) AS 
replace(utf8_lcase, collate(aaAaaAaA, utf8_binary), abc)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -997,7 +997,7 @@ Project [replace(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(aaAaa
 -- !query
 select replace(utf8_binary, 'aaAaaAaA ' collate utf8_lcase_rtrim, 'abc'), 
replace(utf8_lcase, 'aaAaaAaA' collate utf8_binary, 'abc') from t1
 -- !query analysis
-Project [replace(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA , utf8_lcase_rtrim), abc) AS replace(utf8_binary, 
collate(aaAaaAaA , utf8_lcase_rtrim), 'abc' collate UTF8_LCASE_RTRIM)#x, 
replace(cast(utf8_lcase#x as string), collate(aaAaaAaA, utf8_binary), abc) AS 
replace(utf8_lcase, collate(aaAaaAaA, utf8_binary), abc)#x]
+Project [replace(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA , utf8_lcase_rtrim), abc) AS replace(utf8_binary, 
collate(aaAaaAaA , utf8_lcase_rtrim), 'abc' collate UTF8_LCASE_RTRIM)#x, 
replace(cast(utf8_lcase#x as string collate UTF8_BINARY), collate(aaAaaAaA, 
utf8_binary), abc) AS replace(utf8_lcase, collate(aaAaaAaA, utf8_binary), 
abc)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -1038,7 +1038,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1094,7 +1094,7 @@ Project [EndsWith(utf8_binary#x, aaAaaAaA) AS 
endswith(utf8_binary, aaAaaAaA)#x,
 -- !query
 select endswith(utf8_binary, 'aaAaaAaA' collate utf8_lcase), 
endswith(utf8_lcase, 'aaAaaAaA' collate utf8_binary) from t1
 -- !query analysis
-Project [EndsWith(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA, utf8_lcase)) AS endswith(utf8_binary, collate(aaAaaAaA, 
utf8_lcase))#x, EndsWith(cast(utf8_lcase#x as string), collate(aaAaaAaA, 
utf8_binary)) AS endswith(utf8_lcase, collate(aaAaaAaA, utf8_binary))#x]
+Project [EndsWith(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(aaAaaAaA, utf8_lcase)) AS endswith(utf8_binary, collate(aaAaaAaA, 
utf8_lcase))#x, EndsWith(cast(utf8_lcase#x as string collate UTF8_BINARY), 
collate(aaAaaAaA, utf8_binary)) AS endswith(utf8_lcase, collate(aaAaaAaA, 
utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -1102,7 +1102,7 @@ Project [EndsWith(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(aaAa
 -- !query
 select endswith(utf8_binary, 'aaAaaAaA ' collate utf8_lcase_rtrim), 
endswith(utf8_lcase, 'aaAaaAaA' collate utf8_binary) from t1
 -- !query analysis
-Project [EndsWith(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA , utf8_lcase_rtrim)) AS endswith(utf8_binary, collate(aaAaaAaA 
, utf8_lcase_rtrim))#x, EndsWith(cast(utf8_lcase#x as string), 
collate(aaAaaAaA, utf8_binary)) AS endswith(utf8_lcase, collate(aaAaaAaA, 
utf8_binary))#x]
+Project [EndsWith(cast(utf8_binary#x as string collate UTF8_LCASE_RTRIM), 
collate(aaAaaAaA , utf8_lcase_rtrim)) AS endswith(utf8_binary, collate(aaAaaAaA 
, utf8_lcase_rtrim))#x, EndsWith(cast(utf8_lcase#x as string collate 
UTF8_BINARY), collate(aaAaaAaA, utf8_binary)) AS endswith(utf8_lcase, 
collate(aaAaaAaA, utf8_binary))#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -1219,7 +1219,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1251,7 +1251,7 @@ Project [overlay(utf8_binary#x, a, 2, -1) AS 
overlay(utf8_binary, a, 2, -1)#x, o
 -- !query
 select overlay(utf8_binary, 'AaAA' collate utf8_lcase, 2), overlay(utf8_lcase, 
'AAa' collate utf8_binary, 2) from t1
 -- !query analysis
-Project [overlay(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), 2, -1) AS overlay(utf8_binary, collate(AaAA, 
utf8_lcase), 2, -1)#x, overlay(cast(utf8_lcase#x as string), collate(AAa, 
utf8_binary), 2, -1) AS overlay(utf8_lcase, collate(AAa, utf8_binary), 2, -1)#x]
+Project [overlay(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), 2, -1) AS overlay(utf8_binary, collate(AaAA, 
utf8_lcase), 2, -1)#x, overlay(cast(utf8_lcase#x as string collate 
UTF8_BINARY), collate(AAa, utf8_binary), 2, -1) AS overlay(utf8_lcase, 
collate(AAa, utf8_binary), 2, -1)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -1420,7 +1420,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1476,7 +1476,7 @@ Project [locate(utf8_binary#x, a, 1) AS 
locate(utf8_binary, a, 1)#x, locate(utf8
 -- !query
 select locate(utf8_binary, 'AaAA' collate utf8_lcase, 4), locate(utf8_lcase, 
'AAa' collate utf8_binary, 4) from t1
 -- !query analysis
-Project [locate(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), 4) AS locate(utf8_binary, collate(AaAA, utf8_lcase), 
4)#x, locate(cast(utf8_lcase#x as string), collate(AAa, utf8_binary), 4) AS 
locate(utf8_lcase, collate(AAa, utf8_binary), 4)#x]
+Project [locate(cast(utf8_binary#x as string collate UTF8_LCASE), 
collate(AaAA, utf8_lcase), 4) AS locate(utf8_binary, collate(AaAA, utf8_lcase), 
4)#x, locate(cast(utf8_lcase#x as string collate UTF8_BINARY), collate(AAa, 
utf8_binary), 4) AS locate(utf8_lcase, collate(AAa, utf8_binary), 4)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
@@ -1484,7 +1484,7 @@ Project [locate(cast(utf8_binary#x as string collate 
UTF8_LCASE), collate(AaAA,
 -- !query
 select locate(utf8_binary, 'AaAA ' collate utf8_binary_rtrim, 4), 
locate(utf8_lcase, 'AAa ' collate utf8_binary, 4) from t1
 -- !query analysis
-Project [locate(cast(utf8_binary#x as string collate UTF8_BINARY_RTRIM), 
collate(AaAA , utf8_binary_rtrim), 4) AS locate(utf8_binary, collate(AaAA , 
utf8_binary_rtrim), 4)#x, locate(cast(utf8_lcase#x as string), collate(AAa , 
utf8_binary), 4) AS locate(utf8_lcase, collate(AAa , utf8_binary), 4)#x]
+Project [locate(cast(utf8_binary#x as string collate UTF8_BINARY_RTRIM), 
collate(AaAA , utf8_binary_rtrim), 4) AS locate(utf8_binary, collate(AaAA , 
utf8_binary_rtrim), 4)#x, locate(cast(utf8_lcase#x as string collate 
UTF8_BINARY), collate(AAa , utf8_binary), 4) AS locate(utf8_lcase, collate(AAa 
, utf8_binary), 4)#x]
 +- SubqueryAlias spark_catalog.default.t1
    +- Relation spark_catalog.default.t1[s#x,utf8_binary#x,utf8_lcase#x] parquet
 
diff --git 
a/sql/core/src/test/resources/sql-tests/analyzer-results/show-create-table.sql.out
 
b/sql/core/src/test/resources/sql-tests/analyzer-results/show-create-table.sql.out
index b1c3ad59e151..29157ea7bd7d 100644
--- 
a/sql/core/src/test/resources/sql-tests/analyzer-results/show-create-table.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/analyzer-results/show-create-table.sql.out
@@ -281,6 +281,13 @@ CreateViewCommand 
`spark_catalog`.`default`.`view_SPARK_30302`, [(aaa,None), (bb
          +- Relation spark_catalog.default.tbl[a#x,b#x,c#x] parquet
 
 
+-- !query
+DROP TABLE tbl
+-- !query analysis
+DropTable false, false
++- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.tbl
+
+
 -- !query
 SHOW CREATE TABLE view_SPARK_30302 AS SERDE
 -- !query analysis
@@ -299,8 +306,43 @@ DROP VIEW view_SPARK_30302
 DropTableCommand `spark_catalog`.`default`.`view_SPARK_30302`, false, true, 
false
 
 
+-- !query
+CREATE TABLE tbl (c1 STRING, c2 STRING COLLATE UTF8_BINARY, c3 STRING COLLATE 
UNICODE_CI)
+ DEFAULT COLLATION UTF8_LCASE
+-- !query analysis
+CreateDataSourceTableCommand `spark_catalog`.`default`.`tbl`, false
+
+
+-- !query
+SHOW CREATE TABLE tbl
+-- !query analysis
+ShowCreateTable false, [createtab_stmt#x]
++- ResolvedTable V2SessionCatalog(spark_catalog), default.tbl, 
V1Table(default.tbl), [c1#x, c2#x, c3#x]
+
+
 -- !query
 DROP TABLE tbl
 -- !query analysis
 DropTable false, false
 +- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.tbl
+
+
+-- !query
+CREATE VIEW view_SPARK_55372 DEFAULT COLLATION UTF8_LCASE
+AS SELECT 'a' AS c1, 'b' COLLATE UTF8_BINARY AS c2, 'c' COLLATE UNICODE_CI AS 
c3
+-- !query analysis
+CreateViewCommand `spark_catalog`.`default`.`view_SPARK_55372`, UTF8_LCASE, 
SELECT 'a' AS c1, 'b' COLLATE UTF8_BINARY AS c2, 'c' COLLATE UNICODE_CI AS c3, 
false, false, PersistedView, COMPENSATION, true
+   +- Project [a AS c1#x, collate(b, UTF8_BINARY) AS c2#x, collate(c, 
UNICODE_CI) AS c3#x]
+      +- OneRowRelation
+
+
+-- !query
+SHOW CREATE TABLE view_SPARK_55372
+-- !query analysis
+ShowCreateTableCommand `spark_catalog`.`default`.`view_spark_55372`, 
[createtab_stmt#x]
+
+
+-- !query
+DROP VIEW view_SPARK_55372
+-- !query analysis
+DropTableCommand `spark_catalog`.`default`.`view_SPARK_55372`, false, true, 
false
diff --git a/sql/core/src/test/resources/sql-tests/inputs/show-create-table.sql 
b/sql/core/src/test/resources/sql-tests/inputs/show-create-table.sql
index 5192d2dc6b57..728e1fee5006 100644
--- a/sql/core/src/test/resources/sql-tests/inputs/show-create-table.sql
+++ b/sql/core/src/test/resources/sql-tests/inputs/show-create-table.sql
@@ -105,10 +105,22 @@ CREATE VIEW view_SPARK_30302 (aaa, bbb)
 TBLPROPERTIES ('a' = '1', 'b' = '2')
 AS SELECT a, b FROM tbl;
 
+DROP TABLE tbl;
+
 SHOW CREATE TABLE view_SPARK_30302 AS SERDE;
 
 SHOW CREATE TABLE view_SPARK_30302;
 
 DROP VIEW view_SPARK_30302;
 
+-- Table with default collation.
+CREATE TABLE tbl (c1 STRING, c2 STRING COLLATE UTF8_BINARY, c3 STRING COLLATE 
UNICODE_CI)
+ DEFAULT COLLATION UTF8_LCASE;
+SHOW CREATE TABLE tbl;
 DROP TABLE tbl;
+
+-- View with default collation.
+CREATE VIEW view_SPARK_55372 DEFAULT COLLATION UTF8_LCASE
+AS SELECT 'a' AS c1, 'b' COLLATE UTF8_BINARY AS c2, 'c' COLLATE UNICODE_CI AS 
c3;
+SHOW CREATE TABLE view_SPARK_55372;
+DROP VIEW view_SPARK_55372;
diff --git a/sql/core/src/test/resources/sql-tests/results/charvarchar.sql.out 
b/sql/core/src/test/resources/sql-tests/results/charvarchar.sql.out
index 3026e463947f..571d3aa24a23 100644
--- a/sql/core/src/test/resources/sql-tests/results/charvarchar.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/charvarchar.sql.out
@@ -50,8 +50,8 @@ show create table char_tbl
 struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.char_tbl (
-  c CHAR(5),
-  v VARCHAR(6))
+  c CHAR(5) COLLATE UTF8_BINARY,
+  v VARCHAR(6) COLLATE UTF8_BINARY)
 USING parquet
 
 
@@ -69,8 +69,8 @@ show create table char_tbl2
 struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.char_tbl2 (
-  c CHAR(5),
-  v VARCHAR(6))
+  c CHAR(5) COLLATE UTF8_BINARY,
+  v VARCHAR(6) COLLATE UTF8_BINARY)
 USING parquet
 
 
@@ -162,8 +162,8 @@ show create table char_tbl3
 struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.char_tbl3 (
-  c CHAR(5),
-  v VARCHAR(6))
+  c CHAR(5) COLLATE UTF8_BINARY,
+  v VARCHAR(6) COLLATE UTF8_BINARY)
 USING parquet
 
 
diff --git 
a/sql/core/src/test/resources/sql-tests/results/collations-basic.sql.out 
b/sql/core/src/test/resources/sql-tests/results/collations-basic.sql.out
index 4be0c01df3af..14c34f2738fa 100644
--- a/sql/core/src/test/resources/sql-tests/results/collations-basic.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/collations-basic.sql.out
@@ -44,7 +44,7 @@ describe table t1
 -- !query schema
 struct<col_name:string,data_type:string,comment:string>
 -- !query output
-utf8_binary            string                                      
+utf8_binary            string collate UTF8_BINARY                          
 utf8_lcase             string collate UTF8_LCASE
 
 
@@ -71,7 +71,7 @@ struct<count(1):bigint>
 -- !query
 select * from t1 where utf8_binary = 'aaa'
 -- !query schema
-struct<utf8_binary:string,utf8_lcase:string collate UTF8_LCASE>
+struct<utf8_binary:string collate UTF8_BINARY,utf8_lcase:string collate 
UTF8_LCASE>
 -- !query output
 aaa    aaa
 
@@ -79,7 +79,7 @@ aaa   aaa
 -- !query
 select * from t1 where utf8_lcase = 'aaa' collate utf8_lcase
 -- !query schema
-struct<utf8_binary:string,utf8_lcase:string collate UTF8_LCASE>
+struct<utf8_binary:string collate UTF8_BINARY,utf8_lcase:string collate 
UTF8_LCASE>
 -- !query output
 AAA    AAA
 aaa    aaa
@@ -88,7 +88,7 @@ aaa   aaa
 -- !query
 select * from t1 where utf8_binary < 'bbb'
 -- !query schema
-struct<utf8_binary:string,utf8_lcase:string collate UTF8_LCASE>
+struct<utf8_binary:string collate UTF8_BINARY,utf8_lcase:string collate 
UTF8_LCASE>
 -- !query output
 AAA    AAA
 BBB    BBB
@@ -98,7 +98,7 @@ aaa   aaa
 -- !query
 select * from t1 where utf8_lcase < 'bbb' collate utf8_lcase
 -- !query schema
-struct<utf8_binary:string,utf8_lcase:string collate UTF8_LCASE>
+struct<utf8_binary:string collate UTF8_BINARY,utf8_lcase:string collate 
UTF8_LCASE>
 -- !query output
 AAA    AAA
 aaa    aaa
@@ -107,7 +107,7 @@ aaa aaa
 -- !query
 select l.utf8_binary, r.utf8_lcase from t1 l join t1 r on l.utf8_lcase = 
r.utf8_lcase
 -- !query schema
-struct<utf8_binary:string,utf8_lcase:string collate UTF8_LCASE>
+struct<utf8_binary:string collate UTF8_BINARY,utf8_lcase:string collate 
UTF8_LCASE>
 -- !query output
 AAA    AAA
 AAA    aaa
@@ -146,7 +146,7 @@ struct<>
 -- !query
 select * from t1 anti join t2 on t1.utf8_lcase = t2.utf8_lcase
 -- !query schema
-struct<utf8_binary:string,utf8_lcase:string collate UTF8_LCASE>
+struct<utf8_binary:string collate UTF8_BINARY,utf8_lcase:string collate 
UTF8_LCASE>
 -- !query output
 
 
@@ -602,7 +602,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -610,7 +610,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select str_to_map(text collate utf8_binary, pairDelim collate utf8_binary, 
keyValueDelim collate utf8_binary) from t3
 -- !query schema
-struct<str_to_map(collate(text, utf8_binary), collate(pairDelim, utf8_binary), 
collate(keyValueDelim, utf8_binary)):map<string,string>>
+struct<str_to_map(collate(text, utf8_binary), collate(pairDelim, utf8_binary), 
collate(keyValueDelim, utf8_binary)):map<string collate UTF8_BINARY,string 
collate UTF8_BINARY>>
 -- !query output
 {"a":"1","b":"2","c":"3"}
 
@@ -903,7 +903,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -911,7 +911,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select elt(1, utf8_binary collate utf8_binary, utf8_lcase collate utf8_binary) 
from t1
 -- !query schema
-struct<elt(1, collate(utf8_binary, utf8_binary), collate(utf8_lcase, 
utf8_binary)):string>
+struct<elt(1, collate(utf8_binary, utf8_binary), collate(utf8_lcase, 
utf8_binary)):string collate UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.
 Something else. Nothing here.
@@ -933,7 +933,7 @@ kitten
 -- !query
 select elt(1, utf8_binary collate utf8_binary, utf8_lcase) from t1
 -- !query schema
-struct<elt(1, collate(utf8_binary, utf8_binary), utf8_lcase):string>
+struct<elt(1, collate(utf8_binary, utf8_binary), utf8_lcase):string collate 
UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.
 Something else. Nothing here.
@@ -955,7 +955,7 @@ kitten
 -- !query
 select elt(1, utf8_binary, 'word'), elt(1, utf8_lcase, 'word') from t1
 -- !query schema
-struct<elt(1, utf8_binary, word):string,elt(1, utf8_lcase, 'word' collate 
UTF8_LCASE):string collate UTF8_LCASE>
+struct<elt(1, utf8_binary, word):string collate UTF8_BINARY,elt(1, utf8_lcase, 
'word' collate UTF8_LCASE):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -977,7 +977,7 @@ kitten      sitTing
 -- !query
 select elt(1, utf8_binary, 'word' collate utf8_lcase), elt(1, utf8_lcase, 
'word' collate utf8_binary) from t1
 -- !query schema
-struct<elt(1, utf8_binary, collate(word, utf8_lcase)):string collate 
UTF8_LCASE,elt(1, utf8_lcase, collate(word, utf8_binary)):string>
+struct<elt(1, utf8_binary, collate(word, utf8_lcase)):string collate 
UTF8_LCASE,elt(1, utf8_lcase, collate(word, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1359,7 +1359,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1521,7 +1521,7 @@ true      true
 -- !query
 select make_valid_utf8(utf8_binary), make_valid_utf8(utf8_lcase) from t1
 -- !query schema
-struct<make_valid_utf8(utf8_binary):string,make_valid_utf8(utf8_lcase):string 
collate UTF8_LCASE>
+struct<make_valid_utf8(utf8_binary):string collate 
UTF8_BINARY,make_valid_utf8(utf8_lcase):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1543,7 +1543,7 @@ kitten    sitTing
 -- !query
 select make_valid_utf8(utf8_binary collate utf8_lcase), 
make_valid_utf8(utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<make_valid_utf8(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,make_valid_utf8(collate(utf8_lcase, utf8_binary)):string>
+struct<make_valid_utf8(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,make_valid_utf8(collate(utf8_lcase, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1587,7 +1587,7 @@ kitten    sitTing
 -- !query
 select validate_utf8(utf8_binary), validate_utf8(utf8_lcase) from t1
 -- !query schema
-struct<validate_utf8(utf8_binary):string,validate_utf8(utf8_lcase):string 
collate UTF8_LCASE>
+struct<validate_utf8(utf8_binary):string collate 
UTF8_BINARY,validate_utf8(utf8_lcase):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1609,7 +1609,7 @@ kitten    sitTing
 -- !query
 select validate_utf8(utf8_binary collate utf8_lcase), validate_utf8(utf8_lcase 
collate utf8_binary) from t1
 -- !query schema
-struct<validate_utf8(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,validate_utf8(collate(utf8_lcase, utf8_binary)):string>
+struct<validate_utf8(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,validate_utf8(collate(utf8_lcase, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1653,7 +1653,7 @@ kitten    sitTing
 -- !query
 select try_validate_utf8(utf8_binary), try_validate_utf8(utf8_lcase) from t1
 -- !query schema
-struct<try_validate_utf8(utf8_binary):string,try_validate_utf8(utf8_lcase):string
 collate UTF8_LCASE>
+struct<try_validate_utf8(utf8_binary):string collate 
UTF8_BINARY,try_validate_utf8(utf8_lcase):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1675,7 +1675,7 @@ kitten    sitTing
 -- !query
 select try_validate_utf8(utf8_binary collate utf8_lcase), 
try_validate_utf8(utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<try_validate_utf8(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,try_validate_utf8(collate(utf8_lcase, utf8_binary)):string>
+struct<try_validate_utf8(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,try_validate_utf8(collate(utf8_lcase, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
diff --git 
a/sql/core/src/test/resources/sql-tests/results/collations-padding-trim.sql.out 
b/sql/core/src/test/resources/sql-tests/results/collations-padding-trim.sql.out
index d18a011292c4..a6377a8863e1 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/collations-padding-trim.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/collations-padding-trim.sql.out
@@ -181,7 +181,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -189,7 +189,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select rpad(utf8_binary, 8, utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<rpad(utf8_binary, 8, collate(utf8_lcase, utf8_binary)):string>
+struct<rpad(utf8_binary, 8, collate(utf8_lcase, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, w
 Somethin
@@ -255,7 +255,7 @@ sikitten
 -- !query
 select rpad(utf8_binary, 8, 'a'), rpad(utf8_lcase, 8, 'a') from t1
 -- !query schema
-struct<rpad(utf8_binary, 8, a):string,rpad(utf8_lcase, 8, 'a' collate 
UTF8_LCASE):string collate UTF8_LCASE>
+struct<rpad(utf8_binary, 8, a):string collate UTF8_BINARY,rpad(utf8_lcase, 8, 
'a' collate UTF8_LCASE):string collate UTF8_LCASE>
 -- !query output
 Hello, w       Hello, w
 Somethin       Somethin
@@ -277,7 +277,7 @@ kittenaa    sitTinga
 -- !query
 select rpad(utf8_binary, 8, 'AaAA' collate utf8_lcase), rpad(utf8_lcase, 8, 
'AAa' collate utf8_binary) from t1
 -- !query schema
-struct<rpad(utf8_binary, 8, collate(AaAA, utf8_lcase)):string collate 
UTF8_LCASE,rpad(utf8_lcase, 8, collate(AAa, utf8_binary)):string>
+struct<rpad(utf8_binary, 8, collate(AaAA, utf8_lcase)):string collate 
UTF8_LCASE,rpad(utf8_lcase, 8, collate(AAa, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, w       Hello, w
 Somethin       Somethin
@@ -350,7 +350,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -358,7 +358,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select lpad(utf8_binary, 8, utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<lpad(utf8_binary, 8, collate(utf8_lcase, utf8_binary)):string>
+struct<lpad(utf8_binary, 8, collate(utf8_lcase, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 Hello, w
 SQLSpark
@@ -424,7 +424,7 @@ sikitten
 -- !query
 select lpad(utf8_binary, 8, 'a'), lpad(utf8_lcase, 8, 'a') from t1
 -- !query schema
-struct<lpad(utf8_binary, 8, a):string,lpad(utf8_lcase, 8, 'a' collate 
UTF8_LCASE):string collate UTF8_LCASE>
+struct<lpad(utf8_binary, 8, a):string collate UTF8_BINARY,lpad(utf8_lcase, 8, 
'a' collate UTF8_LCASE):string collate UTF8_LCASE>
 -- !query output
 Hello, w       Hello, w
 Somethin       Somethin
@@ -446,7 +446,7 @@ bbAbAAbA    aaaaaaaa
 -- !query
 select lpad(utf8_binary, 8, 'AaAA' collate utf8_lcase), lpad(utf8_lcase, 8, 
'AAa' collate utf8_binary) from t1
 -- !query schema
-struct<lpad(utf8_binary, 8, collate(AaAA, utf8_lcase)):string collate 
UTF8_LCASE,lpad(utf8_lcase, 8, collate(AAa, utf8_binary)):string>
+struct<lpad(utf8_binary, 8, collate(AaAA, utf8_lcase)):string collate 
UTF8_LCASE,lpad(utf8_lcase, 8, collate(AAa, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 AaAAAabc       AAaAAabc
 AaAAAaİo       AAaAAaİo
@@ -490,7 +490,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select TRIM(s, utf8_binary) from t1
 -- !query schema
-struct<TRIM(BOTH s FROM utf8_binary):string>
+struct<TRIM(BOTH s FROM utf8_binary):string collate UTF8_BINARY>
 -- !query output
 
 
@@ -505,7 +505,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -513,7 +513,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select TRIM(utf8_binary, utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<TRIM(BOTH utf8_binary FROM collate(utf8_lcase, utf8_binary)):string>
+struct<TRIM(BOTH utf8_binary FROM collate(utf8_lcase, utf8_binary)):string 
collate UTF8_BINARY>
 -- !query output
 
 
@@ -605,7 +605,7 @@ sitTing
 -- !query
 select TRIM('ABc', utf8_binary), TRIM('ABc', utf8_lcase) from t1
 -- !query schema
-struct<TRIM(BOTH ABc FROM utf8_binary):string,TRIM(BOTH 'ABc' collate 
UTF8_LCASE FROM utf8_lcase):string collate UTF8_LCASE>
+struct<TRIM(BOTH ABc FROM utf8_binary):string collate UTF8_BINARY,TRIM(BOTH 
'ABc' collate UTF8_LCASE FROM utf8_lcase):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -627,7 +627,7 @@ kitten      sitTing
 -- !query
 select TRIM('ABc' collate utf8_lcase, utf8_binary), TRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query schema
-struct<TRIM(BOTH collate(ABc, utf8_lcase) FROM utf8_binary):string collate 
UTF8_LCASE,TRIM(BOTH collate(AAa, utf8_binary) FROM utf8_lcase):string>
+struct<TRIM(BOTH collate(ABc, utf8_lcase) FROM utf8_binary):string collate 
UTF8_LCASE,TRIM(BOTH collate(AAa, utf8_binary) FROM utf8_lcase):string collate 
UTF8_BINARY>
 -- !query output
        
        
@@ -700,7 +700,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -708,7 +708,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select BTRIM(utf8_binary, utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<btrim(utf8_binary, collate(utf8_lcase, utf8_binary)):string>
+struct<btrim(utf8_binary, collate(utf8_lcase, utf8_binary)):string collate 
UTF8_BINARY>
 -- !query output
 
 
@@ -822,7 +822,7 @@ Bc  Bc
 -- !query
 select BTRIM('ABc' collate utf8_lcase, utf8_binary), BTRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query schema
-struct<btrim(collate(ABc, utf8_lcase), utf8_binary):string collate 
UTF8_LCASE,btrim(collate(AAa, utf8_binary), utf8_lcase):string>
+struct<btrim(collate(ABc, utf8_lcase), utf8_binary):string collate 
UTF8_LCASE,btrim(collate(AAa, utf8_binary), utf8_lcase):string collate 
UTF8_BINARY>
 -- !query output
        
        AA
@@ -866,7 +866,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select LTRIM(s, utf8_binary) from t1
 -- !query schema
-struct<TRIM(LEADING s FROM utf8_binary):string>
+struct<TRIM(LEADING s FROM utf8_binary):string collate UTF8_BINARY>
 -- !query output
 
 
@@ -881,7 +881,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -889,7 +889,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select LTRIM(utf8_binary, utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<TRIM(LEADING utf8_binary FROM collate(utf8_lcase, utf8_binary)):string>
+struct<TRIM(LEADING utf8_binary FROM collate(utf8_lcase, utf8_binary)):string 
collate UTF8_BINARY>
 -- !query output
 
 
@@ -981,7 +981,7 @@ sitTing
 -- !query
 select LTRIM('ABc', utf8_binary), LTRIM('ABc', utf8_lcase) from t1
 -- !query schema
-struct<TRIM(LEADING ABc FROM utf8_binary):string,TRIM(LEADING 'ABc' collate 
UTF8_LCASE FROM utf8_lcase):string collate UTF8_LCASE>
+struct<TRIM(LEADING ABc FROM utf8_binary):string collate 
UTF8_BINARY,TRIM(LEADING 'ABc' collate UTF8_LCASE FROM utf8_lcase):string 
collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1003,7 +1003,7 @@ kitten    sitTing
 -- !query
 select LTRIM('ABc' collate utf8_lcase, utf8_binary), LTRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query schema
-struct<TRIM(LEADING collate(ABc, utf8_lcase) FROM utf8_binary):string collate 
UTF8_LCASE,TRIM(LEADING collate(AAa, utf8_binary) FROM utf8_lcase):string>
+struct<TRIM(LEADING collate(ABc, utf8_lcase) FROM utf8_binary):string collate 
UTF8_LCASE,TRIM(LEADING collate(AAa, utf8_binary) FROM utf8_lcase):string 
collate UTF8_BINARY>
 -- !query output
        
        
@@ -1047,7 +1047,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select RTRIM(s, utf8_binary) from t1
 -- !query schema
-struct<TRIM(TRAILING s FROM utf8_binary):string>
+struct<TRIM(TRAILING s FROM utf8_binary):string collate UTF8_BINARY>
 -- !query output
 
 
@@ -1076,7 +1076,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -1084,7 +1084,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select RTRIM(utf8_binary, utf8_lcase collate utf8_binary) from t1
 -- !query schema
-struct<TRIM(TRAILING utf8_binary FROM collate(utf8_lcase, utf8_binary)):string>
+struct<TRIM(TRAILING utf8_binary FROM collate(utf8_lcase, utf8_binary)):string 
collate UTF8_BINARY>
 -- !query output
 
 
@@ -1176,7 +1176,7 @@ sitTing
 -- !query
 select RTRIM('ABc', utf8_binary), RTRIM('ABc', utf8_lcase) from t1
 -- !query schema
-struct<TRIM(TRAILING ABc FROM utf8_binary):string,TRIM(TRAILING 'ABc' collate 
UTF8_LCASE FROM utf8_lcase):string collate UTF8_LCASE>
+struct<TRIM(TRAILING ABc FROM utf8_binary):string collate 
UTF8_BINARY,TRIM(TRAILING 'ABc' collate UTF8_LCASE FROM utf8_lcase):string 
collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1198,7 +1198,7 @@ kitten    sitTing
 -- !query
 select RTRIM('ABc' collate utf8_lcase, utf8_binary), RTRIM('AAa' collate 
utf8_binary, utf8_lcase) from t1
 -- !query schema
-struct<TRIM(TRAILING collate(ABc, utf8_lcase) FROM utf8_binary):string collate 
UTF8_LCASE,TRIM(TRAILING collate(AAa, utf8_binary) FROM utf8_lcase):string>
+struct<TRIM(TRAILING collate(ABc, utf8_lcase) FROM utf8_binary):string collate 
UTF8_LCASE,TRIM(TRAILING collate(AAa, utf8_binary) FROM utf8_lcase):string 
collate UTF8_BINARY>
 -- !query output
        
        
diff --git 
a/sql/core/src/test/resources/sql-tests/results/collations-string-functions.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/collations-string-functions.sql.out
index ed4f6b500ae6..11ace58ee210 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/collations-string-functions.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/collations-string-functions.sql.out
@@ -221,7 +221,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -336,7 +336,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -344,7 +344,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select split_part(utf8_binary, utf8_lcase collate utf8_binary, 2) from t1
 -- !query schema
-struct<split_part(utf8_binary, collate(utf8_lcase, utf8_binary), 2):string>
+struct<split_part(utf8_binary, collate(utf8_lcase, utf8_binary), 2):string 
collate UTF8_BINARY>
 -- !query output
 
 
@@ -400,7 +400,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
 -- !query
 select split_part(utf8_binary, 'a', 3), split_part(utf8_lcase, 'a', 3) from t1
 -- !query schema
-struct<split_part(utf8_binary, a, 3):string,split_part(utf8_lcase, 'a' collate 
UTF8_LCASE, 3):string collate UTF8_LCASE>
+struct<split_part(utf8_binary, a, 3):string collate 
UTF8_BINARY,split_part(utf8_lcase, 'a' collate UTF8_LCASE, 3):string collate 
UTF8_LCASE>
 -- !query output
        
        
@@ -422,7 +422,7 @@ A
 -- !query
 select split_part(utf8_binary, 'a' collate utf8_lcase, 3), 
split_part(utf8_lcase, 'a' collate utf8_binary, 3) from t1
 -- !query schema
-struct<split_part(utf8_binary, collate(a, utf8_lcase), 3):string collate 
UTF8_LCASE,split_part(utf8_lcase, collate(a, utf8_binary), 3):string>
+struct<split_part(utf8_binary, collate(a, utf8_lcase), 3):string collate 
UTF8_LCASE,split_part(utf8_lcase, collate(a, utf8_binary), 3):string collate 
UTF8_BINARY>
 -- !query output
        
        
@@ -444,7 +444,7 @@ struct<split_part(utf8_binary, collate(a, utf8_lcase), 
3):string collate UTF8_LC
 -- !query
 select split_part(utf8_binary, 'a ' collate utf8_lcase_rtrim, 3), 
split_part(utf8_lcase, 'a' collate utf8_binary, 3) from t1
 -- !query schema
-struct<split_part(utf8_binary, collate(a , utf8_lcase_rtrim), 3):string 
collate UTF8_LCASE_RTRIM,split_part(utf8_lcase, collate(a, utf8_binary), 
3):string>
+struct<split_part(utf8_binary, collate(a , utf8_lcase_rtrim), 3):string 
collate UTF8_LCASE_RTRIM,split_part(utf8_lcase, collate(a, utf8_binary), 
3):string collate UTF8_BINARY>
 -- !query output
        
        
@@ -517,7 +517,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -712,7 +712,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -720,7 +720,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select substring_index(utf8_binary, utf8_lcase collate utf8_binary, 2) from t1
 -- !query schema
-struct<substring_index(utf8_binary, collate(utf8_lcase, utf8_binary), 
2):string>
+struct<substring_index(utf8_binary, collate(utf8_lcase, utf8_binary), 
2):string collate UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.
 Something else. Nothing here.
@@ -790,7 +790,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
 -- !query
 select substring_index(utf8_binary, 'a', 2), substring_index(utf8_lcase, 'a', 
2) from t1
 -- !query schema
-struct<substring_index(utf8_binary, a, 2):string,substring_index(utf8_lcase, 
'a' collate UTF8_LCASE, 2):string collate UTF8_LCASE>
+struct<substring_index(utf8_binary, a, 2):string collate 
UTF8_BINARY,substring_index(utf8_lcase, 'a' collate UTF8_LCASE, 2):string 
collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -812,7 +812,7 @@ kitten      sitTing
 -- !query
 select substring_index(utf8_binary, 'AaAA' collate utf8_lcase, 2), 
substring_index(utf8_lcase, 'AAa' collate utf8_binary, 2) from t1
 -- !query schema
-struct<substring_index(utf8_binary, collate(AaAA, utf8_lcase), 2):string 
collate UTF8_LCASE,substring_index(utf8_lcase, collate(AAa, utf8_binary), 
2):string>
+struct<substring_index(utf8_binary, collate(AaAA, utf8_lcase), 2):string 
collate UTF8_LCASE,substring_index(utf8_lcase, collate(AAa, utf8_binary), 
2):string collate UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -834,7 +834,7 @@ kitten      sitTing
 -- !query
 select substring_index(utf8_binary, 'AaAA ' collate utf8_lcase_rtrim, 2), 
substring_index(utf8_lcase, 'AAa' collate utf8_binary, 2) from t1
 -- !query schema
-struct<substring_index(utf8_binary, collate(AaAA , utf8_lcase_rtrim), 
2):string collate UTF8_LCASE_RTRIM,substring_index(utf8_lcase, collate(AAa, 
utf8_binary), 2):string>
+struct<substring_index(utf8_binary, collate(AaAA , utf8_lcase_rtrim), 
2):string collate UTF8_LCASE_RTRIM,substring_index(utf8_lcase, collate(AAa, 
utf8_binary), 2):string collate UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -907,7 +907,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1080,7 +1080,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1249,7 +1249,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1444,7 +1444,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_LCASE\", \"STRING COLLATE 
UTF8_BINARY\""
   }
 }
 
@@ -1500,7 +1500,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
 -- !query
 select translate(utf8_lcase, 'aaAaaAaA', '12345'), translate(utf8_binary, 
'aaAaaAaA', '12345') from t1
 -- !query schema
-struct<translate(utf8_lcase, 'aaAaaAaA' collate UTF8_LCASE, '12345' collate 
UTF8_LCASE):string collate UTF8_LCASE,translate(utf8_binary, aaAaaAaA, 
12345):string>
+struct<translate(utf8_lcase, 'aaAaaAaA' collate UTF8_LCASE, '12345' collate 
UTF8_LCASE):string collate UTF8_LCASE,translate(utf8_binary, aaAaaAaA, 
12345):string collate UTF8_BINARY>
 -- !query output
 1      bb3b33b3
 11111111       11313313
@@ -1522,7 +1522,7 @@ sitTing   kitten
 -- !query
 select translate(utf8_lcase, 'aBc' collate utf8_binary, '12345'), 
translate(utf8_binary, 'aBc' collate utf8_lcase, '12345') from t1
 -- !query schema
-struct<translate(utf8_lcase, collate(aBc, utf8_binary), 
12345):string,translate(utf8_binary, collate(aBc, utf8_lcase), '12345' collate 
UTF8_LCASE):string collate UTF8_LCASE>
+struct<translate(utf8_lcase, collate(aBc, utf8_binary), 12345):string collate 
UTF8_BINARY,translate(utf8_binary, collate(aBc, utf8_lcase), '12345' collate 
UTF8_LCASE):string collate UTF8_LCASE>
 -- !query output
 1      22121121
 11A11A1A       11111111
@@ -1617,7 +1617,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1625,7 +1625,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select replace(utf8_binary, utf8_lcase collate utf8_binary, 'abc') from t1
 -- !query schema
-struct<replace(utf8_binary, collate(utf8_lcase, utf8_binary), abc):string>
+struct<replace(utf8_binary, collate(utf8_lcase, utf8_binary), abc):string 
collate UTF8_BINARY>
 -- !query output
 Spark
 aaAaAAaA
@@ -1695,7 +1695,7 @@ org.apache.spark.sql.catalyst.ExtendedAnalysisException
 -- !query
 select replace(utf8_binary, 'aaAaaAaA', 'abc'), replace(utf8_lcase, 
'aaAaaAaA', 'abc') from t1
 -- !query schema
-struct<replace(utf8_binary, aaAaaAaA, abc):string,replace(utf8_lcase, 
'aaAaaAaA' collate UTF8_LCASE, 'abc' collate UTF8_LCASE):string collate 
UTF8_LCASE>
+struct<replace(utf8_binary, aaAaaAaA, abc):string collate 
UTF8_BINARY,replace(utf8_lcase, 'aaAaaAaA' collate UTF8_LCASE, 'abc' collate 
UTF8_LCASE):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1717,7 +1717,7 @@ kitten    sitTing
 -- !query
 select replace(utf8_binary, 'aaAaaAaA' collate utf8_lcase, 'abc'), 
replace(utf8_lcase, 'aaAaaAaA' collate utf8_binary, 'abc') from t1
 -- !query schema
-struct<replace(utf8_binary, collate(aaAaaAaA, utf8_lcase), 'abc' collate 
UTF8_LCASE):string collate UTF8_LCASE,replace(utf8_lcase, collate(aaAaaAaA, 
utf8_binary), abc):string>
+struct<replace(utf8_binary, collate(aaAaaAaA, utf8_lcase), 'abc' collate 
UTF8_LCASE):string collate UTF8_LCASE,replace(utf8_lcase, collate(aaAaaAaA, 
utf8_binary), abc):string collate UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1739,7 +1739,7 @@ kitten    sitTing
 -- !query
 select replace(utf8_binary, 'aaAaaAaA ' collate utf8_lcase_rtrim, 'abc'), 
replace(utf8_lcase, 'aaAaaAaA' collate utf8_binary, 'abc') from t1
 -- !query schema
-struct<replace(utf8_binary, collate(aaAaaAaA , utf8_lcase_rtrim), 'abc' 
collate UTF8_LCASE_RTRIM):string collate UTF8_LCASE_RTRIM,replace(utf8_lcase, 
collate(aaAaaAaA, utf8_binary), abc):string>
+struct<replace(utf8_binary, collate(aaAaaAaA , utf8_lcase_rtrim), 'abc' 
collate UTF8_LCASE_RTRIM):string collate UTF8_LCASE_RTRIM,replace(utf8_lcase, 
collate(aaAaaAaA, utf8_binary), abc):string collate UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.        Hello, world! Nice day.
 Something else. Nothing here.  Something else. Nothing here.
@@ -1812,7 +1812,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -1956,7 +1956,7 @@ true      true
 -- !query
 select repeat(utf8_binary, 3), repeat(utf8_lcase, 2) from t1
 -- !query schema
-struct<repeat(utf8_binary, 3):string,repeat(utf8_lcase, 2):string collate 
UTF8_LCASE>
+struct<repeat(utf8_binary, 3):string collate UTF8_BINARY,repeat(utf8_lcase, 
2):string collate UTF8_LCASE>
 -- !query output
 Hello, world! Nice day.Hello, world! Nice day.Hello, world! Nice day.  Hello, 
world! Nice day.Hello, world! Nice day.
 Something else. Nothing here.Something else. Nothing here.Something else. 
Nothing here.        Something else. Nothing here.Something else. Nothing here.
@@ -1978,7 +1978,7 @@ kittenkittenkitten        sitTingsitTing
 -- !query
 select repeat(utf8_binary collate utf8_lcase, 3), repeat(utf8_lcase collate 
utf8_binary, 2) from t1
 -- !query schema
-struct<repeat(collate(utf8_binary, utf8_lcase), 3):string collate 
UTF8_LCASE,repeat(collate(utf8_lcase, utf8_binary), 2):string>
+struct<repeat(collate(utf8_binary, utf8_lcase), 3):string collate 
UTF8_LCASE,repeat(collate(utf8_lcase, utf8_binary), 2):string collate 
UTF8_BINARY>
 -- !query output
 Hello, world! Nice day.Hello, world! Nice day.Hello, world! Nice day.  Hello, 
world! Nice day.Hello, world! Nice day.
 Something else. Nothing here.Something else. Nothing here.Something else. 
Nothing here.        Something else. Nothing here.Something else. Nothing here.
@@ -2009,7 +2009,7 @@ a
 -- !query
 select sentences(utf8_binary), sentences(utf8_lcase) from t1
 -- !query schema
-struct<sentences(utf8_binary, , ):array<array<string>>,sentences(utf8_lcase, , 
):array<array<string collate UTF8_LCASE>>>
+struct<sentences(utf8_binary, , ):array<array<string collate 
UTF8_BINARY>>,sentences(utf8_lcase, , ):array<array<string collate UTF8_LCASE>>>
 -- !query output
 [["Hello","world"],["Nice","day"]]     [["Hello","world"],["Nice","day"]]
 [["Something","else"],["Nothing","here"]]      
[["Something","else"],["Nothing","here"]]
@@ -2031,7 +2031,7 @@ struct<sentences(utf8_binary, , 
):array<array<string>>,sentences(utf8_lcase, , )
 -- !query
 select sentences(utf8_binary collate utf8_lcase), sentences(utf8_lcase collate 
utf8_binary) from t1
 -- !query schema
-struct<sentences(collate(utf8_binary, utf8_lcase), , ):array<array<string 
collate UTF8_LCASE>>,sentences(collate(utf8_lcase, utf8_binary), , 
):array<array<string>>>
+struct<sentences(collate(utf8_binary, utf8_lcase), , ):array<array<string 
collate UTF8_LCASE>>,sentences(collate(utf8_lcase, utf8_binary), , 
):array<array<string collate UTF8_BINARY>>>
 -- !query output
 [["Hello","world"],["Nice","day"]]     [["Hello","world"],["Nice","day"]]
 [["Something","else"],["Nothing","here"]]      
[["Something","else"],["Nothing","here"]]
@@ -2053,7 +2053,7 @@ struct<sentences(collate(utf8_binary, utf8_lcase), , 
):array<array<string collat
 -- !query
 select upper(utf8_binary), upper(utf8_lcase) from t1
 -- !query schema
-struct<upper(utf8_binary):string,upper(utf8_lcase):string collate UTF8_LCASE>
+struct<upper(utf8_binary):string collate UTF8_BINARY,upper(utf8_lcase):string 
collate UTF8_LCASE>
 -- !query output
 AAAAAAAA       AAAAAAAA
 AAAAAAAA       AAAAAAAA
@@ -2075,7 +2075,7 @@ SPARK     SQL
 -- !query
 select upper(utf8_binary collate utf8_lcase), upper(utf8_lcase collate 
utf8_binary) from t1
 -- !query schema
-struct<upper(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,upper(collate(utf8_lcase, utf8_binary)):string>
+struct<upper(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,upper(collate(utf8_lcase, utf8_binary)):string collate UTF8_BINARY>
 -- !query output
 AAAAAAAA       AAAAAAAA
 AAAAAAAA       AAAAAAAA
@@ -2097,7 +2097,7 @@ SPARK     SQL
 -- !query
 select lower(utf8_binary), lower(utf8_lcase) from t1
 -- !query schema
-struct<lower(utf8_binary):string,lower(utf8_lcase):string collate UTF8_LCASE>
+struct<lower(utf8_binary):string collate UTF8_BINARY,lower(utf8_lcase):string 
collate UTF8_LCASE>
 -- !query output
 aaaaaaaa       aaaaaaaa
 aaaaaaaa       aaaaaaaa
@@ -2119,7 +2119,7 @@ spark     sql
 -- !query
 select lower(utf8_binary collate utf8_lcase), lower(utf8_lcase collate 
utf8_binary) from t1
 -- !query schema
-struct<lower(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,lower(collate(utf8_lcase, utf8_binary)):string>
+struct<lower(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,lower(collate(utf8_lcase, utf8_binary)):string collate UTF8_BINARY>
 -- !query output
 aaaaaaaa       aaaaaaaa
 aaaaaaaa       aaaaaaaa
@@ -2141,7 +2141,7 @@ spark     sql
 -- !query
 select initcap(utf8_binary), initcap(utf8_lcase) from t1
 -- !query schema
-struct<initcap(utf8_binary):string,initcap(utf8_lcase):string collate 
UTF8_LCASE>
+struct<initcap(utf8_binary):string collate 
UTF8_BINARY,initcap(utf8_lcase):string collate UTF8_LCASE>
 -- !query output
 Aaaaaaaa       Aaaaaaaa
 Aaaaaaaa       Aaaaaaaa
@@ -2163,7 +2163,7 @@ Spark     Sql
 -- !query
 select initcap(utf8_binary collate utf8_lcase), initcap(utf8_lcase collate 
utf8_binary) from t1
 -- !query schema
-struct<initcap(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,initcap(collate(utf8_lcase, utf8_binary)):string>
+struct<initcap(collate(utf8_binary, utf8_lcase)):string collate 
UTF8_LCASE,initcap(collate(utf8_lcase, utf8_binary)):string collate UTF8_BINARY>
 -- !query output
 Aaaaaaaa       Aaaaaaaa
 Aaaaaaaa       Aaaaaaaa
@@ -2236,7 +2236,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
@@ -2244,7 +2244,7 @@ org.apache.spark.sql.AnalysisException
 -- !query
 select overlay(utf8_binary, utf8_lcase collate utf8_binary, 2) from t1
 -- !query schema
-struct<overlay(utf8_binary, collate(utf8_lcase, utf8_binary), 2, -1):string>
+struct<overlay(utf8_binary, collate(utf8_lcase, utf8_binary), 2, -1):string 
collate UTF8_BINARY>
 -- !query output
 HHello, world! Nice day.
 SSQLk
@@ -2288,7 +2288,7 @@ ksitTing
 -- !query
 select overlay(utf8_binary, 'a', 2), overlay(utf8_lcase, 'a', 2) from t1
 -- !query schema
-struct<overlay(utf8_binary, a, 2, -1):string,overlay(utf8_lcase, 'a' collate 
UTF8_LCASE, 2, -1):string collate UTF8_LCASE>
+struct<overlay(utf8_binary, a, 2, -1):string collate 
UTF8_BINARY,overlay(utf8_lcase, 'a' collate UTF8_LCASE, 2, -1):string collate 
UTF8_LCASE>
 -- !query output
 Hallo, world! Nice day.        Hallo, world! Nice day.
 Saark  SaL
@@ -2310,7 +2310,7 @@ katten    satTing
 -- !query
 select overlay(utf8_binary, 'AaAA' collate utf8_lcase, 2), overlay(utf8_lcase, 
'AAa' collate utf8_binary, 2) from t1
 -- !query schema
-struct<overlay(utf8_binary, collate(AaAA, utf8_lcase), 2, -1):string collate 
UTF8_LCASE,overlay(utf8_lcase, collate(AAa, utf8_binary), 2, -1):string>
+struct<overlay(utf8_binary, collate(AaAA, utf8_lcase), 2, -1):string collate 
UTF8_LCASE,overlay(utf8_lcase, collate(AAa, utf8_binary), 2, -1):string collate 
UTF8_BINARY>
 -- !query output
 HAaAA, world! Nice day.        HAAao, world! Nice day.
 SAaAA  SAAa
@@ -2332,7 +2332,7 @@ kAaAAn    sAAaing
 -- !query
 select format_string(format, utf8_binary, utf8_lcase) from t3
 -- !query schema
-struct<format_string(format, utf8_binary, utf8_lcase):string>
+struct<format_string(format, utf8_binary, utf8_lcase):string collate 
UTF8_BINARY>
 -- !query output
 abCdEabCdE
 
@@ -2340,7 +2340,7 @@ abCdEabCdE
 -- !query
 select format_string(format collate utf8_lcase, utf8_lcase, utf8_binary 
collate utf8_lcase, 3), format_string(format, utf8_lcase collate utf8_binary, 
utf8_binary) from t3
 -- !query schema
-struct<format_string(collate(format, utf8_lcase), utf8_lcase, 
collate(utf8_binary, utf8_lcase), 3):string collate 
UTF8_LCASE,format_string(format, collate(utf8_lcase, utf8_binary), 
utf8_binary):string>
+struct<format_string(collate(format, utf8_lcase), utf8_lcase, 
collate(utf8_binary, utf8_lcase), 3):string collate 
UTF8_LCASE,format_string(format, collate(utf8_lcase, utf8_binary), 
utf8_binary):string collate UTF8_BINARY>
 -- !query output
 abCdEabCdE     abCdEabCdE
 
@@ -2348,7 +2348,7 @@ abCdEabCdE        abCdEabCdE
 -- !query
 select format_string(format, utf8_binary, utf8_lcase) from t3
 -- !query schema
-struct<format_string(format, utf8_binary, utf8_lcase):string>
+struct<format_string(format, utf8_binary, utf8_lcase):string collate 
UTF8_BINARY>
 -- !query output
 abCdEabCdE
 
@@ -2510,7 +2510,7 @@ struct<octet_length(collate(utf8_binary, 
utf8_lcase_rtrim)):int,octet_length(col
 -- !query
 select substr(utf8_binary, 2, 2), substr(utf8_lcase, 2, 2) from t1
 -- !query schema
-struct<substr(utf8_binary, 2, 2):string,substr(utf8_lcase, 2, 2):string 
collate UTF8_LCASE>
+struct<substr(utf8_binary, 2, 2):string collate UTF8_BINARY,substr(utf8_lcase, 
2, 2):string collate UTF8_LCASE>
 -- !query output
 aA     aA
 aA     aA
@@ -2532,7 +2532,7 @@ pa        QL
 -- !query
 select substr(utf8_binary collate utf8_lcase, 2, 2), substr(utf8_lcase collate 
utf8_binary, 2, 2) from t1
 -- !query schema
-struct<substr(collate(utf8_binary, utf8_lcase), 2, 2):string collate 
UTF8_LCASE,substr(collate(utf8_lcase, utf8_binary), 2, 2):string>
+struct<substr(collate(utf8_binary, utf8_lcase), 2, 2):string collate 
UTF8_LCASE,substr(collate(utf8_lcase, utf8_binary), 2, 2):string collate 
UTF8_BINARY>
 -- !query output
 aA     aA
 aA     aA
@@ -2554,7 +2554,7 @@ pa        QL
 -- !query
 select right(utf8_binary, 2), right(utf8_lcase, 2) from t1
 -- !query schema
-struct<right(utf8_binary, 2):string,right(utf8_lcase, 2):string collate 
UTF8_LCASE>
+struct<right(utf8_binary, 2):string collate UTF8_BINARY,right(utf8_lcase, 
2):string collate UTF8_LCASE>
 -- !query output
 aA     aA
 aA     aA
@@ -2576,7 +2576,7 @@ y.        y.
 -- !query
 select right(utf8_binary collate utf8_lcase, 2), right(utf8_lcase collate 
utf8_binary, 2) from t1
 -- !query schema
-struct<right(collate(utf8_binary, utf8_lcase), 2):string collate 
UTF8_LCASE,right(collate(utf8_lcase, utf8_binary), 2):string>
+struct<right(collate(utf8_binary, utf8_lcase), 2):string collate 
UTF8_LCASE,right(collate(utf8_lcase, utf8_binary), 2):string collate 
UTF8_BINARY>
 -- !query output
 aA     aA
 aA     aA
@@ -2598,7 +2598,7 @@ y.        y.
 -- !query
 select left(utf8_binary, '2' collate utf8_lcase), left(utf8_lcase, 2) from t1
 -- !query schema
-struct<left(utf8_binary, collate(2, utf8_lcase)):string,left(utf8_lcase, 
2):string collate UTF8_LCASE>
+struct<left(utf8_binary, collate(2, utf8_lcase)):string collate 
UTF8_BINARY,left(utf8_lcase, 2):string collate UTF8_LCASE>
 -- !query output
 He     He
 So     So
@@ -2620,7 +2620,7 @@ ki        si
 -- !query
 select left(utf8_binary collate utf8_lcase, 2), left(utf8_lcase collate 
utf8_binary, 2) from t1
 -- !query schema
-struct<left(collate(utf8_binary, utf8_lcase), 2):string collate 
UTF8_LCASE,left(collate(utf8_lcase, utf8_binary), 2):string>
+struct<left(collate(utf8_binary, utf8_lcase), 2):string collate 
UTF8_LCASE,left(collate(utf8_lcase, utf8_binary), 2):string collate UTF8_BINARY>
 -- !query output
 He     He
 So     So
@@ -2693,7 +2693,7 @@ org.apache.spark.sql.AnalysisException
   "errorClass" : "COLLATION_MISMATCH.EXPLICIT",
   "sqlState" : "42P21",
   "messageParameters" : {
-    "explicitTypes" : "\"STRING\", \"STRING COLLATE UTF8_LCASE\""
+    "explicitTypes" : "\"STRING COLLATE UTF8_BINARY\", \"STRING COLLATE 
UTF8_LCASE\""
   }
 }
 
diff --git 
a/sql/core/src/test/resources/sql-tests/results/identifier-clause-legacy.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/identifier-clause-legacy.sql.out
index 13a4b43fd058..ff28515d2aa0 100644
--- 
a/sql/core/src/test/resources/sql-tests/results/identifier-clause-legacy.sql.out
+++ 
b/sql/core/src/test/resources/sql-tests/results/identifier-clause-legacy.sql.out
@@ -1875,7 +1875,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.identifier_clause_test_schema.test_show (
   c1 INT,
-  c2 STRING)
+  c2 STRING COLLATE UTF8_BINARY)
 USING CSV
 
 
diff --git 
a/sql/core/src/test/resources/sql-tests/results/identifier-clause.sql.out 
b/sql/core/src/test/resources/sql-tests/results/identifier-clause.sql.out
index beeb3b13fe1e..8465500e5140 100644
--- a/sql/core/src/test/resources/sql-tests/results/identifier-clause.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/identifier-clause.sql.out
@@ -1747,7 +1747,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.identifier_clause_test_schema.test_show (
   c1 INT,
-  c2 STRING)
+  c2 STRING COLLATE UTF8_BINARY)
 USING CSV
 
 
diff --git 
a/sql/core/src/test/resources/sql-tests/results/show-create-table.sql.out 
b/sql/core/src/test/resources/sql-tests/results/show-create-table.sql.out
index c5e05411b6db..87907ee6e856 100644
--- a/sql/core/src/test/resources/sql-tests/results/show-create-table.sql.out
+++ b/sql/core/src/test/resources/sql-tests/results/show-create-table.sql.out
@@ -14,7 +14,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 
@@ -43,7 +43,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 OPTIONS (
@@ -75,7 +75,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 LOCATION 'file:/path/to/table'
@@ -105,7 +105,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 LOCATION 'file:/path/to/table'
@@ -134,7 +134,7 @@ SHOW CREATE TABLE tbl
 struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT,
   a INT)
 USING parquet
@@ -165,7 +165,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 CLUSTERED BY (a)
@@ -197,7 +197,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT DEFAULT 42,
-  b STRING DEFAULT 'abc, def',
+  b STRING COLLATE UTF8_BINARY DEFAULT 'abc, def',
   c INT DEFAULT 42)
 USING parquet
 COMMENT 'This is a comment'
@@ -227,7 +227,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 COMMENT 'This is a comment'
@@ -257,7 +257,7 @@ struct<createtab_stmt:string>
 -- !query output
 CREATE TABLE spark_catalog.default.tbl (
   a INT,
-  b STRING,
+  b STRING COLLATE UTF8_BINARY,
   c INT)
 USING parquet
 TBLPROPERTIES (
@@ -405,6 +405,14 @@ struct<>
 
 
 
+-- !query
+DROP TABLE tbl
+-- !query schema
+struct<>
+-- !query output
+
+
+
 -- !query
 SHOW CREATE TABLE view_SPARK_30302 AS SERDE
 -- !query schema
@@ -443,9 +451,62 @@ struct<>
 
 
 
+-- !query
+CREATE TABLE tbl (c1 STRING, c2 STRING COLLATE UTF8_BINARY, c3 STRING COLLATE 
UNICODE_CI)
+ DEFAULT COLLATION UTF8_LCASE
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CREATE TABLE tbl
+-- !query schema
+struct<createtab_stmt:string>
+-- !query output
+CREATE TABLE spark_catalog.default.tbl (
+  c1 STRING COLLATE UTF8_LCASE,
+  c2 STRING COLLATE UTF8_BINARY,
+  c3 STRING COLLATE UNICODE_CI)
+USING parquet
+DEFAULT COLLATION UTF8_LCASE
+
+
 -- !query
 DROP TABLE tbl
 -- !query schema
 struct<>
 -- !query output
 
+
+
+-- !query
+CREATE VIEW view_SPARK_55372 DEFAULT COLLATION UTF8_LCASE
+AS SELECT 'a' AS c1, 'b' COLLATE UTF8_BINARY AS c2, 'c' COLLATE UNICODE_CI AS 
c3
+-- !query schema
+struct<>
+-- !query output
+
+
+
+-- !query
+SHOW CREATE TABLE view_SPARK_55372
+-- !query schema
+struct<createtab_stmt:string>
+-- !query output
+CREATE VIEW default.view_spark_55372 (
+  c1,
+  c2,
+  c3)
+DEFAULT COLLATION UTF8_LCASE
+WITH SCHEMA COMPENSATION
+AS SELECT 'a' AS c1, 'b' COLLATE UTF8_BINARY AS c2, 'c' COLLATE UNICODE_CI AS 
c3
+
+
+-- !query
+DROP VIEW view_SPARK_55372
+-- !query schema
+struct<>
+-- !query output
+
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSQLRegexpSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSQLRegexpSuite.scala
index c05ee529b529..4b8cb6fc9ba2 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSQLRegexpSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSQLRegexpSuite.scala
@@ -431,7 +431,7 @@ class CollationSQLRegexpSuite
       },
       condition = "COLLATION_MISMATCH.EXPLICIT",
       parameters = Map(
-        "explicitTypes" -> """"STRING", "STRING COLLATE UTF8_LCASE""""
+        "explicitTypes" -> """"STRING COLLATE UTF8_BINARY", "STRING COLLATE 
UTF8_LCASE""""
       )
     )
     // Unsupported collations
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSuite.scala 
b/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSuite.scala
index c84647066f25..ce1f96203b69 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/collation/CollationSuite.scala
@@ -689,7 +689,7 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
         },
         condition = "COLLATION_MISMATCH.EXPLICIT",
         parameters = Map(
-          "explicitTypes" -> """"STRING", "STRING COLLATE UNICODE""""
+          "explicitTypes" -> """"STRING COLLATE UTF8_BINARY", "STRING COLLATE 
UNICODE""""
         )
       )
 
@@ -701,7 +701,7 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
         },
         condition = "COLLATION_MISMATCH.EXPLICIT",
         parameters = Map(
-          "explicitTypes" -> """"STRING", "STRING COLLATE UNICODE""""
+          "explicitTypes" -> """"STRING COLLATE UTF8_BINARY", "STRING COLLATE 
UNICODE""""
         )
       )
       checkError(
@@ -711,7 +711,7 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
         },
         condition = "COLLATION_MISMATCH.EXPLICIT",
         parameters = Map(
-          "explicitTypes" -> """"STRING COLLATE UNICODE", "STRING""""
+          "explicitTypes" -> """"STRING COLLATE UNICODE", "STRING COLLATE 
UTF8_BINARY""""
         )
       )
 
@@ -723,7 +723,7 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
         },
         condition = "COLLATION_MISMATCH.EXPLICIT",
         parameters = Map(
-          "explicitTypes" -> """"STRING", "STRING COLLATE UNICODE""""
+          "explicitTypes" -> """"STRING COLLATE UTF8_BINARY", "STRING COLLATE 
UNICODE""""
         )
       )
 
@@ -1426,9 +1426,6 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
             sql(s"insert into $tableName values (map('aaa', 'AAA'), 1)")
             sql(s"insert into $tableName values (map('BBb', 'bBB'), 2)")
 
-            // `collationSetupError` is created because "COLLATE UTF8_BINARY" 
is omitted in data
-            // type in checkError
-            val collationSetupError = if (collation != "UTF8_BINARY") 
collationSetup else ""
             val query = s"select c from $tableName order by m"
             val ctx = "m"
             checkError(
@@ -1436,7 +1433,7 @@ class CollationSuite extends DatasourceV2SQLBase with 
AdaptiveSparkPlanHelper {
               condition = "DATATYPE_MISMATCH.INVALID_ORDERING_TYPE",
               parameters = Map(
                 "functionName" -> "`sortorder`",
-                "dataType" -> s"\"MAP<STRING$collationSetupError, 
STRING$collationSetupError>\"",
+                "dataType" -> s"\"MAP<STRING$collationSetup, 
STRING$collationSetup>\"",
                 "sqlExpr" -> "\"m ASC NULLS FIRST\""
               ),
               context = ExpectedContext(
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowCreateTableSuiteBase.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowCreateTableSuiteBase.scala
index 7bc076561f44..e796909e30d5 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowCreateTableSuiteBase.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/ShowCreateTableSuiteBase.scala
@@ -75,8 +75,8 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
       )
       val showDDL = getShowCreateDDL(t)
       assert(showDDL(0) == s"CREATE TABLE $fullName (")
-      assert(showDDL(1) == "a STRING,")
-      assert(showDDL(2) == "b STRING,")
+      assert(showDDL(1) == "a STRING COLLATE UTF8_BINARY,")
+      assert(showDDL(2) == "b STRING COLLATE UTF8_BINARY,")
       assert(showDDL(3) == "`extra col` ARRAY<INT>,")
       assert(showDDL(4) == "`<another>` STRUCT<x: INT, y: ARRAY<BOOLEAN>>)")
       assert(showDDL(5) == "USING json")
@@ -95,7 +95,7 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
         """.stripMargin)
       val showDDL = getShowCreateDDL(t)
       assert(showDDL(0) == s"CREATE TABLE $fullName (")
-      assert(showDDL(1) == "a STRUCT<b: STRING>)")
+      assert(showDDL(1) == "a STRUCT<b: STRING COLLATE UTF8_BINARY>)")
       assert(showDDL(2) == "USING json")
     }
   }
@@ -119,7 +119,7 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
            |)
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a STRING) USING json" +
+      val expected = s"CREATE TABLE $fullName ( a STRING COLLATE UTF8_BINARY) 
USING json" +
         " OPTIONS ( 'k1' = 'v1', 'k2' = 'v2', 'k3' = 'v3', 'k4' = 'v4', 'k5' = 
'v5')" +
         " TBLPROPERTIES ( 'a' = '2', 'b' = '1')"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
@@ -134,7 +134,7 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
            |AS SELECT 1 AS a, "foo" AS b
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING) USING json"
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY) USING json"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
   }
@@ -148,7 +148,8 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
            |AS SELECT 1 AS a, "foo" AS b
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING) USING json 
PARTITIONED BY (b)"
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY) USING json" +
+        s" PARTITIONED BY (b)"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
   }
@@ -162,8 +163,8 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
            |AS SELECT 1 AS a, "foo" AS b, 2.5 AS c
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING, c 
DECIMAL(2,1)) USING json" +
-        s" COMMENT 'This is a comment'"
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY," +
+        s" c DECIMAL(2,1)) USING json COMMENT 'This is a comment'"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
   }
@@ -177,8 +178,8 @@ trait ShowCreateTableSuiteBase extends QueryTest with 
DDLCommandTestUtils {
            |AS SELECT 1 AS a, "foo" AS b, 2.5 AS c
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING, c 
DECIMAL(2,1)) USING json" +
-        s" TBLPROPERTIES ( 'a' = '1')"
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY," +
+        s" c DECIMAL(2,1)) USING json TBLPROPERTIES ( 'a' = '1')"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
   }
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowCreateTableSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowCreateTableSuite.scala
index afbb943bf91f..e65bf1c72bb6 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowCreateTableSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v1/ShowCreateTableSuite.scala
@@ -93,7 +93,7 @@ trait ShowCreateTableSuiteBase extends 
command.ShowCreateTableSuiteBase
            |AS SELECT 1 AS a, "foo" AS b
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING) USING json" +
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY) USING json" +
         s" CLUSTERED BY (a) INTO 2 BUCKETS"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
@@ -108,7 +108,7 @@ trait ShowCreateTableSuiteBase extends 
command.ShowCreateTableSuiteBase
            |AS SELECT 1 AS a, "foo" AS b
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING) USING json" +
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY) USING json" +
         s" CLUSTERED BY (a) SORTED BY (b) INTO 2 BUCKETS"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
@@ -124,8 +124,8 @@ trait ShowCreateTableSuiteBase extends 
command.ShowCreateTableSuiteBase
            |AS SELECT 1 AS a, "foo" AS b, 2.5 AS c
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING, c 
DECIMAL(2,1)) USING json" +
-        s" PARTITIONED BY (c) CLUSTERED BY (a) INTO 2 BUCKETS"
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY," +
+        s" c DECIMAL(2,1)) USING json PARTITIONED BY (c) CLUSTERED BY (a) INTO 
2 BUCKETS"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
   }
@@ -140,8 +140,9 @@ trait ShowCreateTableSuiteBase extends 
command.ShowCreateTableSuiteBase
            |AS SELECT 1 AS a, "foo" AS b, 2.5 AS c
          """.stripMargin
       )
-      val expected = s"CREATE TABLE $fullName ( a INT, b STRING, c 
DECIMAL(2,1)) USING json" +
-        s" PARTITIONED BY (c) CLUSTERED BY (a) SORTED BY (b) INTO 2 BUCKETS"
+      val expected = s"CREATE TABLE $fullName ( a INT, b STRING COLLATE 
UTF8_BINARY," +
+        s" c DECIMAL(2,1)) USING json PARTITIONED BY (c) CLUSTERED BY (a) 
SORTED BY (b)" +
+        s" INTO 2 BUCKETS"
       assert(getShowCreateDDL(t).mkString(" ") == expected)
     }
   }
@@ -186,7 +187,7 @@ trait ShowCreateTableSuiteBase extends 
command.ShowCreateTableSuiteBase
         s"CREATE TABLE $fullName (",
         "a BIGINT,",
         "b BIGINT DEFAULT 42,",
-        "c STRING DEFAULT 'abc, \"def\"' COMMENT 'comment')",
+        "c STRING COLLATE UTF8_BINARY DEFAULT 'abc, \"def\"' COMMENT 
'comment')",
         "USING parquet",
         "COMMENT 'This is a comment'"
       ))
diff --git 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowCreateTableSuite.scala
 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowCreateTableSuite.scala
index a9b33584efc4..1ffe78171282 100644
--- 
a/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowCreateTableSuite.scala
+++ 
b/sql/core/src/test/scala/org/apache/spark/sql/execution/command/v2/ShowCreateTableSuite.scala
@@ -52,7 +52,7 @@ class ShowCreateTableSuite extends 
command.ShowCreateTableSuiteBase with Command
       assert(showDDL === Array(
         s"CREATE TABLE $t (",
         "a INT,",
-        "b STRING)",
+        "b STRING COLLATE UTF8_BINARY)",
         defaultUsing,
         "PARTITIONED BY (a)",
         "COMMENT 'This is a comment'",
@@ -135,7 +135,7 @@ class ShowCreateTableSuite extends 
command.ShowCreateTableSuiteBase with Command
       assert(showDDL === Array(
         s"CREATE TABLE $t (",
         "a INT,",
-        "b STRING,",
+        "b STRING COLLATE UTF8_BINARY,",
         "ts TIMESTAMP)",
         defaultUsing,
         "PARTITIONED BY (a, years(ts), months(ts), days(ts), hours(ts))",
@@ -174,7 +174,8 @@ class ShowCreateTableSuite extends 
command.ShowCreateTableSuiteBase with Command
       assert(
         showDDL === Array(
           s"CREATE TABLE $fullName (",
-          "a STRUCT<b: BIGINT COMMENT 'comment', c: STRUCT<d: STRING NOT NULL, 
e: STRING>>)",
+          "a STRUCT<b: BIGINT COMMENT 'comment'," +
+            " c: STRUCT<d: STRING COLLATE UTF8_BINARY NOT NULL, e: STRING 
COLLATE UTF8_BINARY>>)",
           "USING parquet",
           "COMMENT 'This is a comment'"
         )
@@ -210,8 +211,8 @@ class ShowCreateTableSuite extends 
command.ShowCreateTableSuiteBase with Command
         val expectedDDLPrefix = Array(
           s"CREATE TABLE $nonPartitionCatalog.ns.tbl (",
           "a INT NOT NULL,",
-          "b STRING,",
-          "c STRING,",
+          "b STRING COLLATE UTF8_BINARY,",
+          "c STRING COLLATE UTF8_BINARY,",
           "CONSTRAINT tbl_pk PRIMARY KEY (a) NOT ENFORCED NORELY,",
           "CONSTRAINT uk_b UNIQUE (b) NOT ENFORCED NORELY,",
           s"CONSTRAINT fk_c FOREIGN KEY (c) REFERENCES $otherTable (id) NOT 
ENFORCED RELY,",


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

Reply via email to