Skip to content

Commit d38b371

Browse files
committed
Address comment.
1 parent 397409b commit d38b371

2 files changed

Lines changed: 5 additions & 20 deletions

File tree

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

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -996,28 +996,13 @@ class CastSuite extends SparkFunSuite with ExpressionEvalHelper {
996996

997997
atomicTypes.foreach { atomicType =>
998998
val struct = Literal.create(
999-
InternalRow(
1000-
UTF8String.fromString("123"),
1001-
UTF8String.fromString("true"),
1002-
UTF8String.fromString("f"),
1003-
null),
1004-
StructType(Seq(
1005-
StructField("a", StringType, nullable = true),
1006-
StructField("b", StringType, nullable = true),
1007-
StructField("c", StringType, nullable = true),
1008-
StructField("d", NullType, nullable = true))))
999+
InternalRow(null),
1000+
StructType(Seq(StructField("a", NullType, nullable = true))))
10091001

10101002
val ret = cast(struct, StructType(Seq(
1011-
StructField("a", StringType, nullable = true),
1012-
StructField("b", StringType, nullable = true),
1013-
StructField("c", StringType, nullable = true),
1014-
StructField("d", atomicType, nullable = true))))
1003+
StructField("a", atomicType, nullable = true))))
10151004
assert(ret.resolved)
1016-
checkEvaluation(ret, InternalRow(
1017-
UTF8String.fromString("123"),
1018-
UTF8String.fromString("true"),
1019-
UTF8String.fromString("f"),
1020-
null))
1005+
checkEvaluation(ret, InternalRow(null))
10211006
}
10221007
}
10231008
}

sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ class DataFrameSuite extends QueryTest with SharedSQLContext {
21592159
}
21602160

21612161
test("SPARK-27671: Fix analysis exception when casting null in nested field in struct") {
2162-
val df = sql("select * FROM VALUES (('a', (10, null))), (('b', (10, 50))), " +
2162+
val df = sql("SELECT * FROM VALUES (('a', (10, null))), (('b', (10, 50))), " +
21632163
"(('c', null)) AS tab(x, y)")
21642164
checkAnswer(df, Row("a", Row(10, null)) :: Row("b", Row(10, 50)) :: Row("c", null) :: Nil)
21652165
}

0 commit comments

Comments
 (0)