Skip to content

Commit 34754f0

Browse files
MaxGekkwangyum
authored andcommitted
[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 <[email protected]> Signed-off-by: Yuming Wang <[email protected]>
1 parent 247306c commit 34754f0

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/arithmetic.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,6 @@ case class Pmod(
981981

982982
override def symbol: String = "pmod"
983983

984-
protected def checkTypesInternal(t: DataType): TypeCheckResult =
985-
TypeUtils.checkForNumericExpr(t, "pmod")
986-
987984
override def inputType: AbstractDataType = NumericType
988985

989986
override def nullable: Boolean = true

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/TypeUtils.scala

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ import org.apache.spark.sql.types._
2626
* Functions to help with checking for valid data types and value comparison of various types.
2727
*/
2828
object TypeUtils {
29-
def checkForNumericExpr(dt: DataType, caller: String): TypeCheckResult = {
30-
if (dt.isInstanceOf[NumericType] || dt == NullType) {
31-
TypeCheckResult.TypeCheckSuccess
32-
} else {
33-
TypeCheckResult.TypeCheckFailure(s"$caller requires numeric types, not ${dt.catalogString}")
34-
}
35-
}
3629

3730
def checkForOrderingExpr(dt: DataType, caller: String): TypeCheckResult = {
3831
if (RowOrdering.isOrderable(dt)) {

0 commit comments

Comments
 (0)