You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by yu...@apache.org on 2022/08/31 11:27:40 UTC

[spark] branch master updated: [MINOR][SQL] Remove unused `checkForNumericExpr()`

This is an automated email from the ASF dual-hosted git repository.

yumwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 34754f00e76 [MINOR][SQL] Remove unused `checkForNumericExpr()`
34754f00e76 is described below

commit 34754f00e7618fca43d5ae9aec2c8b3ab83c8771
Author: Max Gekk <ma...@gmail.com>
AuthorDate: Wed Aug 31 19:27:12 2022 +0800

    [MINOR][SQL] Remove unused `checkForNumericExpr()`
    
    ### What changes were proposed in this pull request?
    In the PR, I propose to remove 2 unused methods: `checkForNumericExpr()` and `checkTypesInternal()`. Type checks of inputs in `Pmod` are performed by `BinaryArithmetic.checkInputDataTypes()`.
    
    ### Why are the changes needed?
    To improve code maintenance.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    By running the related test suites:
    ```
    $ build/sbt "sql/testOnly org.apache.spark.sql.SQLQueryTestSuite"
    $ build/sbt "test:testOnly *ArithmeticExpressionSuite"
    ```
    
    Closes #37740 from MaxGekk/rm-checkForNumericExpr.
    
    Authored-by: Max Gekk <ma...@gmail.com>
    Signed-off-by: Yuming Wang <yu...@ebay.com>
---
 .../org/apache/spark/sql/catalyst/expressions/arithmetic.scala     | 3 ---
 .../main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala  | 7 -------
 2 files changed, 10 deletions(-)

diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
index 45e0ec876d1..41973e95569 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala
@@ -981,9 +981,6 @@ case class Pmod(
 
   override def symbol: String = "pmod"
 
-  protected def checkTypesInternal(t: DataType): TypeCheckResult =
-    TypeUtils.checkForNumericExpr(t, "pmod")
-
   override def inputType: AbstractDataType = NumericType
 
   override def nullable: Boolean = true
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala
index 4c8459b65c7..c7e42692d16 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala
@@ -26,13 +26,6 @@ import org.apache.spark.sql.types._
  * Functions to help with checking for valid data types and value comparison of various types.
  */
 object TypeUtils {
-  def checkForNumericExpr(dt: DataType, caller: String): TypeCheckResult = {
-    if (dt.isInstanceOf[NumericType] || dt == NullType) {
-      TypeCheckResult.TypeCheckSuccess
-    } else {
-      TypeCheckResult.TypeCheckFailure(s"$caller requires numeric types, not ${dt.catalogString}")
-    }
-  }
 
   def checkForOrderingExpr(dt: DataType, caller: String): TypeCheckResult = {
     if (RowOrdering.isOrderable(dt)) {


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