Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14353#discussion_r72185594
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/complexTypeCreator.scala
 ---
    @@ -33,13 +33,24 @@ case class CreateArray(children: Seq[Expression]) 
extends Expression {
     
       override def foldable: Boolean = children.forall(_.foldable)
     
    -  override def checkInputDataTypes(): TypeCheckResult =
    -    TypeUtils.checkForSameTypeInputExpr(children.map(_.dataType), 
"function array")
    +  override def checkInputDataTypes(): TypeCheckResult = {
    +    if (children.map(_.dataType).forall(_.isInstanceOf[DecimalType])) {
    +      TypeCheckResult.TypeCheckSuccess
    --- End diff --
    
    ```scala
    scala> sql("create table d1(a DECIMAL(3,2))")
    scala> sql("create table d2(a DECIMAL(2,1))")
    scala> sql("insert into d1 values(1.0)")
    scala> sql("insert into d2 values(1.0)")
    scala> sql("select * from d1, d2").show()
    +----+---+
    |   a|  a|
    +----+---+
    |1.00|1.0|
    +----+---+
    
    scala> sql("select array(d1.a,d2.a),array(d2.a,d1.a),* from d1, d2")
    res5: org.apache.spark.sql.DataFrame = [array(a, a): array<decimal(3,2)>, 
array(a, a): array<decimal(3,2)> ... 2 more fields]
    
    scala> sql("select array(d1.a,d2.a),array(d2.a,d1.a),* from d1, d2").show()
    +------------+------------+----+---+
    | array(a, a)| array(a, a)|   a|  a|
    +------------+------------+----+---+
    |[1.00, 1.00]|[1.00, 1.00]|1.00|1.0|
    +------------+------------+----+---+
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to