

package org.apache.samza.sql.util;

import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.apache.samza.config.Config;
import org.apache.samza.sql.udfs.SamzaSqlUdf;
import org.apache.samza.sql.udfs.SamzaSqlUdfMethod;
import org.apache.samza.sql.udfs.ScalarUdf;


@SamzaSqlUdf(name = "MyTestArray")
public class MyTestArrayUdf implements ScalarUdf {
  @Override
  public void init(Config udfConfig) {
  }

  @SamzaSqlUdfMethod
  public List<String> execute(Object... args) {
    Integer value = (Integer) args[0];
    return IntStream.range(0, value).mapToObj(String::valueOf).collect(Collectors.toList());
  }
}
