You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by ge...@apache.org on 2022/08/08 00:52:15 UTC
[spark] branch master updated: [SPARK-39963][SQL][TESTS][FOLLOW-UP] Disable ANSI mode for test of casting date to decimal
This is an automated email from the ASF dual-hosted git repository.
gengliang 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 fe44676288e [SPARK-39963][SQL][TESTS][FOLLOW-UP] Disable ANSI mode for test of casting date to decimal
fe44676288e is described below
commit fe44676288e5452750a12c27abb95363f2ce7c5c
Author: Hyukjin Kwon <gu...@apache.org>
AuthorDate: Sun Aug 7 17:52:04 2022 -0700
[SPARK-39963][SQL][TESTS][FOLLOW-UP] Disable ANSI mode for test of casting date to decimal
### What changes were proposed in this pull request?
This PR is a followup of https://github.com/apache/spark/pull/37389 which disables ANSI mode when testing a case from date to decimal.
### Why are the changes needed?
To make the test pass. Currently it fails with ANSI mode on, see also https://github.com/apache/spark/runs/7701218236?check_suite_focus=true.
### Does this PR introduce _any_ user-facing change?
No, test-only.
### How was this patch tested?
I manually ran the test in my local.
Closes #37426 from HyukjinKwon/SPARK-39963.
Authored-by: Hyukjin Kwon <gu...@apache.org>
Signed-off-by: Gengliang Wang <ge...@apache.org>
---
.../sql/catalyst/optimizer/SimplifyCastsSuite.scala | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimplifyCastsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimplifyCastsSuite.scala
index 86e1b625910..741b1bb8c08 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimplifyCastsSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/SimplifyCastsSuite.scala
@@ -22,6 +22,7 @@ import org.apache.spark.sql.catalyst.dsl.plans._
import org.apache.spark.sql.catalyst.plans.PlanTest
import org.apache.spark.sql.catalyst.plans.logical._
import org.apache.spark.sql.catalyst.rules.RuleExecutor
+import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.types._
class SimplifyCastsSuite extends PlanTest {
@@ -95,10 +96,17 @@ class SimplifyCastsSuite extends PlanTest {
Optimize.execute(
input.select($"b".cast(DecimalType(10, 2)).cast(DecimalType(24, 2)).as("casted")).analyze),
input.select($"b".cast(DecimalType(10, 2)).cast(DecimalType(24, 2)).as("casted")).analyze)
- comparePlans(
- Optimize.execute(
- input.select($"c".cast(DecimalType(10, 2)).cast(DecimalType(24, 2)).as("casted")).analyze),
- input.select($"c".cast(DecimalType(10, 2)).cast(DecimalType(24, 2)).as("casted")).analyze)
+
+ withClue("SPARK-39963: cast date to decimal") {
+ withSQLConf(SQLConf.ANSI_ENABLED.key -> false.toString) {
+ // ANSI mode does not allow to cast a date to a decimal.
+ comparePlans(Optimize.execute(
+ input.select(
+ $"c".cast(DecimalType(10, 2)).cast(DecimalType(24, 2)).as("casted")).analyze),
+ input.select(
+ $"c".cast(DecimalType(10, 2)).cast(DecimalType(24, 2)).as("casted")).analyze)
+ }
+ }
comparePlans(
Optimize.execute(
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org