Skip to content
Closed
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,28 @@ class HiveOrcSourceSuite extends OrcSuite with TestHiveSingleton {
val df = readResourceOrcFile("test-data/TestStringDictionary.testRowIndex.orc")
assert(df.where("str < 'row 001000'").count() === 1000)
}

Seq("NONE", "SNAPPY", "ZLIB", "LZ4", "LZO", "ZSTD").foreach { compression =>
test(s"SPARK-46742: Read and write with $compression compressions") {
Seq(true, false).foreach { convertMetastore =>
withSQLConf(HiveUtils.CONVERT_METASTORE_ORC.key -> s"$convertMetastore") {
withTempDir { dir =>
withTable("orc_tbl1") {
val orcTblStatement1 =
s"""
|CREATE TABLE orc_tbl1(
| c1 int,
| c2 string)
|STORED AS orc
|TBLPROPERTIES ("orc.compress"="$compression")
|LOCATION '${s"${dir.getCanonicalPath}"}'""".stripMargin
sql(orcTblStatement1)
sql("INSERT INTO TABLE orc_tbl1 VALUES (1, 'orc1'), (2, 'orc2')")
checkAnswer(sql("SELECT * FROM orc_tbl1"), (1 to 2).map(i => Row(i, s"orc$i")))
}
}
}
}
}
}
}