equals - EqualsIgnoreCase function - Exception : org.apache.pig.backend.executionengine.ExecException -
equalsignorecase function - exception : org.apache.pig.backend.executionengine.execexception
input :
a.csv ------- (blank/empty line) b b c c
objective : select records 'a', 'a', 'b' , 'b'.
approach 1 :
= load 'a.csv' using pigstorage(',') (value:chararray); b = filter lower(value) in ('a','b'); dump b; output : (a) (a) (b) (b)
approach 2 :
c = filter equalsignorecase(value, 'a') or equalsignorecase(value, 'b'); output : 2015-04-27 23:48:21,958 [thread-30] warn org.apache.hadoop.mapred.localjobrunner - job_local_0014 org.apache.pig.backend.executionengine.execexception @ org.apache.pig.builtin.equalsignorecase.exec(equalsignorecase.java:50)
trying understand why exception getting thrown. understand because of blank record.
tried checking value not being null or empty, still same error.
d = filter (value not null) or (trim(value) != '') , (equalsignorecase(value, 'a') or equalsignorecase(value, 'b'));
any inputs/ thoughts on achieving our objective using approach 2 appreciated.
yes right, string functions equalsignorecase
, trim
not able handle blank string in input.
solve issue,what ever did in last stmt right, remove trim
function work.
c = filter (value not null) , (equalsignorecase(value, 'a') or equalsignorecase(value, 'b'));
is not null condition
take care of empty(null, space , tab) chars, trim
function not required.