خرید بک لینک

Vote count: 0

i am trying to write python functions to parse list or array of dates and sort it and then get max or min value from it.

I have to call this functions around 4 million times and input to it will be passed from Amazon Redshift Database, for performance reasons i want to do this in Amazon Redhsift Database user defined functions.

Below is Java Code needs to be converted into Python/Amazon Redshift user defined functions.

public String doItMin(String v_effect_date){

    java.util.List arrayColl = java.util.Arrays.asList(v_effect_date.split(","));
    java.util.List dateList = new java.util.ArrayList();
    for (int i = 0; i < arrayColl.size(); i++) {
        try {
            String str = arrayColl.get(i).toString();
            if (!org.apache.commons.lang3.StringUtils.equals("", str)) {
                dateList.add(new java.text.SimpleDateFormat("dd-MMM-yy").parse(str));
            }
        } catch (java.text.ParseException ex) {
            ex.printStackTrace();
        }
    }
    dateList = dateList;
    retu dateList.size()==0 ? "" : new java.text.SimpleDateFormat("dd-MMM-yy").format(java.util.Collections.min(dateList));
}

I am alien to python, but being programmer i am able to write basic function but its not working some how...

Any help to convert this Java function to Python/Amazon Redshift UDF will be appreciated.

-- Regards, Mateen

asked 25 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 10 تير 1395 ساعت: 13:35

صفحه بندی