@Override
  public synchronized void addFunction(final KsqlScalarFunction ksqlFunction) {
    final UdfFactory udfFactory = udfs.get(ksqlFunction.name().text().toUpperCase());
    if (udfFactory == null) {
      throw new KsqlException("Unknown function factory: " + ksqlFunction.name());
    }
    udfFactory.addFunction(ksqlFunction);
  }
@Test
  public void shouldAddFunctionWithSameNameButDifferentReturnTypes() {
    // Given:
    givenUdfFactoryRegistered();
    functionRegistry.addFunction(func);
    final KsqlScalarFunction func2 = KsqlScalarFunction.createLegacyBuiltIn(
        SqlTypes.BIGINT,
        Collections.singletonList(ParamTypes.LONG),
        FunctionName.of("func"), Func1.class);

    // When:
    functionRegistry.addFunction(func2);

    // Then: no exception thrown.
  }