You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by "Biju Nair (JIRA)" <ji...@apache.org> on 2017/06/06 22:31:18 UTC

[jira] [Commented] (PHOENIX-3917) RowProjector#getEstimatedRowByteSize() returns incorrect value

    [ https://issues.apache.org/jira/browse/PHOENIX-3917?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16039785#comment-16039785 ] 

Biju Nair commented on PHOENIX-3917:
------------------------------------

Looking through the code for {{ProjectionCompiler#compile}} where the projection size is calculated, looks the [logic to calculate the size|https://github.com/apache/phoenix/blob/e7629ca39224e7cbc49e8a7740ed96877a16df76/phoenix-core/src/main/java/org/apache/phoenix/compile/ProjectionCompiler.java#L471-L491] need to be moved a bit further after
{code}
    if (isWildcard) {
            projectAllColumnFamilies(table, scan);
        } else {
            isProjectEmptyKeyValue = where == null || LiteralExpression.isTrue(where) || where.requiresFinalEvaluation();
            for (byte[] family : projectedFamilies) {
                projectColumnFamily(table, scan, family);
            }
        }
{code}

Also if the column projected in the query is only the key column, the size of the key column need to be set to the estimated size of the {{RowProjector}}. After making the changes the size returned are 4 and 72 respectively for the queries mentioned in the description of this issue where both the columns {{A_ID}} and {{A_DATA}} are of the {{int}}. If this fix is correct let me know and I can provide a patch.

> RowProjector#getEstimatedRowByteSize() returns incorrect value
> --------------------------------------------------------------
>
>                 Key: PHOENIX-3917
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-3917
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: Biju Nair
>            Priority: Minor
>
> {{queryPlan..getProjector().getEstimatedRowByteSize()}} returns "0" for a query {{SELECT A_ID FROM TABLE}} where {{A_ID}} is Primary Key. Same is the case for the query {{SELECT A_ID, A_DATA FROM TABLE}} where {{A_DATA}} is a non key column. Assuming that the method is meant to return the estimated number of bytes from the query projection the returned value of 0 is incorrect.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)