IGNITE-23172 Sql. Lack of bounds validation in CAST(1 as DECIMAL(MAX_PREC, MAX_SCALE))#4566
Merged
korlov42 merged 7 commits intoapache:mainfrom Oct 16, 2024
Merged
IGNITE-23172 Sql. Lack of bounds validation in CAST(1 as DECIMAL(MAX_PREC, MAX_SCALE))#4566korlov42 merged 7 commits intoapache:mainfrom
korlov42 merged 7 commits intoapache:mainfrom
Conversation
...e/src/integrationTest/java/org/apache/ignite/internal/sql/engine/ItDynamicParameterTest.java
Outdated
Show resolved
Hide resolved
- add test for precision and scale less than default one
ygerzhedovich
approved these changes
Oct 16, 2024
xtern
approved these changes
Oct 16, 2024
| private static final IgniteSchema SCHEMA = createSchemaWithTwoColumnTable(NativeTypes.STRING, NativeTypes.STRING); | ||
|
|
||
| private static final NativeType DECIMAL_MAX_PREC = NativeTypes.decimalOf(MAX_DECIMAL_PRECISION, 0); | ||
| private static final NativeType DECIMAL_DYN_PARAM_DEFAULT = NativeTypes.decimalOf(28, 6); |
Contributor
There was a problem hiding this comment.
why not use DECIMAL_DYNAMIC_PARAM_PRECISION and DECIMAL_DYNAMIC_PARAM_SCALE constants?
I mean
NativeTypes.decimalOf(DECIMAL_DYNAMIC_PARAM_PRECISION, DECIMAL_DYNAMIC_PARAM_SCALE);
| if (type == ColumnType.TIME || type == ColumnType.TIMESTAMP || type == ColumnType.DATETIME) { | ||
| param = SqlTestUtils.generateValueByType(type, 3, -1); | ||
| } else if (type == ColumnType.DECIMAL) { // by default derived type of parameter of type BigDecimal is DECIMAL(28, 6) | ||
| param = SqlTestUtils.generateValueByType(type, 28, 6); |
added 3 commits
October 16, 2024 16:21
- replaced magic constant in test with const values
5 tasks
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.
https://issues.apache.org/jira/browse/IGNITE-23172
This patch changes the rules for type derivation of dynamic param for BigDecimal:
Thank you for submitting the pull request.
To streamline the review process of the patch and ensure better code quality
we ask both an author and a reviewer to verify the following:
The Review Checklist
- There is a single JIRA ticket related to the pull request.
- The web-link to the pull request is attached to the JIRA ticket.
- The JIRA ticket has the Patch Available state.
- The description of the JIRA ticket explains WHAT was made, WHY and HOW.
- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
Notes