[ https://issues.apache.org/jira/browse/PHOENIX-6402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17298438#comment-17298438 ]
ASF GitHub Bot commented on PHOENIX-6402: ----------------------------------------- lhofhansl commented on a change in pull request #1159: URL: https://github.com/apache/phoenix/pull/1159#discussion_r590841086 ########## File path: phoenix-core/src/main/java/org/apache/phoenix/iterate/RegionScannerFactory.java ########## @@ -205,6 +210,22 @@ public boolean nextRaw(List<Cell> result) throws IOException { */ IndexUtil.wrapResultUsingOffset(env, result, offset, dataColumns, tupleProjector, dataRegion, indexMaintainer, viewConstants, ptr); + + byte[] expBytes = scan.getAttribute(BaseScannerRegionObserver.LOCAL_INDEX_FILTER); + if (expBytes != null) { + ByteArrayInputStream stream = new ByteArrayInputStream(expBytes); + DataInputStream input = new DataInputStream(stream); + Expression extraWhere = ExpressionType.values()[WritableUtils.readVInt(input)].newInstance(); Review comment: This is lightweight. But I do agree. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Allow using local indexes with uncovered columns in the WHERE clause > -------------------------------------------------------------------- > > Key: PHOENIX-6402 > URL: https://issues.apache.org/jira/browse/PHOENIX-6402 > Project: Phoenix > Issue Type: Improvement > Reporter: Lars Hofhansl > Assignee: Lars Hofhansl > Priority: Blocker > Fix For: 5.1.1, 4.16.1, 5.2.0 > > Attachments: 6402-5.1-v4.txt, 6402-WIP-5.1-v2.txt, > 6402-WIP-5.1-v3.txt, 6402-WIP-5.1.txt > > > In PHOENIX-6400 I had to disable using local index when uncovered columns are > referenced in the WHERE clause. > There are two problems: > # The uncovered columns are represented as ProjectedColumnExpression and not > correctly added as filters by the WhereCompiler > # The scanner produced in RegionScannerFactory.getWrappedScanner does not > handle this correctly. > [~kozdemir] and I brainstormed this today. > What should happen is this: > * Do not add uncovered column expression as filters for local indexes (they > would not be evaluated at right time) > * Pass the extra filter expression via a scan attribute > * Do something similar to what we do with conditional expressions (see > PhoenixIndexBuilder.executeAtomicOp), where we assemble the complete tuple, > then run the filter expression over it. > This would probably require some surgery, so filing it here as an Improvement > in case someone signs up for it :) -- This message was sent by Atlassian Jira (v8.3.4#803005)