Github user maropu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21240#discussion_r186659654
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
 ---
    @@ -702,6 +703,20 @@ object TypeCoercion {
         }
       }
     
    +  /**
    +   * Coerces first argument in ReplicateRows expression and introduces a 
cast to Long
    +   * if necessary.
    +   */
    +  object ReplicateRowsCoercion extends TypeCoercionRule {
    +    private val acceptedTypes = Seq(IntegerType, ShortType, ByteType)
    +    override def coerceTypes(plan: LogicalPlan): LogicalPlan = plan 
transformAllExpressions {
    +      case s @ ReplicateRows(children) if s.children.nonEmpty && 
s.childrenResolved &&
    --- End diff --
    
    `children` is not used. How about this?
    ```
          case s @ ReplicateRows(children) if children.nonEmpty && 
s.childrenResolved &&
              acceptedTypes.contains(children.head.dataType) =>
            ReplicateRows(Cast(children.head, LongType) +: children.tail)
    ```


---

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

Reply via email to