ashokraminedi commented on code in PR #20130:
URL: https://github.com/apache/hudi/pull/20130#discussion_r4137822485
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/spark/sql/hudi/common/TestVectorizedReadWithSchemaEvolution.scala:
##########
@@ -66,5 +66,44 @@ class TestVectorizedReadWithSchemaEvolution extends
HoodieSparkSqlTestBase {
}
}
}
+
+ test(s"Test INT to DECIMAL schema evolution with precision overflow for
$tableType table") {
+ if (HoodieSparkUtils.isSpark3) {
+ withSQLConf(
+ "hoodie.schema.on.read.enable" -> "true",
+ "spark.sql.ansi.enabled" -> "false",
+ "spark.sql.parquet.enableVectorizedReader" -> "true",
+ "hoodie.parquet.small.file.limit" -> "0"
+ ) {
+ withTempDir { tmp =>
+ val tableName = generateTableName
+ val tablePath = s"${tmp.getCanonicalPath}/$tableName"
+
+ spark.sql(
+ s"""
+ |create table $tableName (
+ | id int,
+ | price int,
+ | ts long
+ |) using hudi
+ | location '$tablePath'
+ | tblproperties (
+ | type = '$tableType',
+ | primaryKey = 'id',
+ | orderingFields = 'ts'
+ | )
+ |""".stripMargin)
+
+ spark.sql(s"insert into $tableName values (1, 12345, 1000)")
Review Comment:
Good suggestions. Added both in `889b09ac6c27`.
The INT regression test now includes `12345` and `12` in the same batch,
expecting `NULL` and `12.00` respectively. This exercises the `putNull` /
`putDecimal` interleaving in the same vector.
I also added a BIGINT case with `9223372036854775807 -> DECIMAL(20, 2)`,
which exercises the LONG source path and the precision > 18 target vector path.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]