You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by rednaxelafx <gi...@git.apache.org> on 2018/05/18 21:54:46 UTC

[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

GitHub user rednaxelafx opened a pull request:

    https://github.com/apache/spark/pull/21367

    [SPARK-24321][SQL] Extract common code from Divide/Remainder to a base trait

    ## What changes were proposed in this pull request?
    
    Extract common code from `Divide`/`Remainder` to a new base trait, `DivModLike`.
    
    Further refactoring to make `Pmod` work with `DivModLike` is to be done as a separate task.
    
    ## How was this patch tested?
    
    Existing tests in `ArithmeticExpressionSuite` covers the functionality.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/rednaxelafx/apache-spark catalyst-divmod

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/21367.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #21367
    
----
commit 026531c70bfb7e06f8586010fc48a8666ff4df04
Author: Kris Mok <kr...@...>
Date:   2018-05-18T21:50:50Z

    SPARK-24321: Extract common code from Divide/Remainder to a base trait

----


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/90812/
    Test PASSed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/3444/
    Test PASSed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    thanks, merging to master!


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/90940/
    Test PASSed.


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21367#discussion_r189446823
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala ---
    @@ -297,13 +279,39 @@ case class Divide(left: Expression, right: Expression) extends BinaryArithmetic
               if (${eval1.isNull}) {
                 ${ev.isNull} = true;
               } else {
    -            ${ev.value} = $divide;
    +            ${ev.value} = $operation;
               }
             }""")
         }
       }
     }
     
    +// scalastyle:off line.size.limit
    +@ExpressionDescription(
    +  usage = "expr1 _FUNC_ expr2 - Returns `expr1`/`expr2`. It always performs floating point division.",
    +  examples = """
    +    Examples:
    +      > SELECT 3 _FUNC_ 2;
    +       1.5
    +      > SELECT 2L _FUNC_ 2L;
    +       1.0
    +  """)
    +// scalastyle:on line.size.limit
    +case class Divide(left: Expression, right: Expression) extends DivModLike {
    +
    +  override def inputType: AbstractDataType = TypeCollection(DoubleType, DecimalType)
    +
    +  override def symbol: String = "/"
    +  override def decimalMethod: String = "$div"
    +  override def nullable: Boolean = true
    --- End diff --
    
    redundant?


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/90938/
    Test FAILed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by rednaxelafx <gi...@git.apache.org>.
Github user rednaxelafx commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Updated PR, addressed @cloud-fan and @viirya 's comments.


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21367#discussion_r189428530
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala ---
    @@ -313,81 +321,26 @@ case class Divide(left: Expression, right: Expression) extends BinaryArithmetic
           > SELECT MOD(2, 1.8);
            0.2
       """)
    -case class Remainder(left: Expression, right: Expression) extends BinaryArithmetic {
    +case class Remainder(left: Expression, right: Expression) extends DivModLike {
     
       override def inputType: AbstractDataType = NumericType
     
       override def symbol: String = "%"
       override def decimalMethod: String = "remainder"
    -  override def nullable: Boolean = true
     
       private lazy val integral = dataType match {
         case i: IntegralType => i.integral.asInstanceOf[Integral[Any]]
         case i: FractionalType => i.asIntegral.asInstanceOf[Integral[Any]]
       }
     
       override def eval(input: InternalRow): Any = {
    -    val input2 = right.eval(input)
    -    if (input2 == null || input2 == 0) {
    -      null
    -    } else {
    -      val input1 = left.eval(input)
    -      if (input1 == null) {
    -        null
    -      } else {
    -        input1 match {
    -          case d: Double => d % input2.asInstanceOf[java.lang.Double]
    -          case f: Float => f % input2.asInstanceOf[java.lang.Float]
    -          case _ => integral.rem(input1, input2)
    -        }
    +    evalHelper(input, (input1, input2) => {
    --- End diff --
    
    and here can be
    ```
    private lazy val mod: (Any, Any) => Any = dataType match {
      case i: IntegralType =>
        val integral = i.integral.asInstanceOf[Integral[Any]]
        (input1, input2) => integral.rem(input1, input2)
    
      case FloatType =>
        (input1, input2) => input1.asInstanceOf[java.lang.Float] % input2..asInstanceOf[java.lang.Float]
    
      case DoubleType =>
          (input1, input2) => input1.asInstanceOf[java.lang.Double] % input2..asInstanceOf[java.lang.Double]
    }
    
    override def evalInternal(input1: Any, input2: Any) = mod(input1, input2)
    ```


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    **[Test build #90938 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/90938/testReport)** for PR 21367 at commit [`951b5bd`](https://github.com/apache/spark/commit/951b5bd073015a187cc78e5be1bd70f241fb952c).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    **[Test build #90940 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/90940/testReport)** for PR 21367 at commit [`951b5bd`](https://github.com/apache/spark/commit/951b5bd073015a187cc78e5be1bd70f241fb952c).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/3446/
    Test PASSed.


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21367#discussion_r189428463
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala ---
    @@ -297,13 +279,39 @@ case class Divide(left: Expression, right: Expression) extends BinaryArithmetic
               if (${eval1.isNull}) {
                 ${ev.isNull} = true;
               } else {
    -            ${ev.value} = $divide;
    +            ${ev.value} = $operation;
               }
             }""")
         }
       }
     }
     
    +// scalastyle:off line.size.limit
    +@ExpressionDescription(
    +  usage = "expr1 _FUNC_ expr2 - Returns `expr1`/`expr2`. It always performs floating point division.",
    +  examples = """
    +    Examples:
    +      > SELECT 3 _FUNC_ 2;
    +       1.5
    +      > SELECT 2L _FUNC_ 2L;
    +       1.0
    +  """)
    +// scalastyle:on line.size.limit
    +case class Divide(left: Expression, right: Expression) extends DivModLike {
    +
    +  override def inputType: AbstractDataType = TypeCollection(DoubleType, DecimalType)
    +
    +  override def symbol: String = "/"
    +  override def decimalMethod: String = "$div"
    +  override def nullable: Boolean = true
    +
    +  private lazy val div: (Any, Any) => Any = dataType match {
    +    case ft: FractionalType => ft.fractional.asInstanceOf[Fractional[Any]].div
    +  }
    +
    +  override def eval(input: InternalRow): Any = evalHelper(input, div)
    --- End diff --
    
    following my above comment, here we can write
    ```
    private lazy val div = dataType.asInstanceOf[FractionType].fractional.asInstanceOf[Fractional[Any]].div
    
    override def evalInternal(input1: Any, input2: Any) = div(input1, input2)
    ```


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    **[Test build #90812 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/90812/testReport)** for PR 21367 at commit [`026531c`](https://github.com/apache/spark/commit/026531c70bfb7e06f8586010fc48a8666ff4df04).


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/3348/
    Test PASSed.


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by rednaxelafx <gi...@git.apache.org>.
Github user rednaxelafx commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21367#discussion_r189404152
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala ---
    @@ -220,30 +220,12 @@ case class Multiply(left: Expression, right: Expression) extends BinaryArithmeti
       protected override def nullSafeEval(input1: Any, input2: Any): Any = numeric.times(input1, input2)
     }
     
    -// scalastyle:off line.size.limit
    -@ExpressionDescription(
    -  usage = "expr1 _FUNC_ expr2 - Returns `expr1`/`expr2`. It always performs floating point division.",
    -  examples = """
    -    Examples:
    -      > SELECT 3 _FUNC_ 2;
    -       1.5
    -      > SELECT 2L _FUNC_ 2L;
    -       1.0
    -  """)
    -// scalastyle:on line.size.limit
    -case class Divide(left: Expression, right: Expression) extends BinaryArithmetic {
    -
    -  override def inputType: AbstractDataType = TypeCollection(DoubleType, DecimalType)
    +// Common base trait for Divide and Remainder, since these two classes are almost identical
    +trait DivModLike extends BinaryArithmetic {
     
    -  override def symbol: String = "/"
    -  override def decimalMethod: String = "$div"
       override def nullable: Boolean = true
     
    -  private lazy val div: (Any, Any) => Any = dataType match {
    -    case ft: FractionalType => ft.fractional.asInstanceOf[Fractional[Any]].div
    -  }
    -
    -  override def eval(input: InternalRow): Any = {
    +  protected def evalHelper(input: InternalRow, op: => (Any, Any) => Any): Any = {
    --- End diff --
    
    Note: `op` is declared as a call-by-name argument to retain the `lazy val` semantics of the original code in `Divide.div`.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    LGTM, also cc @viirya @kiszk 


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    **[Test build #90938 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/90938/testReport)** for PR 21367 at commit [`951b5bd`](https://github.com/apache/spark/commit/951b5bd073015a187cc78e5be1bd70f241fb952c).


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    **[Test build #90940 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/90940/testReport)** for PR 21367 at commit [`951b5bd`](https://github.com/apache/spark/commit/951b5bd073015a187cc78e5be1bd70f241fb952c).


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    **[Test build #90812 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/90812/testReport)** for PR 21367 at commit [`026531c`](https://github.com/apache/spark/commit/026531c70bfb7e06f8586010fc48a8666ff4df04).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds the following public classes _(experimental)_:
      * `trait DivModLike extends BinaryArithmetic `
      * `case class Divide(left: Expression, right: Expression) extends DivModLike `
      * `case class Remainder(left: Expression, right: Expression) extends DivModLike `


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/21367


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21367#discussion_r189428423
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala ---
    @@ -220,30 +220,12 @@ case class Multiply(left: Expression, right: Expression) extends BinaryArithmeti
       protected override def nullSafeEval(input1: Any, input2: Any): Any = numeric.times(input1, input2)
     }
     
    -// scalastyle:off line.size.limit
    -@ExpressionDescription(
    -  usage = "expr1 _FUNC_ expr2 - Returns `expr1`/`expr2`. It always performs floating point division.",
    -  examples = """
    -    Examples:
    -      > SELECT 3 _FUNC_ 2;
    -       1.5
    -      > SELECT 2L _FUNC_ 2L;
    -       1.0
    -  """)
    -// scalastyle:on line.size.limit
    -case class Divide(left: Expression, right: Expression) extends BinaryArithmetic {
    -
    -  override def inputType: AbstractDataType = TypeCollection(DoubleType, DecimalType)
    +// Common base trait for Divide and Remainder, since these two classes are almost identical
    +trait DivModLike extends BinaryArithmetic {
     
    -  override def symbol: String = "/"
    -  override def decimalMethod: String = "$div"
       override def nullable: Boolean = true
     
    -  private lazy val div: (Any, Any) => Any = dataType match {
    -    case ft: FractionalType => ft.fractional.asInstanceOf[Fractional[Any]].div
    -  }
    -
    -  override def eval(input: InternalRow): Any = {
    +  protected def evalHelper(input: InternalRow, op: => (Any, Any) => Any): Any = {
    --- End diff --
    
    nit: not sure which one is better, but in object-oriented world we usually do
    ```
    def eval {
      ....
      evalInternal(input1, input2)
    }
    
    protected def evalInternal(input1: Any, input2: Any): Any
    
    ```


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by viirya <gi...@git.apache.org>.
Github user viirya commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    retest this please.


---

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


[GitHub] spark pull request #21367: [SPARK-24321][SQL] Extract common code from Divid...

Posted by rednaxelafx <gi...@git.apache.org>.
Github user rednaxelafx commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21367#discussion_r189723394
  
    --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala ---
    @@ -297,13 +279,39 @@ case class Divide(left: Expression, right: Expression) extends BinaryArithmetic
               if (${eval1.isNull}) {
                 ${ev.isNull} = true;
               } else {
    -            ${ev.value} = $divide;
    +            ${ev.value} = $operation;
               }
             }""")
         }
       }
     }
     
    +// scalastyle:off line.size.limit
    +@ExpressionDescription(
    +  usage = "expr1 _FUNC_ expr2 - Returns `expr1`/`expr2`. It always performs floating point division.",
    +  examples = """
    +    Examples:
    +      > SELECT 3 _FUNC_ 2;
    +       1.5
    +      > SELECT 2L _FUNC_ 2L;
    +       1.0
    +  """)
    +// scalastyle:on line.size.limit
    +case class Divide(left: Expression, right: Expression) extends DivModLike {
    +
    +  override def inputType: AbstractDataType = TypeCollection(DoubleType, DecimalType)
    +
    +  override def symbol: String = "/"
    +  override def decimalMethod: String = "$div"
    +  override def nullable: Boolean = true
    --- End diff --
    
    Oops! Thanks for catching it!
    Addressed in an update.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by kiszk <gi...@git.apache.org>.
Github user kiszk commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    LGTM


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Merged build finished. Test PASSed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Merged build finished. Test FAILed.


---

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


[GitHub] spark issue #21367: [SPARK-24321][SQL] Extract common code from Divide/Remai...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/21367
  
    Merged build finished. Test PASSed.


---

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