hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rishav Rohit (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HIVE-5545) HCatRecord getInteger method returns String when used on Partition columns of type INT
Date Tue, 15 Oct 2013 14:10:42 GMT

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

Rishav Rohit commented on HIVE-5545:
------------------------------------

Reducer Class -

public class testReducer extends Reducer<IntWritable, IntWritable, Text, HCatRecord>
{

	public void reduce (IntWritable key, Iterable<IntWritable> value, Context context)

		throws IOException, InterruptedException{
		
		int count = 0;
		for (IntWritable s:value) {
			count++;
		}
		
		// define output 
		List<HCatFieldSchema> columns = new ArrayList<HCatFieldSchema>(2);
		columns.add(new HCatFieldSchema("year", HCatFieldSchema.Type.INT, ""));
		columns.add(new HCatFieldSchema("count", HCatFieldSchema.Type.INT, ""));
		
		HCatSchema schema = new HCatSchema(columns);
		HCatRecord record = new DefaultHCatRecord(2);
		record.setInteger("year", schema, new Integer(key.toString())); 
		record.set("cnt", schema, new Integer(count));

		context.write(null, record);
	}
}

> 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.1#6144)

Mime
View raw message