Skip to content
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

ISPN-14138 SQL Store fail to persist numbers with fractional portion #10308

Merged
merged 1 commit into from Sep 28, 2022

Conversation

wburns
Copy link
Member

@wburns wburns commented Sep 13, 2022

@wburns wburns added the On Hold label Sep 13, 2022
@wburns
Copy link
Member Author

wburns commented Sep 13, 2022

@gustavolira Do you think we can test this on the various DB providers?

@alanfx
Copy link
Contributor

alanfx commented Sep 13, 2022

Hey @wburns and @gustavolira, does the test suite have tests that store and retrieve each kind of data type? Given this issue and the one with Booleans, it seems like it would be good to have!

@wburns
Copy link
Member Author

wburns commented Sep 13, 2022

Hey @wburns and @gustavolira, does the test suite have tests that store and retrieve each kind of data type? Given this issue and the one with Booleans, it seems like it would be good to have!

That is what I have expanded upon with the recent tests. To be honest my problem is I don't know what all the various types a user would use are :( But I can try to find others that we aren't testing, like I know float isn't explicitly tested, but should work.

@wburns wburns force-pushed the numeric_sql_store branch 4 times, most recently from f5d1e98 to eecba36 Compare September 16, 2022 17:32
@wburns wburns changed the title Change numeric to use DOUBLE and add double type ISPN-14138 SQL Store fail to persist numbers with fractional portion Sep 16, 2022
@wburns
Copy link
Member Author

wburns commented Sep 16, 2022

Updated to make sure Numeric with decimals work, added support for Real and Decimal types.

@wburns wburns removed the On Hold label Sep 20, 2022
@wburns wburns added this to the 14.0.0.Final milestone Sep 26, 2022
@@ -110,6 +110,9 @@ int typeWeUse(int sqlType, String typeName) {
} else if (typeName.toUpperCase().startsWith("BOOL")) {
// Some databases store as int32 or something similar but have the typename as BOOLEAN or some derivation
return Types.BOOLEAN;
} else if (sqlType == Types.NUMERIC && scale == 0) {
// If scale is 0 we don't want to use float or double types
return Types.INTEGER;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be on the safe side, should we use a BIGINT for this case or it is overkill?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This keeps it inline with what we had before, as NUMERIC was always being assigned to an INTEGER (which is required for Oracle "boolean" types). The big difference is if the scale is not 0 we assign it to DOUBLE protostream type.

We could possibly assign it to BIGINT if the precision is higher though. I can try to prototype something like that. I had thought about it before but was trying to change as little as possible.

@tristantarrant
Copy link
Member

@wburns conflicts need to be resolved

@wburns
Copy link
Member Author

wburns commented Sep 27, 2022

Yeah, I already resolved, was working on changing the types. But I am not having luck, I am going to say for this PR just leave it as is and we can enhance it further later.

@wburns
Copy link
Member Author

wburns commented Sep 27, 2022

Rebased.

@jabolina
Copy link
Member

@wburns Couple of related failures in CI.

@wburns
Copy link
Member Author

wburns commented Sep 27, 2022

@wburns Couple of related failures in CI.

Ah, yes, good catch.. Fixing.

* Added support for Numeric
* Added support for Decimal
* Fixed Numeric to support decimals
** Numeric with 0 scale is still Integer
@wburns
Copy link
Member Author

wburns commented Sep 27, 2022

Tests should be good now.

@jabolina jabolina merged commit 3d5d12b into infinispan:main Sep 28, 2022
@jabolina
Copy link
Member

Merged, thanks @wburns

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants