At any rate, I find it strange that one of these query works but not the other. I think right now as things stand, both should fail. If there is consensus that we should allow java value nodes in group by expressions, then we should add isEquivalence methods to all the JavaValueNodes.
m
On 11/15/06, Oystein Grovlen - Sun Norway <[EMAIL PROTECTED]> wrote:
Manish Khettry wrote:
> Hmm strange. I am not sure why this
>
> select avg(i) from t group by sin(i)
>
> works but not this,
>
> select avg(i), sin(i) from test group by sin(i);
>
> I think its a bug-- both should be disallowed.
Why should they be disallowed? I agree that in most cases grouping by
non-deterministic functions do not make sense, but I am not sure that
is a reason for disallowing it. Also, a function that is generally
non-deterministic may be deterministic in a given context.
Theoretically, I do not see why equivalence and non-deterministic
functions are an issue for GROUP BY. I do not think an implementation
need to execute the function twice if it appears both in the group-by
clause and in the select list. The value returned when determining
group could be used for the select list also.
--
Øystein
