public static StatementExecutorResponse execute(
      final ConfiguredStatement<DescribeFunction> statement,
      final SessionProperties sessionProperties,
      final KsqlExecutionContext executionContext,
      final ServiceContext serviceContext
  ) {
    final DescribeFunction describeFunction = statement.getStatement();
    final FunctionName functionName = FunctionName.of(describeFunction.getFunctionName());

    if (executionContext.getMetaStore().isAggregate(functionName)) {
      return StatementExecutorResponse.handled(Optional.of(
          describeAggregateFunction(executionContext, functionName,
              statement.getMaskedStatementText())));
    }

    if (executionContext.getMetaStore().isTableFunction(functionName)) {
      return StatementExecutorResponse.handled(Optional.of(
          describeTableFunction(executionContext, functionName,
              statement.getMaskedStatementText())));
    }

    return StatementExecutorResponse.handled(Optional.of(
        describeNonAggregateFunction(executionContext, functionName,
            statement.getMaskedStatementText())));
  }
@Test
  public void shouldDescribeUDF() {
    // When:
    final FunctionDescriptionList functionList = (FunctionDescriptionList)
        CustomExecutors.DESCRIBE_FUNCTION.execute(
        engine.configure(
                "DESCRIBE FUNCTION TEST_UDF_1;"),
            mock(SessionProperties.class),
            engine.getEngine(),
            engine.getServiceContext()
        ).getEntity().orElseThrow(IllegalStateException::new);

    // Then:
    assertThat(functionList, new TypeSafeMatcher<FunctionDescriptionList>() {
      @Override
      protected boolean matchesSafely(final FunctionDescriptionList item) {
        return functionList.getName().equals("TEST_UDF_1")
            && functionList.getType().equals(FunctionType.SCALAR);
      }

      @Override
      public void describeTo(final Description description) {
        description.appendText(functionList.getName());
      }
    });
  }