Skip to content

Commit 2983832

Browse files
committed
simplify a test
1 parent d9eb4c7 commit 2983832

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CodeGenerationSuite.scala

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,15 @@ class CodeGenerationSuite extends SparkFunSuite with ExpressionEvalHelper {
9898
}
9999

100100
test("SPARK-18091: split large if expressions into blocks due to JVM code size limit") {
101-
val inStr = "StringForTesting"
102-
val row = create_row(inStr)
103-
val inputStrAttr = 'a.string.at(0)
104-
105-
var strExpr: Expression = inputStrAttr
106-
for (_ <- 1 to 13) {
107-
strExpr = If(EqualTo(Decode(Encode(strExpr, "utf-8"), "utf-8"), inputStrAttr),
108-
strExpr, strExpr)
101+
var strExpr: Expression = Literal("abc")
102+
for (_ <- 1 to 150) {
103+
strExpr = Decode(Encode(strExpr, "utf-8"), "utf-8")
109104
}
110105

111-
val expressions = Seq(strExpr)
112-
val plan = GenerateUnsafeProjection.generate(expressions, true)
113-
val actual = plan(row).toSeq(expressions.map(_.dataType))
114-
val expected = Seq(UTF8String.fromString(inStr))
106+
val expressions = Seq(If(EqualTo(strExpr, strExpr), strExpr, strExpr))
107+
val plan = GenerateMutableProjection.generate(expressions)
108+
val actual = plan(null).toSeq(expressions.map(_.dataType))
109+
val expected = Seq(UTF8String.fromString("abc"))
115110

116111
if (!checkResult(actual, expected)) {
117112
fail(s"Incorrect Evaluation: expressions: $expressions, actual: $actual, expected: $expected")

0 commit comments

Comments
 (0)