File tree Expand file tree Collapse file tree 2 files changed +24
-17
lines changed
sql/hive/src/test/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 2 files changed +24
-17
lines changed Original file line number Diff line number Diff 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}
Original file line number Diff line number Diff line change 1717
1818package org .apache .spark .sql .hive .orc
1919
20+ import java .io .File
21+
22+ import com .google .common .io .Files
23+
2024import org .apache .spark .sql .AnalysisException
2125import org .apache .spark .sql .catalyst .catalog .HiveTableRelation
2226import 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}
You can’t perform that action at this time.
0 commit comments