cloud-fan commented on a change in pull request #31960:
URL: https://github.com/apache/spark/pull/31960#discussion_r627112742
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetIOSuite.scala
##########
@@ -459,6 +461,40 @@ class ParquetIOSuite extends QueryTest with ParquetTest
with SharedSparkSession
}
}
+ test("SPARK-34817: Read UINT_64 as Decimal from parquet") {
+ Seq(true, false).foreach { dictionaryEnabled =>
+ def makeRawParquetFile(path: Path): Unit = {
+ val schemaStr =
+ """message root {
+ | required INT64 a(UINT_64);
+ |}
+ """.stripMargin
+ val schema = MessageTypeParser.parseMessageType(schemaStr)
+
+ val writer = createParquetWriter(schema, path, dictionaryEnabled)
+
+ val factory = new SimpleGroupFactory(schema)
+ (-500 until 500).foreach { i =>
+ val group = factory.newGroup()
+ .append("a", i % 100L)
+ writer.write(group)
+ }
+ writer.close()
+ }
+
+ withTempDir { dir =>
+ val path = new Path(dir.toURI.toString, "part-r-0.parquet")
+ makeRawParquetFile(path)
+ readParquetFile(path.toString) { df =>
Review comment:
can we also test with user-specified schema? What if the user-specified
schema is not `decimal(20, 0)`? Do we return wrong result or fail?
--
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]