-
Notifications
You must be signed in to change notification settings - Fork 994
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
PHOENIX-6267 View Index PK Fixed Width Field Truncation #1021
Conversation
💔 -1 overall
This message was automatically generated. |
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.
Thanks for the quick fix. Mostly nits around the tests
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
Outdated
Show resolved
Hide resolved
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
Show resolved
Hide resolved
+ " CONSTRAINT PK PRIMARY KEY (ORGANIZATION_ID, KEY_PREFIX)" | ||
+ " )VERSIONS=1, IMMUTABLE_ROWS=%s, MULTI_TENANT=%s, REPLICATION_SCOPE=1, IMMUTABLE_STORAGE_SCHEME=ONE_CELL_PER_COLUMN, COLUMN_ENCODED_BYTES=0", fullTableName, (isNamespaceMapped? "true" : "false"),(isNamespaceMapped? "true" : "false")); | ||
String viewDdl = String.format("CREATE VIEW IF NOT EXISTS %s (DATE_TIME1 DATE NOT NULL, TEXT1 VARCHAR, TEXT3 VARCHAR, INT1 BIGINT NOT NULL, DATE_TIME2 DATE, DATE_TIME3 DATE, INT2 BIGINT, INT3 INTEGER, DOUBLE1 DECIMAL(12, 3), " | ||
+ "DOUBLE2 DECIMAL(12, 3), DOUBLE3 DECIMAL(12, 3), TEXT2 VARCHAR, TEXT4 VARCHAR, EMAIL1 VARCHAR, PHONE1 VARCHAR, URL1 VARCHAR " |
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.
Do we need this many fields to reproduce the issue / prove its fixed? Looks like we never use more than 5 at a time?
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.
@gjacoby126 Let's keep it so that we can play with more scenarios in the future :)
I had to change the code a bit because unit tests were failing. Now the code looks more like the the datarowkey generation.
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
Outdated
Show resolved
Hide resolved
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
Outdated
Show resolved
Hide resolved
9bb4171
to
702a63d
Compare
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 left some minor comments. LGTM.
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
Show resolved
Hide resolved
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
Outdated
Show resolved
Hide resolved
702a63d
to
7a4dc7b
Compare
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
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.
+1, Thanks!
output.writeByte(SchemaUtil.getSeparatorByte(rowKeyOrderOptimizable, ptr.getLength() == 0, isIndexColumnDesc ? SortOrder.DESC : SortOrder.ASC)); | ||
byte sepByte = SchemaUtil.getSeparatorByte(rowKeyOrderOptimizable, ptr.getLength() == 0, isIndexColumnDesc ? SortOrder.DESC : SortOrder.ASC); | ||
output.writeByte(sepByte); | ||
trailingVariableWitdthColumnNum++; |
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.
nit: variable name not spelled correctly (Width not Witdth)
phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
Outdated
Show resolved
Hide resolved
7a4dc7b
to
456d816
Compare
phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
Outdated
Show resolved
Hide resolved
💔 -1 overall
This message was automatically generated. |
456d816
to
a0e7ed1
Compare
💔 -1 overall
This message was automatically generated. |
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.
Thank you very much for the extensive testing on this. +1
upsertStmt.executeUpdate(); | ||
conn2.commit(); | ||
|
||
String select = "SELECT INT1 FROM " + childViewName |
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.
@gokceni @kadirozde Shouldn't this be checking whatever the last column of the view PK is, to see if it's been truncated or not? In some of your test cases calling this method, INT1 is not the end of the view PK.
I'd expect cases where, say, it ends in a text field to have a String whose ending is either SEPARATOR_BYTE or DESC_SEPARATOR_BYTE as appropriate and verify that the String isn't truncated. Or have I misunderstood the purpose of the test?
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.
Yes, whatever the last PK column is, we need to check its value. I missed that we only check INT1 here. Good catch! The test method can take extra input for the last PK column and expected value for it and verify 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.
Check it out. Most of the time, they were all ending with INT1. There is a couple of double and text too. @gjacoby126
a0e7ed1
to
bef67c8
Compare
💔 -1 overall
This message was automatically generated. |
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.
Thanks @gokceni ! +1
JIRA is resolved, closing PR. |
No description provided.