Question

During the course of a problem I'm working on Pig, I generated a transition file the records of which looks like this:

(0131228,-1.9,12.8)
(0131229,12.8,30.4)
(0131230,20.6,32.3)
(0131231,21.0,32.4)

I've typecasted the middle(Max_Temp) and end(Min_Temp) values to double.

B1 = LOAD '/tmp/PigLoadSandstoneData/part-m-00000' USING PigStorage(',') AS (Dated: CHARARRAY, Min_Temp: DOUBLE, Max_Temp: DOUBLE);

I wanted to filter out the result as per a comparison that I'm doing using the statements below:

X = filter B1 by Max_Temp>25.0;
X = filter B1 by Min_Temp<0.0;

I'm not sure why it is throwing the IMPLICIT_CAST_TO_DOUBLE error message as:

grunt> X = filter B1 by (Max_Temp>25.0);
2014-04-08 05:42:58,925 [main] WARN  org.apache.pig.PigServer - Encountered Warning IMPLICIT_CAST_TO_DOUBLE 1 time(s).

Can anyone please suggest what wrong I'm doing here? And any solution to this?

Thanks- Adil

Was it helpful?

Solution

Give these a shot and tell me if one or neither works:

  1. I'd try tossing in a cast in the FILTER statement, e.g.,

    X = filter B1 by (double)Max_Temp>25.0;

  2. It's not impossible that you have a null value somewhere in your data set that Pig is re-casting. Try filtering out null values. If you want to do something with the null value (e.g., set it to 0) try COALESCE.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top