Read a numeric column's length as its total digits, fixes #8216Read a numeric column's length as its total digits, fixes #8216 - #8242
Open
fskorgen wants to merge 1 commit into
Conversation
Contributor
|
Thanks for the investigation — the round-trip failure is real (#8216). This PR cannot land as written against current main. #8216 is fixed in mattcasters/hop#issue-8218 / the follow-up PR on apache/hop by:
Please close this PR in favour of that one once it is up. |
Contributor
|
The replacement is #8244 |
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.
numericLength() took the scale off the precision the database reports, so decimal(5,2) arrived as Hop length 3. Every getFieldDefinition writes a scaled column as DECIMAL(length, precision), and a length typed into a transform dialog means the same total — so the length read off a column matched neither. A table re-created from a read stopped round-tripping: decimal(24,15) becomes DECIMAL(9,15), which SQL Server refuses, and decimal(5,2) becomes DECIMAL(3,2), which is valid DDL that then rejects valid data.
The subtraction is kept as integerDigits() for the two rules that test whether a declaration is possible at all, so no dialect rule changes behaviour. Oracle's two require scale <= 0, where it never applied.
JdbcTypeMappingCharacterizationTest: 63 diverging lines become 16, and the live path now agrees with the legacy mapper on every numeric case. New MsSqlServerNumericRoundTripTest fails without this change with expected: <DECIMAL(5,2)> but was: <DECIMAL(3,2)>.
Fixes #8216
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean install apache-rat:checkto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.git rebase -i.addresses #123), if applicable.To make clear that you license your contribution under the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.