dongjoon-hyun commented on a change in pull request #29737:
URL: https://github.com/apache/spark/pull/29737#discussion_r557520789



##########
File path: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/orc/HiveOrcQuerySuite.scala
##########
@@ -313,4 +314,71 @@ class HiveOrcQuerySuite extends OrcQueryTest with 
TestHiveSingleton {
       }
     }
   }
+
+  test("SPARK-32864: Support ORC forced positional evolution") {
+    Seq("native", "hive").foreach { orcImpl =>
+      Seq(true, false).foreach { forcePositionalEvolution =>
+        withSQLConf(SQLConf.ORC_IMPLEMENTATION.key -> orcImpl,
+          OrcConf.FORCE_POSITIONAL_EVOLUTION.getAttribute -> 
forcePositionalEvolution.toString) {
+          withTempPath { f =>
+            val path = f.getCanonicalPath
+            Seq((1, 2), (3, 4), (5, 6)).toDF("c1", "c2").write.orc(path)
+            val correctAnswer = Seq(Row(1, 2), Row(3, 4), Row(5, 6))
+            checkAnswer(spark.read.orc(path), correctAnswer)
+
+            withSQLConf(HiveUtils.CONVERT_METASTORE_ORC.key -> "true") {
+              withTable("t") {
+                sql(s"CREATE EXTERNAL TABLE t(c3 INT, c4 INT) STORED AS ORC 
LOCATION '$path'")
+
+                val expected = if (forcePositionalEvolution) {
+                  correctAnswer
+                } else {
+                  Seq(Row(null, null), Row(null, null), Row(null, null))
+                }
+
+                checkAnswer(spark.table("t"), expected)
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+
+  test("SPARK-32864: Support ORC forced positional evolution with partitioned 
table") {
+    Seq("native", "hive").foreach { orcImpl =>
+      Seq(true, false).foreach { forcePositionalEvolution =>
+        withSQLConf(SQLConf.ORC_IMPLEMENTATION.key -> orcImpl,
+          OrcConf.FORCE_POSITIONAL_EVOLUTION.getAttribute -> 
forcePositionalEvolution.toString) {
+          withTempPath { f =>
+            val path = f.getCanonicalPath
+            Seq((1, 2, 1), (3, 4, 2), (5, 6, 3)).toDF("c1", "c2", "p")
+              .write.partitionBy("p").orc(path)
+            val correctAnswer = Seq(Row(1, 2, 1), Row(3, 4, 2), Row(5, 6, 3))
+            checkAnswer(spark.read.orc(path), correctAnswer)
+
+            withSQLConf(HiveUtils.CONVERT_METASTORE_ORC.key -> "true") {

Review comment:
       ditto.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to