Add numeric integer to decimal coercion for hive tables#20024
Merged
losipiuk merged 1 commit intotrinodb:masterfrom Dec 7, 2023
Merged
Conversation
55c7aaa to
eecd2d6
Compare
eecd2d6 to
ecf5108
Compare
ecf5108 to
ecb5bbf
Compare
dain
reviewed
Dec 6, 2023
Member
dain
left a comment
There was a problem hiding this comment.
Just one comment, but otherwise looks good
plugin/trino-hive/src/test/java/io/trino/plugin/hive/coercions/TestDecimalCoercers.java
Outdated
Show resolved
Hide resolved
c902ba9 to
8046516
Compare
Contributor
Author
@dain I got a distracted while doing the first version of the PR and haven't considered the edge cases. The PTs went 🟢 on my machine, but this happened due to the fact that apparently I was running an older version of the code :(. |
8046516 to
9f9b097
Compare
Contributor
Author
|
CI failure |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add tinyint/smallint/integer/bigint to decimal coercion for hive tables.
Enable the Hive users to retrieve the information from their tables after performing queries which change numeric integer columns to decimal.
The numeric integer values which overflow the target decimal type (either because they exceed the declared precision of the type to coerce to or because along with the scale of the target decimal type they get too big) will be considered (same as in Hive) as
NULLvalues.Additional context and related issues
Fixes #19931
PoC for dealing with writing decimal values
trino/lib/trino-hive-formats/src/main/java/io/trino/hive/formats/HiveFormatUtils.java
Lines 155 to 167 in ae7849e
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: