hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "apachehadoop (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (HIVE-11757) I want to get the value of HiveKey in my custom partitioner
Date Thu, 15 Oct 2015 08:05:05 GMT

     [ https://issues.apache.org/jira/browse/HIVE-11757?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

apachehadoop resolved HIVE-11757.
---------------------------------
    Resolution: Fixed

> I want to get the value of HiveKey in my custom partitioner
> -----------------------------------------------------------
>
>                 Key: HIVE-11757
>                 URL: https://issues.apache.org/jira/browse/HIVE-11757
>             Project: Hive
>          Issue Type: Wish
>            Reporter: apachehadoop
>
>    JAVA CODE AS :
>  // 分配可以到多个reduce
>     public int findPartition(K key, V value) {
>         int len = splitPoints.length;
>         for (int i = 0; i < len; i++) {
>             HiveKey hivekey = (HiveKey)key;
>             String keystring = new String(hivekey.getBytes());
>             LOG.info("HiveKey string ====> " + keystring);
>             LOG.info("splitPoints int ====> " + splitPoints[i]);
>             
>             //IntWritable keyInt = new IntWritable(Integer.parseInt(keystring));
>             //int res = ((IntWritable)key).compareTo((IntWritable)splitPoints[i]);
>             //int res = keyInt.compareTo((IntWritable)splitPoints[i]);
>             int res = 0;
>             //int res = ((IntWritable)key).compareTo((IntWritable)splitPoints[i]);
>             if (res > 0 && i < len - 1) {
>                 continue;
>             } else if (res <= 0) {
>                 return i;
>             } else if (res > 0 && i == len - 1) {
>                 return i + 1;
>             }
>         }
>         return 0;
>     }
> As above,I can not get the value of key ,please help me ,friends.....



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

Mime
View raw message