[
https://issues.apache.org/jira/browse/PHOENIX-1687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14584331#comment-14584331
]
James Taylor commented on PHOENIX-1687:
---------------------------------------
In JavaMathTwoArgumentFunction, this code should not be necessary because of
the way default values work in Phoenix:
{code}
+ if (arg2Expr == null || ptr.getLength() == 0) {
+ if (isSecondArgHasDefaultValue()) {
+ arg2 = getSecondArgDefaultValue();
+ } else {
+ // argument 1 is not null, but argument 2 is null and has no
+ // default value. so we should return false here.
+ return false;
+ }
{code}
Instead, you can do this:
{code}
if (arg2Expr == null || ptr.getLength() == 0) {
ptr.set(ByteUtil.EMPTY_BYTE_ARRAY);
return true;
}
{code}
The arg2Expr will already be bound to the default value as a literal
expression, so it should just work (if not, then there's a bug somewhere).
Otherwise, looks great!
> Implement missing math built-in POWER function
> ----------------------------------------------
>
> Key: PHOENIX-1687
> URL: https://issues.apache.org/jira/browse/PHOENIX-1687
> Project: Phoenix
> Issue Type: Sub-task
> Reporter: Aakarsh Agarwal
> Assignee: Shuxiong Ye
> Labels: gsoc2015, java
> Fix For: 5.0.0, 4.5.0
>
> Attachments: add-function-PHOENIX-1611-1687-2015-2019-2020_v2.patch
>
>
> Take a look at the typical math functions that are implemented in relational
> database systems
> (http://www.postgresql.org/docs/current/static/functions-math.html) and
> implement the same for Phoenix in Java following this guide:
> http://phoenix-hbase.blogspot.com/2013/04/how-to-add-your-own-built-in-function.html
> For this specific task, it is meant to implement missing funstion POWER for
> Phoenix in Java.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)