Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE OR REPLACE FUNCTION avgState2 ( state map<BIGINT,int>) CALLED ON NULL INPUT RETURNS map<text, int> LANGUAGE java AS
- 'int total = 0;int cont = 0; int max = Integer.MIN_VALUE; int min = Integer.MAX_VALUE; for(Long key : state.keySet()){int valor = state.get(key); if(min > valor) min = ; if(max < valor) max = valor; total += valor;cont ++;} Map<String, Integer> solucion = new HashMap<String, Integer>(); solucion.put("promedio", total/cont );solucion.put("cantidad", cont); solucion.put("maximo", max); solucion.put("minimo", min); return solucion;';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement