package com.yem.wm.utils.groupfunc;

import kd.bos.algo.CustomAggFunction;
import kd.bos.algo.DataType;

/**
 * 取首行函数构造器
 * @description:实现groupBy自定义聚合函数
 * @author longh
 * @date 2022年4月19日 上午11:14:41
 */
public class GroupTopOneFunction extends CustomAggFunction<Object> {

	public GroupTopOneFunction() {
		super("GroupTopOneFunction", DataType.AnyType);
	}

	@Override
	public Object newAggValue() {
		return null;
	}

	@Override
	public Object addValue(Object arg0, Object arg1) {
		if(arg0 == null) {
			arg0 = arg1;
		}
		return arg0;
	}

	@Override
	public Object combineAggValue(Object arg0, Object arg1) {
		if(arg0 == null) {
			arg0 = arg1;
		}
		return arg0;
	}

	@Override
	public Object getResult(Object arg0) {
		return arg0;
	}
	
}
