zoukankan      html  css  js  c++  java
  • ArrayProcessUDTF

    package com.suning.udf;
    
    
    import org.apache.hadoop.hive.ql.metadata.HiveException;
    import org.apache.hadoop.hive.ql.udf.generic.GenericUDTF;
    
    public class ArrayProcessUDTF extends GenericUDTF {
    
        @Override
        public void process(Object[] args) throws HiveException {
    
            String input = args[0].toString();
            String[] test = input.split(",");
            for (int i = 0; i < test.length; i++) {
                try {
                    String[] result = (test[i] + ":" + String.valueOf(i + 1)).split(":");
                    forward(result);
                } catch (Exception e) {
                    continue;
                }
            }
        }
    
        @Override
        public void close() throws HiveException {
    
        }
    }    // select array_process('a,c,b')    
    //返回元素和索引 a 1 c 2 b 3
  • 相关阅读:
    程序中图片透明 函数(使用SetBkColor API函数)
    编程中使用锁
    event内存泄漏
    diskcache
    linux内核管理
    Vue
    Paxos算法
    索引以及页和区
    CoreRT
    二叉树
  • 原文地址:https://www.cnblogs.com/yin-fei/p/10879710.html
Copyright © 2011-2022 走看看