Grokbase Groups Pig user July 2010
FAQ
Hi all,

I have a strange issue with data types. We have a custom loader which
loads data from logs similar to apache logs.
It sets the type of a field(var) to be int. When I examine its type, it
shows it to be int(using describe). However, when I do a numeric
comparison (for example: var==200) it throws an error.

java.lang.ClassCastException: java.lang.Integer cannot be cast to
java.lang.String
at java.lang.String.compareTo(String.java:92)

And when a string comparison is done (using var == '200'), it again
throws an error.

ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1039: Incompatible types
in EqualTo Operator left hand side:int right hand side:chararray

When I explicitly type cast or use a UDF to convert it from string to
integer or long and then do the numeric comparison, it works fine.

I searched if there are any previously such issues have been reported
before, but I couldnt find anything related.
It would be great if any one could throw more light on this if I am
missing something here.

Thanks,
-Rohini

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupuser @
categoriespig, hadoop
postedJul 29, '10 at 7:18p
activeJul 30, '10 at 7:39a
posts3
users2
websitepig.apache.org

People

Translate

site design / logo © 2021 Grokbase