it seems like there is some internal UDF memory limitation. I stopped using UDF and change the code to do map from java side