Skip to content

Commit 1d5dd76

Browse files
committed
[SPARK-19809][SQL][TEST][FOLLOWUP] Move the test case to HiveOrcQuerySuite
1 parent 17cdabb commit 1d5dd76

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,21 +2172,4 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
21722172
}
21732173
}
21742174
}
2175-
2176-
test("SPARK-19809 NullPointerException on zero-size ORC file") {
2177-
Seq("native", "hive").foreach { orcImpl =>
2178-
withSQLConf(SQLConf.ORC_IMPLEMENTATION.key -> orcImpl) {
2179-
withTempPath { dir =>
2180-
withTable("spark_19809") {
2181-
sql(s"CREATE TABLE spark_19809(a int) STORED AS ORC LOCATION '$dir'")
2182-
Files.touch(new File(s"${dir.getCanonicalPath}", "zero.orc"))
2183-
2184-
withSQLConf(HiveUtils.CONVERT_METASTORE_ORC.key -> "true") { // default since 2.3.0
2185-
checkAnswer(sql("SELECT * FROM spark_19809"), Seq.empty)
2186-
}
2187-
}
2188-
}
2189-
}
2190-
}
2191-
}
21922175
}

sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/HiveOrcQuerySuite.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717

1818
package org.apache.spark.sql.hive.orc
1919

20+
import java.io.File
21+
22+
import com.google.common.io.Files
23+
2024
import org.apache.spark.sql.AnalysisException
2125
import org.apache.spark.sql.catalyst.catalog.HiveTableRelation
2226
import org.apache.spark.sql.execution.datasources.{HadoopFsRelation, LogicalRelation}
@@ -162,4 +166,24 @@ class HiveOrcQuerySuite extends OrcQueryTest with TestHiveSingleton {
162166
}
163167
}
164168
}
169+
170+
// Since Hive 1.2.1 library code path still has this problem, users may hit this
171+
// when spark.sql.hive.convertMetastoreOrc=false. However, after SPARK-22279,
172+
// Apache Spark with the default configuration doesn't hit this bug.
173+
test("SPARK-19809 NullPointerException on zero-size ORC file") {
174+
Seq("native", "hive").foreach { orcImpl =>
175+
withSQLConf(SQLConf.ORC_IMPLEMENTATION.key -> orcImpl) {
176+
withTempPath { dir =>
177+
withTable("spark_19809") {
178+
sql(s"CREATE TABLE spark_19809(a int) STORED AS ORC LOCATION '$dir'")
179+
Files.touch(new File(s"${dir.getCanonicalPath}", "zero.orc"))
180+
181+
withSQLConf(HiveUtils.CONVERT_METASTORE_ORC.key -> "true") { // default since 2.3.0
182+
checkAnswer(spark.table("spark_19809"), Seq.empty)
183+
}
184+
}
185+
}
186+
}
187+
}
188+
}
165189
}

0 commit comments

Comments
 (0)