[
https://issues.apache.org/jira/browse/PHOENIX-761?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14094842#comment-14094842
]
James Taylor commented on PHOENIX-761:
--------------------------------------
Take a look at the implementation of other implementations of KeyPart. For
example, in PrefixFunction:
{code}
@Override
public KeyPart newKeyPart(final KeyPart childPart) {
{code}
The default implementation of ScalarFunction.newKeyPart doesn't do anything.
The idea is that given a function and it's arguments, can you infer a
start/stop range for a given column. A simple example is:
{code}
SELECT * FROM t WHERE substr(pk1, 1, 3) = 'foo'
{code}
In this case (assuming pk1 is the leading pk column), we can formulate that the
start key is 'foo' and the end key is 'fop'. This knowledge needs to live on a
particular scalar function implementation, as it depends on the built-in
function.
This JIRA is around doing the same optimization, but when
ROUND/TRUNC/FLOOR/CEIL are used. An example would be:
{code}
SELECT * FROM t WHERE floor(pk1, 1) = 12.5
{code}
We currently don't optimize this, but we should/could form a KeyPart with a
range from 12.50 - 12.59. The implementation will be similar to the one for
PrefixFunction.
> Implement getKeyPart for round/ceil/floor of a DECIMAL value
> ------------------------------------------------------------
>
> Key: PHOENIX-761
> URL: https://issues.apache.org/jira/browse/PHOENIX-761
> Project: Phoenix
> Issue Type: Task
> Affects Versions: 3.0-Release
> Reporter: James Taylor
> Assignee: Kyle Buzsaki
>
--
This message was sent by Atlassian JIRA
(v6.2#6252)