You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/12/17 03:03:29 UTC

[GitHub] [phoenix] kadirozde commented on a change in pull request #1021: PHOENIX-6267 View Index PK Fixed Width Field Truncation

kadirozde commented on a change in pull request #1021:
URL: https://github.com/apache/phoenix/pull/1021#discussion_r544767486



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
##########
@@ -695,16 +696,19 @@ private Void addDataColInfo(final PTable dataTable, Expression expression) {
                     }
                 }
                 if (!indexColumnType.isFixedWidth()) {
-                    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);
+                    if (sepByte == QueryConstants.SEPARATOR_BYTE) {
+                        maxTrailingNullsForIndex++;
+                    } else {
+                        maxTrailingNullsForIndex = 0;
+                    }
+                } else {
+                    maxTrailingNullsForIndex = 0;
                 }
             }
-            int length = stream.size();
-            int minLength = length - maxTrailingNulls;
             byte[] indexRowKey = stream.getBuffer();
-            // Remove trailing nulls

Review comment:
       This comment is still needed.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org