phoenix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Taylor (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PHOENIX-1312) Do not always project the empty column family
Date Mon, 14 Dec 2015 21:31:46 GMT

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

James Taylor commented on PHOENIX-1312:
---------------------------------------

The code is already in place to use the correct column family guideposts: see BaseResultIterators.getGuidePosts().

The problem is that the empty column family is always projected (which causes that guideposts
to always be used). The code that needs to change is in BaseResultIterators.initializeScan()
here:
{code}
            if (projector.isProjectEmptyKeyValue()) {
                // If nothing projected into scan and we only have one column family, just
allow everything
                // to be projected and use a FirstKeyOnlyFilter to skip from row to row. This
turns out to
                // be quite a bit faster.
                // Where condition columns also will get added into familyMap
                // When where conditions are present, we can not add FirstKeyOnlyFilter at
beginning.
                if (familyMap.isEmpty() && context.getWhereCoditionColumns().isEmpty()
                        && table.getColumnFamilies().size() == 1) {
                    // Project the one column family. We must project a column family since
it's possible
                    // that there are other non declared column families that we need to ignore.
                    scan.addFamily(table.getColumnFamilies().get(0).getName().getBytes());
                } else {
                    byte[] ecf = SchemaUtil.getEmptyColumnFamily(table);
                    // Project empty key value unless the column family containing it has
                    // been projected in its entirety.
                    // TODO: Only project empty column family when necessary
                    if (!familyMap.containsKey(ecf) || familyMap.get(ecf) != null) {
                        scan.addColumn(ecf, QueryConstants.EMPTY_COLUMN_BYTES);
                    }
                }
            } else if (table.getViewType() == ViewType.MAPPED) {
                // Since we don't have the empty key value in MAPPED tables, we must select
all CFs in HRS. But only the
                // selected column values are returned back to client
                // TODO: Only add all families if necessary
                for (PColumnFamily family : table.getColumnFamilies()) {
                    scan.addFamily(family.getName().getBytes());
                }
            }
{code}

You'll need a couple of new APIs - let me get those to you. If you can start writing the tests,
that'd be good.

> Do not always project the empty column family
> ---------------------------------------------
>
>                 Key: PHOENIX-1312
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-1312
>             Project: Phoenix
>          Issue Type: Bug
>            Reporter: James Taylor
>            Assignee: ramkrishna.s.vasudevan
>             Fix For: 4.7.0
>
>         Attachments: PHOENIX-1312_1.patch, Phoenix-1312.patch
>
>
> Often times, we don't need to, but it seems we always are. See MultiCfQueryExecIT.testGuidePostsForMultiCFs()
where we run a query like this:
> {code}
> SELECT count(*) FROM multi_cf WHERE e.cpu_utilization IS NOT NULL
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message