Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig, mail # user - COUNT sometimes returning a float value?


Copy link to this message
-
Re: COUNT sometimes returning a float value?
Thejas M Nair 2011-04-16, 00:13
This is strange. Looking at COUNT code, there does not seem to be anyway it could return a float.
Do you have some example data/query that can be used to reproduce this ?
Can you paste the entire stacktrace of the ClassCastException ?
Do you have something like a bincond which might be returning different results for different rows ?

-Thejas
On 4/15/11 2:44 PM, "Jeremy Hanna" <[EMAIL PROTECTED]> wrote:

I have been getting strange errors in my pig script and narrowed it down a bit and found that when I do a COUNT, sometimes it returns a float, but most of the time it returns a long.  Some example output of the result column that came from a COUNT is below.  Any reason why this would happen?

The error that started me down this path was in my next step, I cast the count value as a chararray and it gives the error "java.lang.ClassCastException: java.lang.Float cannot be cast to java.lang.Long" which made no sense to me since we weren't casting anything in our script to a long.

(0)
(0)
(0.0)
(0.0)
(0)
(0)
(0)
(0)
(0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
(0)
(0.0)
(0.0)
(0)
(0.0)
(0.0)
(0)
(0)
(0)
(0)
(0.0)
(0)
(0)
(0.0)
(0)
(0)
(0)
(0.0)
(0.0)
(0.0)
(0)
(0.0)
(0.0)
(0)
(0)
(0)
(0.0)
(0)
(0.0)
(0.0)
(0.0)
(0)
(0)
(0)
(0.0)
(0.0)
(0.0)
(0.0)
(0)
(0.0)
(0.0)
(0.0)
(0)
(0)
(0.0)
(0)
(0.0)
(0)
(0.0)
(0.0)
(0)
(0)
(0.0)
(0)
(0)
(0)
(0.0)
(0)
(0)
(0.0)
(0.0)
(0)
(0)
(0.0)
(0)
(0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
(0)
(0.0)
(0)
(0.0)
(0)
(0.0)
(0.0)
(0.0)
(0.0)
(0)
(0)
(0.0)
(0)
(0.0)
(0.0)
(0)
(0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
(0.0)
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