db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Pendleton <bpendle...@amberpoint.com>
Subject Re: Unable to group by certain functions
Date Wed, 04 Mar 2009 21:47:31 GMT
> ij> SELECT ABS(a) FROM foo GROUP BY ABS(a);
> 
> works fine.  But if I use CEIL or FLOOR, I get an error:

I'm not completely sure I understand this, but I think that
the issue involves the internal implementation of the CEIL
and FLOOR functions.

At the point where the error is generated, there is a comment
which says:

  // disallow any expression which involves native java computation.
  // Not possible to consider java expressions for equivalence.

And I think that the implementation of the CEIL function is
internally based on calling java.lang.StrictMath.ceil.

I think you're right that DERBY-592, and DERBY-475, are related
to the behavior that you are seeing. I see that there's a comment
in DERBY-475 which notes that using java.lang.StrictMath was
done to improve cross-JVM portability.

I'm truly speculating here, but I wonder if this behavior is
because CEIL and FLOOR return floating point values, and therefore
have a certain amount of inexactness in them, which is unacceptable
for GROUP BY processing?

I'm afraid all I can really do is to confirm that I see the
same behavior that you see, and it doesn't appear to be random,
but rather is intentional, and has to do with the fact that CEIL
and FLOOR are implemented differently than ABS.

bryan


Mime
View raw message