Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Check rebasing of timestamps in ORC datasource
  • Loading branch information
MaxGekk committed Mar 27, 2020
commit 143f9a1364a343c66b1024d64f04aec84ceecc7d
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,34 @@ abstract class OrcSuite extends OrcTest with BeforeAndAfterAll {
}
}
}

test("SPARK-31238: compatibility with Spark 2.4 in reading timestamps") {
Seq(false, true).foreach { vectorized =>
withSQLConf(SQLConf.ORC_VECTORIZED_READER_ENABLED.key -> vectorized.toString) {
checkAnswer(
readResourceOrcFile("test-data/before_1582_ts_v2_4.snappy.orc"),
Row(java.sql.Timestamp.valueOf("1001-01-01 01:02:03.123456")))
}
}
}

test("SPARK-31238: rebasing timestamps in write") {
withTempPath { dir =>
val path = dir.getAbsolutePath
Seq("1001-01-01 01:02:03.123456").toDF("tsS")
.select($"tsS".cast("timestamp").as("ts"))
.write
.orc(path)

Seq(false, true).foreach { vectorized =>
withSQLConf(SQLConf.ORC_VECTORIZED_READER_ENABLED.key -> vectorized.toString) {
checkAnswer(
spark.read.orc(path),
Row(java.sql.Timestamp.valueOf("1001-01-01 01:02:03.123456")))
}
}
}
}
}

class OrcSourceSuite extends OrcSuite with SharedSparkSession {
Expand Down