This is an automated email from the ASF dual-hosted git repository. gurwls223 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 b27b3c9 [SPARK-31090][SPARK-25457] Revert "IntegralDivide returns data type of the operands" b27b3c9 is described below commit b27b3c91f113ec49ee87c877dac0a602849d76b1 Author: Wenchen Fan <wenc...@databricks.com> AuthorDate: Fri Mar 13 10:47:36 2020 +0900 [SPARK-31090][SPARK-25457] Revert "IntegralDivide returns data type of the operands" ### What changes were proposed in this pull request? This reverts commit 47d6e80a2e64823fabb596503fb6a6cc6f51f713. ### Why are the changes needed? There is no standard requiring that `div` must return the type of the operand, and always returning long type looks fine. This is kind of a cosmetic change and we should avoid it if it breaks existing queries. This is similar to reverting TRIM function parameter order change. ### Does this PR introduce any user-facing change? Yes, change the behavior of `div` back to be the same as 2.4. ### How was this patch tested? N/A Closes #27835 from cloud-fan/revert2. Authored-by: Wenchen Fan <wenc...@databricks.com> Signed-off-by: HyukjinKwon <gurwls...@apache.org> --- .../sql/catalyst/analysis/DecimalPrecision.scala | 5 +- .../sql/catalyst/expressions/arithmetic.scala | 42 ++---- .../org/apache/spark/sql/internal/SQLConf.scala | 11 -- .../expressions/ArithmeticExpressionSuite.scala | 64 +++------ .../resources/sql-tests/inputs/operator-div.sql | 21 --- .../test/resources/sql-tests/inputs/operators.sql | 10 ++ .../sql-tests/results/operator-div.sql.out | 146 --------------------- .../resources/sql-tests/results/operators.sql.out | 66 +++++++++- .../sql-tests/results/postgreSQL/numeric.sql.out | 8 +- 9 files changed, 110 insertions(+), 263 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala index 91489b3..f2d607e5 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/DecimalPrecision.scala @@ -175,12 +175,11 @@ object DecimalPrecision extends TypeCoercionRule { resultType, nullOnOverflow) case expr @ IntegralDivide( - e1 @ DecimalType.Expression(p1, s1), e2 @ DecimalType.Expression(p2, s2), returnLong) => + e1 @ DecimalType.Expression(p1, s1), e2 @ DecimalType.Expression(p2, s2)) => val widerType = widerDecimalType(p1, s1, p2, s2) val promotedExpr = IntegralDivide( promotePrecision(e1, widerType), - promotePrecision(e2, widerType), - returnLong) + promotePrecision(e2, widerType)) if (expr.dataType.isInstanceOf[DecimalType]) { // This follows division rule val intDig = p1 - s1 + s2 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 624891c..215e88a 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 @@ -395,7 +395,7 @@ case class Divide(left: Expression, right: Expression) extends DivModLike { // scalastyle:off line.size.limit @ExpressionDescription( - usage = "expr1 _FUNC_ expr2 - Divide `expr1` by `expr2`. It returns NULL if an operand is NULL or `expr2` is 0. The result is casted to long if spark.sql.legacy.integralDivide.returnBigint is true, otherwise the data type of the operands is returned.", + usage = "expr1 _FUNC_ expr2 - Divide `expr1` by `expr2`. It returns NULL if an operand is NULL or `expr2` is 0. The result is casted to long.", examples = """ Examples: > SELECT 3 _FUNC_ 2; @@ -405,31 +405,15 @@ case class Divide(left: Expression, right: Expression) extends DivModLike { // scalastyle:on line.size.limit case class IntegralDivide( left: Expression, - right: Expression, - returnLong: Boolean) extends DivModLike { - - def this(left: Expression, right: Expression) = { - this(left, right, SQLConf.get.integralDivideReturnLong) - } + right: Expression) extends DivModLike { override def inputType: AbstractDataType = TypeCollection(IntegralType, DecimalType) - override def dataType: DataType = if (returnLong) { - LongType - } else { - left.dataType - } + override def dataType: DataType = LongType override def symbol: String = "/" override def decimalMethod: String = "quot" - override def decimalToDataTypeCodeGen(decimalResult: String): String = { - if (returnLong) { - s"$decimalResult.toLong()" - } else { - decimalResult - } - } - + override def decimalToDataTypeCodeGen(decimalResult: String): String = s"$decimalResult.toLong()" override def sqlOperator: String = "div" private lazy val div: (Any, Any) => Any = { @@ -439,19 +423,13 @@ case class IntegralDivide( case d: DecimalType => d.asIntegral.asInstanceOf[Integral[Any]] } - val divide = integral.quot _ - if (returnLong) { - val toLong = integral.asInstanceOf[Integral[Any]].toLong _ - (x, y) => { - val res = divide(x, y) - if (res == null) { - null - } else { - toLong(res) - } + (x, y) => { + val res = integral.quot(x, y) + if (res == null) { + null + } else { + integral.asInstanceOf[Integral[Any]].toLong(res) } - } else { - divide } } diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala index 4926183..b628271 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/internal/SQLConf.scala @@ -2208,15 +2208,6 @@ object SQLConf { .booleanConf .createWithDefault(false) - - val LEGACY_INTEGRALDIVIDE_RETURN_LONG = buildConf("spark.sql.legacy.integralDivide.returnBigint") - .doc("If it is set to true, the div operator returns always a bigint. This behavior was " + - "inherited from Hive. Otherwise, the return type is the data type of the operands.") - .version("3.0.0") - .internal() - .booleanConf - .createWithDefault(false) - val LEGACY_BUCKETED_TABLE_SCAN_OUTPUT_ORDERING = buildConf("spark.sql.legacy.bucketedTableScan.outputOrdering") .internal() @@ -3049,8 +3040,6 @@ class SQLConf extends Serializable with Logging { def createHiveTableByDefaultEnabled: Boolean = getConf(SQLConf.LEGACY_CREATE_HIVE_TABLE_BY_DEFAULT_ENABLED) - def integralDivideReturnLong: Boolean = getConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG) - def truncateTableIgnorePermissionAcl: Boolean = getConf(SQLConf.TRUNCATE_TABLE_IGNORE_PERMISSION_ACL) diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala index b4a1ae2..675f85f 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ArithmeticExpressionSuite.scala @@ -174,24 +174,13 @@ class ArithmeticExpressionSuite extends SparkFunSuite with ExpressionEvalHelper } test("/ (Divide) for integral type") { - withSQLConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG.key -> "false") { - checkEvaluation(IntegralDivide(Literal(1.toByte), Literal(2.toByte)), 0.toByte) - checkEvaluation(IntegralDivide(Literal(1.toShort), Literal(2.toShort)), 0.toShort) - checkEvaluation(IntegralDivide(Literal(1), Literal(2)), 0) - checkEvaluation(IntegralDivide(Literal(1.toLong), Literal(2.toLong)), 0.toLong) - checkEvaluation(IntegralDivide(positiveShortLit, negativeShortLit), 0.toShort) - checkEvaluation(IntegralDivide(positiveIntLit, negativeIntLit), 0) - checkEvaluation(IntegralDivide(positiveLongLit, negativeLongLit), 0L) - } - withSQLConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG.key -> "true") { - checkEvaluation(IntegralDivide(Literal(1.toByte), Literal(2.toByte)), 0L) - checkEvaluation(IntegralDivide(Literal(1.toShort), Literal(2.toShort)), 0L) - checkEvaluation(IntegralDivide(Literal(1), Literal(2)), 0L) - checkEvaluation(IntegralDivide(Literal(1.toLong), Literal(2.toLong)), 0L) - checkEvaluation(IntegralDivide(positiveShortLit, negativeShortLit), 0L) - checkEvaluation(IntegralDivide(positiveIntLit, negativeIntLit), 0L) - checkEvaluation(IntegralDivide(positiveLongLit, negativeLongLit), 0L) - } + checkEvaluation(IntegralDivide(Literal(1.toByte), Literal(2.toByte)), 0L) + checkEvaluation(IntegralDivide(Literal(1.toShort), Literal(2.toShort)), 0L) + checkEvaluation(IntegralDivide(Literal(1), Literal(2)), 0L) + checkEvaluation(IntegralDivide(Literal(1.toLong), Literal(2.toLong)), 0L) + checkEvaluation(IntegralDivide(positiveShortLit, negativeShortLit), 0L) + checkEvaluation(IntegralDivide(positiveIntLit, negativeIntLit), 0L) + checkEvaluation(IntegralDivide(positiveLongLit, negativeLongLit), 0L) } test("% (Remainder)") { @@ -407,33 +396,18 @@ class ArithmeticExpressionSuite extends SparkFunSuite with ExpressionEvalHelper } test("SPARK-28322: IntegralDivide supports decimal type") { - withSQLConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG.key -> "false") { - checkEvaluation(IntegralDivide(Literal(Decimal(1)), Literal(Decimal(2))), Decimal(0)) - checkEvaluation(IntegralDivide(Literal(Decimal(2.4)), Literal(Decimal(1.1))), Decimal(2)) - checkEvaluation(IntegralDivide(Literal(Decimal(1.2)), Literal(Decimal(1.1))), Decimal(1)) - checkEvaluation(IntegralDivide(Literal(Decimal(0.2)), Literal(Decimal(0.0))), null) - checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( - Literal(Decimal("99999999999999999999999999999999999")), Literal(Decimal(0.001)))), - BigDecimal("99999999999999999999999999999999999000")) - // overflow during promote precision - checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( - Literal(Decimal("99999999999999999999999999999999999999")), Literal(Decimal(0.00001)))), - null) - } - withSQLConf(SQLConf.LEGACY_INTEGRALDIVIDE_RETURN_LONG.key -> "true") { - checkEvaluation(IntegralDivide(Literal(Decimal(1)), Literal(Decimal(2))), 0L) - checkEvaluation(IntegralDivide(Literal(Decimal(2.4)), Literal(Decimal(1.1))), 2L) - checkEvaluation(IntegralDivide(Literal(Decimal(1.2)), Literal(Decimal(1.1))), 1L) - checkEvaluation(IntegralDivide(Literal(Decimal(0.2)), Literal(Decimal(0.0))), null) - // overflows long and so returns a wrong result - checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( - Literal(Decimal("99999999999999999999999999999999999")), Literal(Decimal(0.001)))), - 687399551400672280L) - // overflow during promote precision - checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( - Literal(Decimal("99999999999999999999999999999999999999")), Literal(Decimal(0.00001)))), - null) - } + checkEvaluation(IntegralDivide(Literal(Decimal(1)), Literal(Decimal(2))), 0L) + checkEvaluation(IntegralDivide(Literal(Decimal(2.4)), Literal(Decimal(1.1))), 2L) + checkEvaluation(IntegralDivide(Literal(Decimal(1.2)), Literal(Decimal(1.1))), 1L) + checkEvaluation(IntegralDivide(Literal(Decimal(0.2)), Literal(Decimal(0.0))), null) + // overflows long and so returns a wrong result + checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( + Literal(Decimal("99999999999999999999999999999999999")), Literal(Decimal(0.001)))), + 687399551400672280L) + // overflow during promote precision + checkEvaluation(DecimalPrecision.decimalAndDecimal.apply(IntegralDivide( + Literal(Decimal("99999999999999999999999999999999999999")), Literal(Decimal(0.00001)))), + null) } test("SPARK-24598: overflow on long returns wrong result") { diff --git a/sql/core/src/test/resources/sql-tests/inputs/operator-div.sql b/sql/core/src/test/resources/sql-tests/inputs/operator-div.sql deleted file mode 100644 index 67b2d39..0000000 --- a/sql/core/src/test/resources/sql-tests/inputs/operator-div.sql +++ /dev/null @@ -1,21 +0,0 @@ -set spark.sql.legacy.integralDivide.returnBigint=true; - -select 5 div 2; -select 5 div 0; -select 5 div null; -select null div 5; -select cast(51 as decimal(10, 0)) div cast(2 as decimal(2, 0)); -select cast(5 as decimal(1, 0)) div cast(0 as decimal(2, 0)); -select cast(5 as decimal(1, 0)) div cast(null as decimal(2, 0)); -select cast(null as decimal(1, 0)) div cast(5 as decimal(2, 0)); - -set spark.sql.legacy.integralDivide.returnBigint=false; - -select 5 div 2; -select 5 div 0; -select 5 div null; -select null div 5; -select cast(51 as decimal(10, 0)) div cast(2 as decimal(2, 0)); -select cast(5 as decimal(1, 0)) div cast(0 as decimal(2, 0)); -select cast(5 as decimal(1, 0)) div cast(null as decimal(2, 0)); -select cast(null as decimal(1, 0)) div cast(5 as decimal(2, 0)); diff --git a/sql/core/src/test/resources/sql-tests/inputs/operators.sql b/sql/core/src/test/resources/sql-tests/inputs/operators.sql index ba14789..20bf0eb 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/operators.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/operators.sql @@ -22,6 +22,16 @@ select 5 / 0; select 5 / null; select null / 5; +-- integral div +select 5 div 2; +select 5 div 0; +select 5 div null; +select null div 5; +select cast(51 as decimal(10, 0)) div cast(2 as decimal(2, 0)); +select cast(5 as decimal(1, 0)) div cast(0 as decimal(2, 0)); +select cast(5 as decimal(1, 0)) div cast(null as decimal(2, 0)); +select cast(null as decimal(1, 0)) div cast(5 as decimal(2, 0)); + -- other arithmetics select 1 + 2; select 1 - 2; diff --git a/sql/core/src/test/resources/sql-tests/results/operator-div.sql.out b/sql/core/src/test/resources/sql-tests/results/operator-div.sql.out deleted file mode 100644 index 3f933f4..0000000 --- a/sql/core/src/test/resources/sql-tests/results/operator-div.sql.out +++ /dev/null @@ -1,146 +0,0 @@ --- Automatically generated by SQLQueryTestSuite --- Number of queries: 18 - - --- !query -set spark.sql.legacy.integralDivide.returnBigint=true --- !query schema -struct<key:string,value:string> --- !query output -spark.sql.legacy.integralDivide.returnBigint true - - --- !query -select 5 div 2 --- !query schema -struct<(5 div 2):bigint> --- !query output -2 - - --- !query -select 5 div 0 --- !query schema -struct<(5 div 0):bigint> --- !query output -NULL - - --- !query -select 5 div null --- !query schema -struct<(5 div CAST(NULL AS INT)):bigint> --- !query output -NULL - - --- !query -select null div 5 --- !query schema -struct<(CAST(NULL AS INT) div 5):bigint> --- !query output -NULL - - --- !query -select cast(51 as decimal(10, 0)) div cast(2 as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(51 AS DECIMAL(10,0)) AS DECIMAL(10,0)) div CAST(CAST(2 AS DECIMAL(2,0)) AS DECIMAL(10,0))):bigint> --- !query output -25 - - --- !query -select cast(5 as decimal(1, 0)) div cast(0 as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(5 AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(0 AS DECIMAL(2,0)) AS DECIMAL(2,0))):bigint> --- !query output -NULL - - --- !query -select cast(5 as decimal(1, 0)) div cast(null as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(5 AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(NULL AS DECIMAL(2,0)) AS DECIMAL(2,0))):bigint> --- !query output -NULL - - --- !query -select cast(null as decimal(1, 0)) div cast(5 as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(NULL AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(5 AS DECIMAL(2,0)) AS DECIMAL(2,0))):bigint> --- !query output -NULL - - --- !query -set spark.sql.legacy.integralDivide.returnBigint=false --- !query schema -struct<key:string,value:string> --- !query output -spark.sql.legacy.integralDivide.returnBigint false - - --- !query -select 5 div 2 --- !query schema -struct<(5 div 2):int> --- !query output -2 - - --- !query -select 5 div 0 --- !query schema -struct<(5 div 0):int> --- !query output -NULL - - --- !query -select 5 div null --- !query schema -struct<(5 div CAST(NULL AS INT)):int> --- !query output -NULL - - --- !query -select null div 5 --- !query schema -struct<(CAST(NULL AS INT) div 5):int> --- !query output -NULL - - --- !query -select cast(51 as decimal(10, 0)) div cast(2 as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(51 AS DECIMAL(10,0)) AS DECIMAL(10,0)) div CAST(CAST(2 AS DECIMAL(2,0)) AS DECIMAL(10,0))):decimal(10,0)> --- !query output -25 - - --- !query -select cast(5 as decimal(1, 0)) div cast(0 as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(5 AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(0 AS DECIMAL(2,0)) AS DECIMAL(2,0))):decimal(1,0)> --- !query output -NULL - - --- !query -select cast(5 as decimal(1, 0)) div cast(null as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(5 AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(NULL AS DECIMAL(2,0)) AS DECIMAL(2,0))):decimal(1,0)> --- !query output -NULL - - --- !query -select cast(null as decimal(1, 0)) div cast(5 as decimal(2, 0)) --- !query schema -struct<(CAST(CAST(NULL AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(5 AS DECIMAL(2,0)) AS DECIMAL(2,0))):decimal(1,0)> --- !query output -NULL diff --git a/sql/core/src/test/resources/sql-tests/results/operators.sql.out b/sql/core/src/test/resources/sql-tests/results/operators.sql.out index 5482810..083410f 100644 --- a/sql/core/src/test/resources/sql-tests/results/operators.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/operators.sql.out @@ -1,5 +1,5 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 49 +-- Number of queries: 57 -- !query @@ -155,6 +155,70 @@ NULL -- !query +select 5 div 2 +-- !query schema +struct<(5 div 2):bigint> +-- !query output +2 + + +-- !query +select 5 div 0 +-- !query schema +struct<(5 div 0):bigint> +-- !query output +NULL + + +-- !query +select 5 div null +-- !query schema +struct<(5 div CAST(NULL AS INT)):bigint> +-- !query output +NULL + + +-- !query +select null div 5 +-- !query schema +struct<(CAST(NULL AS INT) div 5):bigint> +-- !query output +NULL + + +-- !query +select cast(51 as decimal(10, 0)) div cast(2 as decimal(2, 0)) +-- !query schema +struct<(CAST(CAST(51 AS DECIMAL(10,0)) AS DECIMAL(10,0)) div CAST(CAST(2 AS DECIMAL(2,0)) AS DECIMAL(10,0))):bigint> +-- !query output +25 + + +-- !query +select cast(5 as decimal(1, 0)) div cast(0 as decimal(2, 0)) +-- !query schema +struct<(CAST(CAST(5 AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(0 AS DECIMAL(2,0)) AS DECIMAL(2,0))):bigint> +-- !query output +NULL + + +-- !query +select cast(5 as decimal(1, 0)) div cast(null as decimal(2, 0)) +-- !query schema +struct<(CAST(CAST(5 AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(NULL AS DECIMAL(2,0)) AS DECIMAL(2,0))):bigint> +-- !query output +NULL + + +-- !query +select cast(null as decimal(1, 0)) div cast(5 as decimal(2, 0)) +-- !query schema +struct<(CAST(CAST(NULL AS DECIMAL(1,0)) AS DECIMAL(2,0)) div CAST(CAST(5 AS DECIMAL(2,0)) AS DECIMAL(2,0))):bigint> +-- !query output +NULL + + +-- !query select 1 + 2 -- !query schema struct<(1 + 2):int> diff --git a/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out b/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out index bdb605e..65b6641 100644 --- a/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/postgreSQL/numeric.sql.out @@ -4494,7 +4494,7 @@ struct<(CAST(CAST(999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) / CA -- !query select div(cast(999999999999999999999 as decimal(38, 0)),1000000000000000000000) -- !query schema -struct<(CAST(CAST(999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) div CAST(1000000000000000000000 AS DECIMAL(38,0))):decimal(38,0)> +struct<(CAST(CAST(999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) div CAST(1000000000000000000000 AS DECIMAL(38,0))):bigint> -- !query output 0 @@ -4510,7 +4510,7 @@ struct<(CAST(CAST(999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) % CA -- !query select div(cast(-9999999999999999999999 as decimal(38, 0)),1000000000000000000000) -- !query schema -struct<(CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) div CAST(1000000000000000000000 AS DECIMAL(38,0))):decimal(38,0)> +struct<(CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) div CAST(1000000000000000000000 AS DECIMAL(38,0))):bigint> -- !query output -9 @@ -4526,7 +4526,7 @@ struct<(CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) % -- !query select div(cast(-9999999999999999999999 as decimal(38, 0)),1000000000000000000000)*1000000000000000000000 + mod(cast(-9999999999999999999999 as decimal(38, 0)),1000000000000000000000) -- !query schema -struct<(CAST((CAST((CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) div CAST(1000000000000000000000 AS DECIMAL(38,0))) AS DECIMAL(38,0)) * CAST(1000000000000000000000 AS DECIMAL(38,0))) AS DECIMAL(38,0)) + CAST((CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) % CAST(1000000000000000000000 AS DECIMAL(38,0))) AS DECIMAL(38,0))):decimal(38,0)> +struct<(CAST((CAST(CAST((CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) div CAST(1000000000000000000000 AS DECIMAL(38,0))) AS DECIMAL(20,0)) AS DECIMAL(22,0)) * CAST(1000000000000000000000 AS DECIMAL(22,0))) AS DECIMAL(38,0)) + CAST((CAST(CAST(-9999999999999999999999 AS DECIMAL(38,0)) AS DECIMAL(38,0)) % CAST(1000000000000000000000 AS DECIMAL(38,0))) AS DECIMAL(38,0))):decimal(38,0)> -- !query output -9999999999999999999999 @@ -4542,7 +4542,7 @@ struct<(CAST(70.0 AS DECIMAL(3,1)) % CAST(CAST(70 AS DECIMAL(2,0)) AS DECIMAL(3, -- !query select div (70.0,70) -- !query schema -struct<(CAST(70.0 AS DECIMAL(3,1)) div CAST(CAST(70 AS DECIMAL(2,0)) AS DECIMAL(3,1))):decimal(2,0)> +struct<(CAST(70.0 AS DECIMAL(3,1)) div CAST(CAST(70 AS DECIMAL(2,0)) AS DECIMAL(3,1))):bigint> -- !query output 1 --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org