-
Notifications
You must be signed in to change notification settings - Fork 133
IGNITE-19893: Sql. Add plan checks to BaseIndexDataTypeTest. #2422
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
Conversation
...onTest/java/org/apache/ignite/internal/sql/engine/datatypes/tests/BaseIndexDataTypeTest.java
Show resolved
Hide resolved
| } | ||
|
|
||
| // No need to binary between char and varbinary. | ||
| if (SqlTypeUtil.isBinary(toType) && SqlTypeUtil.isBinary(fromType)) { |
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.
this check is not operate with char types at all, why char is mentioned here ? also "No need to binary" is sounds strange, isn`t it ?
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.
That was a typo, thanks.
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.
I still think that such kind of fix is looks like a stub, varchar(default_precision) and varchar need to be equal types is not it ?
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.
What kind of fix are we talking about - you mean rewriting logic related to creating reldata types with default precision/scale?
Add missing check.
fix style issues.
Add comments that clarifies checks for binary/char types.
Add comments that clarifies checks for binary/char types.
Add test label.
update comment.
|
Removed the remaining outdated information from javadocs of |
zstan
left a comment
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.
overall looks good, instead of still possible cast from char to varbinary (check comments) probably you can fix it ?
| * <ul> | ||
| * <li>{@code <type>} - an SQL name of a data type.</li> | ||
| * <li>{@code $N} - the {@code N-th} value from sample values (0-based), converted to an SQL expression by | ||
| * {@link DataTypeTestSpec#toValueExpr(Comparable)} call (0-based)</li> |
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.
not always converted by DataTypeTestSpec#toValueExpr i suppose ? but after change :
if (useLiterals) {
placeHolderValue = testTypeSpec.toLiteral(value);
} else {
placeHolderValue = testTypeSpec.toValueExpr(value);
}
toLiteral - is used ?
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.
Fixed.
| case LITERAL: | ||
| return spec.toLiteral(value); | ||
| case CAST: { | ||
| String str = spec.toStringValue(value); |
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.
https://issues.apache.org/jira/browse/IGNITE-20185 will reject casting from char to varbinary i.e. '1'::varbinary would be rejected, also it`s not allowed by standard. But i also understand that this is without the scope of this issue but if you can easily fix it - it would be great.
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.
Replaced string literals with binary literals.
Fix CASTs - use casts from VARBINARY literal instead of CHAR literals.
|
|
||
| @BeforeAll | ||
| public void createTable() { | ||
| runSql("CREATE TABLE varbinary_fixed_length(id INTEGER PRIMARY KEY, test_key VARBINARY(10))"); |
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.
VARBINARY is variable length BINARY type.
What does varbinary_fixed_length mean?
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.
If you mean we could create columns as
col1 VARBINARY,
col2 VARBINARY(10)
then, actually, col1 will have a max length as well.
We always create VARBINARY/VARCHAR column with specific length, which is 65k by default as I remember.
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.
VARBINARY is variable length BINARY type.
What does varbinary_fixed_length mean?
Right now VARBINARY(n) works exactly the same way as does BINARY(n). If this is a bug, I can replace VARBINARY(n) with BINARY(n) here, I could file an issue to fix this.
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.
Removed varbinary_fixed_length as it duplicates test cases defined in base class.
Remove redundant case.
|
Unmuted |
|
@lowka can you merge fresh main plz ? |
|
@zstan Merged the latest main into this PR. |
| private static Stream<Arguments> indexChecks() { | ||
| return Stream.of( | ||
| Arguments.of(Named.of("VARBINARY_DEFAULT_LENGTH", "T"), ValueMode.LITERAL), | ||
| //Arguments.of(Named.of("VARBINARY_DEFAULT_LENGTH", "T"), ValueMode.CAST), |
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.
plz remove this comment.
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.
Fixed.
…ort-based map/reduce aggregates. cleanup.
Adds index usage checks to
BaseIndexDataTypeTest. In addition to that fixes the issue with VARBINARY, mentioned in issue's comment.https://issues.apache.org/jira/browse/IGNITE-19893
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