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


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collationExpressions.scala:
##########
@@ -151,12 +151,15 @@ case class ResolvedCollation(collationName: String) 
extends LeafExpression with
   group = "string_funcs")
 // scalastyle:on line.contains.tab
 case class Collation(child: Expression)
-  extends UnaryExpression with RuntimeReplaceable with ExpectsInputTypes {
+  extends UnaryExpression
+  with RuntimeReplaceable
+  with ExpectsInputTypes
+  with DefaultStringProducingExpression {
   override protected def withNewChildInternal(newChild: Expression): Collation 
= copy(newChild)
   override lazy val replacement: Expression = {
     val collationId = child.dataType.asInstanceOf[StringType].collationId
     val fullyQualifiedCollationName = 
CollationFactory.fullyQualifiedName(collationId)
-    Literal.create(fullyQualifiedCollationName, SQLConf.get.defaultStringType)
+    Literal.create(fullyQualifiedCollationName, dataType)

Review Comment:
   In scala if multiple traits have the same method defined the one that was 
defined last in the class definition will take precedence, so yes it will take 
`dataType`  from `DefaultStringProducingExpression `.



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

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

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


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

Reply via email to