[
https://issues.apache.org/jira/browse/PHOENIX-4540?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332623#comment-16332623
]
James Taylor commented on PHOENIX-4540:
---------------------------------------
select round(k/v,0) x from round_test group by x,v
bq. Why we need to re-evaluate the expression here, can't we use the same
result evaluated at server side during the "group by"
We don't re-evaluate the expression on the client side. We get the value of
{{round(k/v,0)}} from the row key of the rows we get back from the server. The
server returns the aggregated rows with a row key based on the GROUP BY
expressions, so the first part of the returned row key should have the
evaluated value of {{round(k/v,0)}}.
Does this slightly simpler test fail too? It's a bit strange to group by both
round(k/v,0) and v.
select round(k/v,0) x from round_test group by x
I suspect it may be due to a type mismatch.
> Client side evaluation of group by Expression in projection gives erroneous
> result
> ----------------------------------------------------------------------------------
>
> Key: PHOENIX-4540
> URL: https://issues.apache.org/jira/browse/PHOENIX-4540
> Project: Phoenix
> Issue Type: Bug
> Reporter: Ankit Singhal
> Priority: Major
> Attachments: PHOENIX-4540_unittest.patch
>
>
> If the columns involved in projected expression are not present in "group by"
> clause, the client evaluation of the same expression will give an erroneous
> result because of the absence of involved column value.
> Following queries will produce wrong result
> >select round(k/v,0) x from round_test group by x,v
> >select k/v x from round_test group by x,v
> but query runs fine if we add all columns so that client expression can be
> evaluated
> >select round(k/v,0) x from round_test group by x,k,v //will produce right
> >result
> >select k/v x from round_test group by x,k,v;
> Why we need to re-evaluate the expression here, can't we use the same result
> evaluated at server side during the "group by"
> thoughts [~jamestaylor]?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)