@@ -0,0 +1,1949 @@
+package com.ntc.hive.udf;%0A%0Aimport org.apache.hadoop.hive.ql.exec.Description;%0Aimport org.apache.hadoop.hive.ql.exec.UDF;%0Aimport org.apache.hadoop.hive.ql.exec.UDFArgumentException;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0A/**%0A * Created by tyler.li on 2015/12/3.%0A */%0A@Description(%0A        name = %22seq%22,%0A        value = %22Return a list of numbers from FIRST to LAST, in steps of INCREMENT.%22%0A)%0Apublic class SeqUDF extends UDF %7B%0A    public List%3CInteger%3E evaluate(Object lastText) throws UDFArgumentException %7B%0A        int first = 1;%0A        int last = Integer.valueOf(lastText.toString());%0A        int step = first %3C= last ? 1 : -1;%0A        return process(first, last, step);%0A    %7D%0A%0A    public List%3CInteger%3E evaluate(Object firstText, Object lastText) throws UDFArgumentException %7B%0A        int start = Integer.valueOf(firstText.toString());%0A        int last = Integer.valueOf(lastText.toString());%0A        int step = start %3C= last ? 1 : -1;%0A        return process(start, step, last);%0A    %7D%0A%0A    public List%3CInteger%3E evaluate(Object firstText, int step, Object lastText) throws UDFArgumentException %7B%0A        int first = Integer.valueOf(firstText.toString());%0A        int last = Integer.valueOf(lastText.toString());%0A        return process(first, step, last);%0A    %7D%0A%0A    private List%3CInteger%3E process(int first, int step, int last) %7B%0A        List%3CInteger%3E list = new ArrayList%3CInteger%3E();%0A        /*step%E4%B8%8D%E8%83%BD%E4%B8%BA0*/%0A        if (step == 0) %7B%0A            return list;%0A        %7D%0A        int i;%0A        if (last %3E= first) %7B%0A            /*step%E6%AD%A3%E8%B4%9F%E4%B8%8E%E5%BA%8F%E5%88%97%E6%96%B9%E5%90%91%E4%B8%8D%E4%B8%80%E8%87%B4%E6%97%B6%E8%BF%9B%E8%A1%8C%E8%B0%83%E6%95%B4*/%0A            if (step %3C 1) %7B%0A                step = -step;%0A            %7D%0A            for (i = first; i %3C= last; i += step) %7B%0A                list.add(i);%0A            %7D%0A        %7D else %7B%0A            if (step %3E 1) %7B%0A                step = -step;%0A            %7D%0A            for (i = first; i %3E= last; i += step) %7B%0A                list.add(i);%0A            %7D%0A%0A        %7D%0A        return list;%0A    %7D%0A%0A%7D%0A

Add SeqUDF