cloud-fan commented on a change in pull request #23766: [SPARK-26859][SQL] Fix
field writer index bug in non-vectorized ORC deserializer
URL: https://github.com/apache/spark/pull/23766#discussion_r256712403
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/ReadSchemaTest.scala
##########
@@ -108,6 +108,40 @@ trait AddColumnTest extends ReadSchemaTest {
}
}
+trait AddColumnIntoTheMiddleTest extends ReadSchemaTest {
+ import testImplicits._
+
+ test("append column into middle") {
+ withTempPath { dir =>
+ val path = dir.getCanonicalPath
+
+ val df1 = Seq((1, 2, "abc"), (4, 5, "def"), (8, 9, null)).toDF("col1",
"col2", "col3")
+ val df2 = Seq((10, null, 20, null), (40, "uvw", 50, "xyz"), (80, null,
90, null))
+ .toDF("col1", "col4", "col2", "col3")
+
+ val dir1 = s"$path${File.separator}part=one"
+ val dir2 = s"$path${File.separator}part=two"
+
+ df1.write.format(format).options(options).save(dir1)
+ df2.write.format(format).options(options).save(dir2)
+
+ val df = spark.read
+ .schema(df2.schema)
Review comment:
just for curiosity, if we don't specify the schema, can spark infer the
schema correctly?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]