-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-37196][SQL] HiveDecimal enforcePrecisionScale failed return null #34519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the behavior of builtin file source tables? do we also return null?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and what's the behavior if we do it purely in Hive?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Hmmm, non vectorized parquet reader return null as well, vectorized reader throw below exception
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| @SlowHiveTest | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use
CAST(1.2 AS DECIMAL(38, 16))instead of writing a long decimal literal?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't, it's an enforce convert.