-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Fix inferring type of decimals with leading zeros in MongoDB #19068
Fix inferring type of decimals with leading zeros in MongoDB #19068
Conversation
@SemionPar PTAL also, you're not in https://github.com/orgs/trinodb/teams/contributors so I can't add you as a reviewer. @wendigo @hashhar can you maybe add Semion there? Or only org admins can? |
People get added (automatically) after they've submitted and merged a PR. No exceptions. |
plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTypeMapping.java
Show resolved
Hide resolved
plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoSession.java
Show resolved
Hide resolved
ddcfd8d
to
f29ad97
Compare
plugin/trino-mongodb/src/test/java/io/trino/plugin/mongodb/TestMongoTypeMapping.java
Show resolved
Hide resolved
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.
LGTM
It'll be useful to audit whether existing type mapping tests include values < 1 for other connectors as well. e.g. BigQuery also goes via BigDecimal (though we don't need to infer the precision and scale there).
@ebyhr Do you want to take a look? |
Description
Trying to read collections with fractional decimal values like
0.03
was throwing an exception.Java's
BigDecimal.precision()
returns precision for the unscaled value, so it skips leading zeros. SQL decimal's precision must include leading zeros in values less than 1.Additional context and related issues
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.
(x) Release notes are required, with the following suggested text: