Skip to content

Commit fe169b0

Browse files
committed
improve test
1 parent 03b70da commit fe169b0

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/ExpressionTypeCheckingSuite.scala

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.apache.spark.sql.catalyst.dsl.expressions._
2323
import org.apache.spark.sql.catalyst.dsl.plans._
2424
import org.apache.spark.sql.catalyst.expressions._
2525
import org.apache.spark.sql.catalyst.plans.logical.LocalRelation
26-
import org.apache.spark.sql.types.StringType
26+
import org.apache.spark.sql.types.{TypeCollection, StringType}
2727

2828
class ExpressionTypeCheckingSuite extends SparkFunSuite {
2929

@@ -95,8 +95,10 @@ class ExpressionTypeCheckingSuite extends SparkFunSuite {
9595
assertError(BitwiseOr('booleanField, 'booleanField), "accepts integral type")
9696
assertError(BitwiseXor('booleanField, 'booleanField), "accepts integral type")
9797

98-
assertError(MaxOf('complexField, 'complexField), "accepts (boolean or tinyint or")
99-
assertError(MinOf('complexField, 'complexField), "accepts (boolean or tinyint or")
98+
assertError(MaxOf('complexField, 'complexField),
99+
s"accepts ${TypeCollection.Ordered.simpleString} type")
100+
assertError(MinOf('complexField, 'complexField),
101+
s"accepts ${TypeCollection.Ordered.simpleString} type")
100102
}
101103

102104
test("check types for predicates") {
@@ -119,17 +121,16 @@ class ExpressionTypeCheckingSuite extends SparkFunSuite {
119121
assertErrorForDifferingTypes(GreaterThan('intField, 'booleanField))
120122
assertErrorForDifferingTypes(GreaterThanOrEqual('intField, 'booleanField))
121123

122-
assertError(
123-
LessThan('complexField, 'complexField), "accepts (boolean or tinyint or")
124-
assertError(
125-
LessThanOrEqual('complexField, 'complexField), "accepts (boolean or tinyint or")
126-
assertError(
127-
GreaterThan('complexField, 'complexField), "accepts (boolean or tinyint or")
128-
assertError(
129-
GreaterThanOrEqual('complexField, 'complexField), "accepts (boolean or tinyint or")
124+
assertError(LessThan('complexField, 'complexField),
125+
s"accepts ${TypeCollection.Ordered.simpleString} type")
126+
assertError(LessThanOrEqual('complexField, 'complexField),
127+
s"accepts ${TypeCollection.Ordered.simpleString} type")
128+
assertError(GreaterThan('complexField, 'complexField),
129+
s"accepts ${TypeCollection.Ordered.simpleString} type")
130+
assertError(GreaterThanOrEqual('complexField, 'complexField),
131+
s"accepts ${TypeCollection.Ordered.simpleString} type")
130132

131-
assertError(
132-
If('intField, 'stringField, 'stringField),
133+
assertError(If('intField, 'stringField, 'stringField),
133134
"type of predicate expression in If should be boolean")
134135
assertErrorForDifferingTypes(If('booleanField, 'intField, 'booleanField))
135136

0 commit comments

Comments
 (0)