[ https://issues.apache.org/jira/browse/PIG-904?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12788765#action_12788765 ]
Jeff Zhang commented on PIG-904: -------------------------------- I think this problem is caused by the following code in TypeCheckingVisitor {code} static{ //Ordering here decides the score for the best fit function. //Do not change the order. Conversions to a smaller type is preferred //over conversion to a bigger type where ordering of types is: //INTEGER, LONG, FLOAT, DOUBLE, CHARARRAY, TUPLE, BAG, MAP //from small to big // castLookup.put(DataType.BOOLEAN, DataType.INTEGER); // castLookup.put(DataType.BOOLEAN, DataType.LONG); // castLookup.put(DataType.BOOLEAN, DataType.FLOAT); // castLookup.put(DataType.BOOLEAN, DataType.DOUBLE); // castLookup.put(DataType.BOOLEAN, DataType.CHARARRAY); castLookup.put(DataType.INTEGER, DataType.LONG); castLookup.put(DataType.INTEGER, DataType.FLOAT); castLookup.put(DataType.INTEGER, DataType.DOUBLE); // castLookup.put(DataType.INTEGER, DataType.CHARARRAY); castLookup.put(DataType.LONG, DataType.FLOAT); castLookup.put(DataType.LONG, DataType.DOUBLE); // castLookup.put(DataType.LONG, DataType.CHARARRAY); castLookup.put(DataType.FLOAT, DataType.DOUBLE); // castLookup.put(DataType.FLOAT, DataType.CHARARRAY); // castLookup.put(DataType.DOUBLE, DataType.CHARARRAY); // castLookup.put(DataType.BYTEARRAY, DataType.BOOLEAN); castLookup.put(DataType.BYTEARRAY, DataType.INTEGER); castLookup.put(DataType.BYTEARRAY, DataType.LONG); castLookup.put(DataType.BYTEARRAY, DataType.FLOAT); castLookup.put(DataType.BYTEARRAY, DataType.DOUBLE); castLookup.put(DataType.BYTEARRAY, DataType.CHARARRAY); castLookup.put(DataType.BYTEARRAY, DataType.TUPLE); castLookup.put(DataType.BYTEARRAY, DataType.BAG); castLookup.put(DataType.BYTEARRAY, DataType.MAP); } {code} If I comment the "castLookup.put(DataType.DOUBLE, DataType.CHARARRAY);", the script above will pass. I do not know clearly why some cast operation is commented, in my opinion, the following cast should been supported: castLookup.put(DataType.BOOLEAN, DataType.CHARARRAY); castLookup.put(DataType.INTEGER, DataType.CHARARRAY); castLookup.put(DataType.LONG, DataType.CHARARRAY); castLookup.put(DataType.FLOAT, DataType.CHARARRAY); > Conversion from double to chararray for udf input arguments does not occur > -------------------------------------------------------------------------- > > Key: PIG-904 > URL: https://issues.apache.org/jira/browse/PIG-904 > Project: Pig > Issue Type: Bug > Affects Versions: 0.3.1 > Reporter: Pradeep Kamath > > Script showing the problem: > {noformat} > "a = load '/user/pig/tests/data/singlefile/studenttab10k' as (name, age, > gpa:double); b = foreach a generate CONCAT(gpa, 'dummy'); dump b;" > Error shown: > 2009-08-03 17:04:27,573 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR > 1045: Could not infer the matching function for org.apache.pig.builtin.CONCAT > as multiple or none of them fit. Please use an explicit cast. > {noformat} > The error goes away if gpa is casted to chararray. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.