[
https://issues.apache.org/jira/browse/PHOENIX-1738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14364544#comment-14364544
]
James Taylor commented on PHOENIX-1738:
---------------------------------------
Thanks for the quick turnaround on this, [~shuxi0ng]. It looks very good.
Here's some minor feedback:
- You only need to declare that the allowedType of the argument is of type
PDecimal because all those other types are coercible to that one (this is the
runtime check we do).
{code}
diff --git
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
index 0797104..68e855a 100644
---
a/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
+++
b/phoenix-core/src/main/java/org/apache/phoenix/expression/function/SignFunction.java
@@ -48,7 +48,7 @@ import org.apache.phoenix.schema.types.PUnsignedTinyint;
@BuiltInFunction(name = SignFunction.NAME, args = { @Argument(allowedTypes = {
PFloat.class,
PDouble.class, PDecimal.class, PUnsignedFloat.class,
PUnsignedDouble.class, PInteger.class,
PUnsignedInt.class, PLong.class, PUnsignedLong.class, PSmallint.class,
- PUnsignedSmallint.class, PTinyint.class, PUnsignedTinyint.class }) })
+ PUnsignedSmallint.class, PTinyint.class, PUnsignedTinyint.class,
PDecimal.class }) })
public class SignFunction extends ScalarFunction {
{code}
- Minor, but FWIW, you don't need to use IF NOT EXISTS in CREATE TABLE calls in
unit tests because all tables are deleted between the running of tests.
> Create end-to-end test for SIGN function
> ----------------------------------------
>
> Key: PHOENIX-1738
> URL: https://issues.apache.org/jira/browse/PHOENIX-1738
> Project: Phoenix
> Issue Type: Test
> Reporter: James Taylor
> Assignee: Shuxiong Ye
> Fix For: 4.0.0
>
> Attachments:
> PHOENIX-1738_Implement_end-to-end_test_for_Math_build-in_function_SIGN.patch
>
>
> Add end-to-end test that uses SIGN in the WHERE clause against a column value
> in ArithmeticQueryIT. This tests that the "plumbing" for SIGN was done
> correctly (i.e. mainly that it was added to ExpressionType).
> A query like this with a few rows in the table would be good:
> {code}
> SELECT * FROM testDecimalArithmetic WHERE SIGN(col1) = -1
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)