[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-17 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.master.005.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.4.x.001.patch, PHOENIX-6267.4.x.002.patch, 
> PHOENIX-6267.4.x.003.patch, PHOENIX-6267.master.001.patch, 
> PHOENIX-6267.master.002.patch, PHOENIX-6267.master.003.patch, 
> PHOENIX-6267.master.004.patch, PHOENIX-6267.master.005.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-17 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.4.x.003.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.4.x.001.patch, PHOENIX-6267.4.x.002.patch, 
> PHOENIX-6267.4.x.003.patch, PHOENIX-6267.master.001.patch, 
> PHOENIX-6267.master.002.patch, PHOENIX-6267.master.003.patch, 
> PHOENIX-6267.master.004.patch, PHOENIX-6267.master.005.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-17 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.4.x.002.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.4.x.001.patch, PHOENIX-6267.4.x.002.patch, 
> PHOENIX-6267.master.001.patch, PHOENIX-6267.master.002.patch, 
> PHOENIX-6267.master.003.patch, PHOENIX-6267.master.004.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-17 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.master.004.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.4.x.001.patch, PHOENIX-6267.4.x.002.patch, 
> PHOENIX-6267.master.001.patch, PHOENIX-6267.master.002.patch, 
> PHOENIX-6267.master.003.patch, PHOENIX-6267.master.004.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-16 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.4.x.001.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.4.x.001.patch, 
> PHOENIX-6267.master.001.patch, PHOENIX-6267.master.002.patch, 
> PHOENIX-6267.master.003.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-16 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.master.003.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.master.001.patch, 
> PHOENIX-6267.master.002.patch, PHOENIX-6267.master.003.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-16 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Attachment: PHOENIX-6267.master.002.patch

> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> Fix For: 5.1.0, 4.16.0
>
> Attachments: PHOENIX-6267.master.001.patch, 
> PHOENIX-6267.master.002.patch
>
>
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Updated] (PHOENIX-6267) View Index PK Fixed Width Field Truncation

2020-12-16 Thread Gokcen Iskender (Jira)


 [ 
https://issues.apache.org/jira/browse/PHOENIX-6267?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gokcen Iskender updated PHOENIX-6267:
-
Description: 
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:
{code:java}
 java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of at 
least 8 bytes, but had 7
{code}
[~giskender], [~kadir], [~tkhurana] and I investigated. It appears the problem 
comes from 
 IndexMaintainer.buildRowKey:707-713
{code:java}
int length = stream.size();
int minLength = length - maxTrailingNulls;
byte[] indexRowKey = stream.getBuffer();
// Remove trailing nulls
while (length > minLength && indexRowKey[length-1] == 
QueryConstants.SEPARATOR_BYTE) {
length--;
}
{code}
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 only happens for view indexes (mutitenant or not)

  was:
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: 

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

[~giskender], [~kadir], [~tkhurana] and I investigated. It appears the problem 
comes from 
IndexMaintainer.buildRowKey:707-713

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

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



> View Index PK Fixed Width Field Truncation 
> ---
>
> Key: PHOENIX-6267
> URL: https://issues.apache.org/jira/browse/PHOENIX-6267
> Project: Phoenix
>  Issue Type: Bug
>Affects Versions: 5.0.0, 4.15.0, 4.14.3
>Reporter: Geoffrey Jacoby
>Assignee: Gokcen Iskender
>Priority: Blocker
> 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:
> {code:java}
>  java.sql.SQLException: ERROR 201 (22000): Illegal data. Expected length of 
> at least 8 bytes, but had 7
> {code}
> [~giskender], [~kadir], [~tkhurana] and I investigated. It appears the 
> problem comes from 
>  IndexMaintainer.buildRowKey:707-713
> {code:java}
> int length = stream.size();
> int minLength = length - maxTrailingNulls;
> byte[] indexRowKey = stream.getBuffer();
> // Remove trailing nulls
> while (length > minLength && indexRowKey[length-1] == 
> QueryConstants.SEPARATOR_BYTE) {
> length--;
> }
> {code}
> 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 only happens for view indexes (mutitenant or not)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)