Created
July 17, 2015 11:21
-
-
Save chbatey/0a786df31f837a167ffc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION state_group_and_count( state map<text, int>, type text ) | |
CALLED ON NULL INPUT | |
RETURNS map<text, int> | |
LANGUAGE java AS ' | |
try { Thread.sleep(200); } catch (Exception e) {}; Integer count = (Integer) state.get(type); if (count == null) count = 1; else count++; state.put(type, count); return state; ' ; | |
CREATE OR REPLACE AGGREGATE group_and_count(text) | |
SFUNC state_group_and_count | |
STYPE map<text, int> | |
INITCOND {}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment