You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "apachehadoop (JIRA)" <ji...@apache.org> on 2015/09/08 13:53:45 UTC

[jira] [Updated] (HIVE-11757) I want to get the value of HiveKey in my custom partitioner

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

apachehadoop updated HIVE-11757:
--------------------------------
    Description: 
   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.....


> 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)