cloud-fan commented on a change in pull request #34519:
URL: https://github.com/apache/spark/pull/34519#discussion_r744689565
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2642,6 +2642,23 @@ abstract class SQLQuerySuiteBase extends QueryTest with
SQLTestUtils with TestHi
}
}
}
+
+ test("SPARK-37196: HiveDecimal Precision Scale match failed should return
null") {
+ withTempDir { dir =>
+ withSQLConf(HiveUtils.CONVERT_METASTORE_PARQUET.key -> "false") {
+ withTable("test_precision") {
+ val df = sql("SELECT 'dummy' AS name,
1000000000000000000010.7000000000000010 AS value")
+ df.write.mode("Overwrite").parquet(dir.getAbsolutePath)
+ sql(
+ s"""
+ |CREATE EXTERNAL TABLE test_precision(name STRING, value
DECIMAL(18,6))
+ |STORED AS PARQUET LOCATION '${dir.getAbsolutePath}'
+ |""".stripMargin)
+ checkAnswer(sql("SELECT * FROM test_precision"), Row("dummy", null))
Review comment:
and what's the behavior of we do it purely in Hive?
##########
File path:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/SQLQuerySuite.scala
##########
@@ -2642,6 +2642,23 @@ abstract class SQLQuerySuiteBase extends QueryTest with
SQLTestUtils with TestHi
}
}
}
+
+ test("SPARK-37196: HiveDecimal Precision Scale match failed should return
null") {
+ withTempDir { dir =>
+ withSQLConf(HiveUtils.CONVERT_METASTORE_PARQUET.key -> "false") {
+ withTable("test_precision") {
+ val df = sql("SELECT 'dummy' AS name,
1000000000000000000010.7000000000000010 AS value")
+ df.write.mode("Overwrite").parquet(dir.getAbsolutePath)
+ sql(
+ s"""
+ |CREATE EXTERNAL TABLE test_precision(name STRING, value
DECIMAL(18,6))
+ |STORED AS PARQUET LOCATION '${dir.getAbsolutePath}'
+ |""".stripMargin)
+ checkAnswer(sql("SELECT * FROM test_precision"), Row("dummy", null))
Review comment:
and what's the behavior if we do it purely in Hive?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]