[
https://issues.apache.org/jira/browse/PHOENIX-1030?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14158969#comment-14158969
]
James Taylor commented on PHOENIX-1030:
---------------------------------------
Looks good, [~tdsilva]. Thanks for the contributions. I'm going to commit
these, but would you mind making one minor follow on change. For our TRUE/FALSE
constants in LiteralExpression, we should have a static for each possible
option of Determinism:
{code}
+ private static final LiteralExpression FALSE_EXPRESSION = new
LiteralExpression(Boolean.FALSE, PDataType.BOOLEAN,
PDataType.BOOLEAN.toBytes(Boolean.FALSE), Determinism.ALWAYS);
+ private static final LiteralExpression TRUE_EXPRESSION = new
LiteralExpression(Boolean.TRUE, PDataType.BOOLEAN,
PDataType.BOOLEAN.toBytes(Boolean.TRUE), Determinism.ALWAYS);
+ private static final LiteralExpression ND_FALSE_EXPRESSION = new
LiteralExpression(Boolean.FALSE, PDataType.BOOLEAN,
PDataType.BOOLEAN.toBytes(Boolean.FALSE), Determinism.PER_ROW);
+ private static final LiteralExpression ND_TRUE_EXPRESSION = new
LiteralExpression(Boolean.TRUE, PDataType.BOOLEAN,
PDataType.BOOLEAN.toBytes(Boolean.TRUE), Determinism.PER_ROW);
{code}
Just use a loop instead, where you statically initialize a LiteralExpression
BOOLEAN[][], where the first dimension is via the boolean and the second one is
via the determinism.values(). Then you can look it up given a True/False and a
Determinism enum.
> Change Expression.isDeterministic() to return an ENUM with three values
> {DETERMINISTIC, UNDETERMINISTIC_ROW, UNDETERMINISTIC_STMT}
> ----------------------------------------------------------------------------------------------------------------------------------
>
> Key: PHOENIX-1030
> URL: https://issues.apache.org/jira/browse/PHOENIX-1030
> Project: Phoenix
> Issue Type: Improvement
> Reporter: Thomas D'Silva
> Assignee: Thomas D'Silva
> Attachments: PHOENIX-1030-3.0.patch, PHOENIX-1030-3.0.patch,
> PHOENIX-1030-3.0.patch, PHOENIX-1030-4.0.patch, PHOENIX-1030-4.0.patch,
> PHOENIX-1030-master.patch
>
>
> Change Expression.isDeterministic() to return an ENUM with three values
> DETERMINISTIC - the expression returns the same output every time given the
> same input.
> UNDETERMINISTIC_ROW - the expression should be computed for every row
> UNDETERMINISTIC_STMT - the expression should be be computed for a given
> statement only once
> See PHOENIX-1001
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)