Skip to content

Instantly share code, notes, and snippets.

@Rajmohan
Created February 21, 2013 22:13
Show Gist options
  • Save Rajmohan/5008840 to your computer and use it in GitHub Desktop.
Save Rajmohan/5008840 to your computer and use it in GitHub Desktop.
public static class RowNumberAFunc extends PlainAnalyticFunction<Integer> {
@Override
public void initialize(FunctionContext<Integer> fnCtx) {
fnCtx.setResult(Integer.valueOf(0));
}
@Override
public void map(FunctionContext<Integer> fnCtx, Tuple current, List<Tuple> window) {
fnCtx.setResult( fnCtx.getResult() + 1 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment