phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Geoffrey Jacoby (Jira)" <>
Subject [jira] [Created] (PHOENIX-6267) View Index PK Fixed Width Field Truncation
Date Wed, 16 Dec 2020 21:59:00 GMT
Geoffrey Jacoby created PHOENIX-6267:

             Summary: View Index PK Fixed Width Field Truncation 
                 Key: PHOENIX-6267
             Project: Phoenix
          Issue Type: Bug
    Affects Versions: 4.14.3, 4.15.0, 5.0.0
            Reporter: Geoffrey Jacoby
            Assignee: Gokcen Iskender
             Fix For: 5.1.0, 4.16.0

1. Create a table T
2. Create a view V that extends the PK of T, where the last field of the view's PK is a fixed
width column C such as an INTEGER or BIGINT
3. Create a view index VI on V that does NOT contain C in its index key
4. Select C from the view with a query that runs against the view index

You will get the following error: 

 java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at least 8 bytes,
but had 7

[~giskender], [~kadir], [~tkhurana] and I investigated. It appears the problem comes from


            int length = stream.size();
            int minLength = length - maxTrailingNulls;
            byte[] indexRowKey = stream.getBuffer();
            // Remove trailing nulls
            while (length > minLength && indexRowKey[length-1] == QueryConstants.SEPARATOR_BYTE)

The logic to remove trailing separator bytes shouldn't run if the end of the index key (i.e
the end of the base PK) is a fixed width column. Otherwise, we'll truncate whenever the last
byte of the fixed width field happens to be \x00

This message was sent by Atlassian Jira

View raw message