PHOENIX-933 Local index support to Phoenix

There's a bit more you need to do to handle ORDER BY correctly. It'd be for the case in which a data column was referenced in the ORDER BY while the index table is being used to satisfy the query. Not here, but in [OrderedResultIterator](https://github.com/apache/phoenix/blob/master/phoenix-core/src/main/java/org/apache/phoenix/iterate/OrderedResultIterator.java). In getResultIterator, in the beginning of the for loop, you'll need to wrap the result in the same way if there are dataColumns (i.e. call IndexUtil.wrapResultUsingOffset)

            for (Tuple result = delegate.next(); result != null; result = delegate.next()) {
                int pos = 0;
                ImmutableBytesWritable[] sortKeys = new ImmutableBytesWritable[numSortKeys];
                for (Expression expression : expressions) {
                    final ImmutableBytesWritable sortKey = new ImmutableBytesWritable();
                    boolean evaluated = expression.evaluate(result, sortKey);
                    // set the sort key that failed to get evaluated with null
                    sortKeys[pos++] = evaluated && sortKey.getLength() > 0 ? sortKey : null;
                }
                queueEntries.add(new ResultEntry(sortKeys, result));
            }

Without this, the table data column expressions that aren't in the local index will fail to evaluate. You should add a test for this too.

I think the cleanest way to handle this is by wrapping the ResultIterator passed into the OrderedResultIterator. Just create a new ResultIterator that delegates to the original one and does the wrapping necessary. Then you won't need to change OrderedResultIterator at all.