[ 
https://issues.apache.org/jira/browse/HIVE-5545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13795209#comment-13795209
 ] 

Thejas M Nair edited comment on HIVE-5545 at 9/8/14 5:54 PM:
-------------------------------------------------------------

Mapper Class-
{code}
public class testMapper extends Mapper<WritableComparable, HCatRecord, 
IntWritable, IntWritable> {
        
    @Override
    protected void map(WritableComparable key, HCatRecord value,
        org.apache.hadoop.mapreduce.Mapper<WritableComparable, HCatRecord, 
IntWritable, IntWritable>.Context context)
        throws IOException, InterruptedException {

        // Get table schema
        HCatSchema schema = HCatBaseInputFormat.getTableSchema(context);

        // Reading year column as Integer
        Integer year = new Integer(value.getInteger("year", schema));

        context.write(new IntWritable(year), new IntWritable(1));
    }
}
{code}


was (Author: rishav_rohit):
Mapper Class-

public class testMapper extends Mapper<WritableComparable, HCatRecord, 
IntWritable, IntWritable> {
        
    @Override
    protected void map(WritableComparable key, HCatRecord value,
        org.apache.hadoop.mapreduce.Mapper<WritableComparable, HCatRecord, 
IntWritable, IntWritable>.Context context)
        throws IOException, InterruptedException {

        // Get table schema
        HCatSchema schema = HCatBaseInputFormat.getTableSchema(context);

        // Reading year column as Integer
        Integer year = new Integer(value.getInteger("year", schema));

        context.write(new IntWritable(year), new IntWritable(1));
    }
}

> HCatRecord getInteger method returns String when used on Partition columns of 
> type INT
> --------------------------------------------------------------------------------------
>
>                 Key: HIVE-5545
>                 URL: https://issues.apache.org/jira/browse/HIVE-5545
>             Project: Hive
>          Issue Type: Bug
>          Components: HCatalog
>    Affects Versions: 0.11.0
>         Environment: hadoop-1.0.3
>            Reporter: Rishav Rohit
>
> HCatRecord getInteger method returns String when used on Partition columns of 
> type INT.
> java.lang.ClassCastException: java.lang.String cannot be cast to 
> java.lang.Integer



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to