Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19977#discussion_r158326164
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala
 ---
    @@ -48,17 +48,37 @@ import org.apache.spark.unsafe.types.{ByteArray, 
UTF8String}
           > SELECT _FUNC_('Spark', 'SQL');
            SparkSQL
       """)
    -case class Concat(children: Seq[Expression]) extends Expression with 
ImplicitCastInputTypes {
    +case class Concat(children: Seq[Expression]) extends Expression {
     
    -  override def inputTypes: Seq[AbstractDataType] = 
Seq.fill(children.size)(StringType)
    -  override def dataType: DataType = StringType
    +  private lazy val isBinaryMode: Boolean = dataType == BinaryType
    +
    +  override def checkInputDataTypes(): TypeCheckResult = {
    +    if (children.isEmpty) {
    +      TypeCheckResult.TypeCheckSuccess
    +    } else {
    +      val childTypes = children.map(_.dataType)
    +      if (childTypes.exists(tpe => !Seq(StringType, 
BinaryType).contains(tpe))) {
    --- End diff --
    
    this is not corrected, `concat` should have all binary children or all 
string children, instead of having each child to be string or binary.


---

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

Reply via email to