[ 
https://issues.apache.org/jira/browse/PHOENIX-2151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14659330#comment-14659330
 ] 

Anchal Agrawal commented on PHOENIX-2151:
-----------------------------------------

Phoenix 4.4.0
HBase 0.98.8

I'm facing this issue and can reproduce it on multiple test cases.

Phoenix view: create view "mytable" (pk VARBINARY PRIMARY KEY, "cf"."col" 
UNSIGNED_LONG);
UDF1: create function udf1(VARBINARY) returns UNSIGNED_LONG as 'mypkg.GetX';
UDF2: create function udf2(VARBINARY) returns INTEGER as 'mypkg.GetY';


Query1: select udf1(pk), udf2(pk) from "mytable";
Output:
===================================================
UDF1(PK) | UDF1(PK)
===================================================
<UDF1 Value> | <UDF1 Value>

Expected output:
===================================================
UDF1(PK) | UDF2(PK)
===================================================
<UDF1 Value> | <UDF2 Value>

Query2: select udf2(pk), udf1(pk) from "mytable";
Output: same as Query1, except this time both columns are UDF2(PK).

Query3: select udf1(pk), "col" from "mytable" where udf2(pk) > 0;
Output:
===================================================
UDF2(PK) | COL
===================================================
<UDF2 Value> | <COL Value>

Expected output:
===================================================
UDF1(PK) | COL
===================================================
<UDF1 Value> | <COL Value>

Query4: select pk, udf1(pk), udf2(pk) from "mytable";
Output:
===================================================
PK | UDF1(PK) | UDF1(PK)
===================================================
<PK VALUE> | <UDF1 Value> | <UDF1 Value>

Expected output:
===================================================
PK | UDF1(PK) | UDF2(PK)
===================================================
<PK VALUE> | <UDF1 Value> | <UDF2 Value>

If I have just one UDF in a query, like so: select pk, udf2(pk) from "mytable";
then the output is as expected:
===================================================
PK | UDF2(PK)
===================================================
<PK VALUE> | <UDF2 Value>

It appears to be picking up the first UDF, except in Query3 where UDF2 is in 
the WHERE clause, where it picks UDF2.

> Two different UDFs called on same column return values from first UDF only
> --------------------------------------------------------------------------
>
>                 Key: PHOENIX-2151
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-2151
>             Project: Phoenix
>          Issue Type: Bug
>    Affects Versions: 4.4.0
>         Environment: Phoenix 4.4.0
> HBase 0.98_13
> Java 7
> Ubuntu 14.04.1 X64
>            Reporter: Nicholas Whitehead
>            Assignee: Rajeshbabu Chintaguntla
>            Priority: Critical
>
> I have defined two different UDFs, say FOO(varchar) and BAR(varchar).
> If I execute a query such as:
> SELECT PK, FOO(NAME), BAR(NAME) FROM USERS, I get:
> ===================================================
>        PK              |              FOO                  |                
> BAR
> ===================================================
> 37546               |       <Fooed Value>         |      <Fooed Value>
> If I reverse the order, I only get the Barred value (i.e. it ignores the 2nd 
> and subsequent UDF operators)
> SELECT PK, BAR(NAME), FOO(NAME) FROM USERS, I get:
> ===================================================
>        PK              |              BAR                  |                
> FOO
> ===================================================
> 37546               |       <Bared Value>         |      <Bared Value>
> Reproduced in plain command JDBC and Squirrel SQL.
> Packaged reproduction pending.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to