Skip to content

Commit

Permalink
fix: A few tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Fox committed Oct 29, 2019
1 parent cc2664b commit 927fa36
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public interface FunctionRegistry {
* @throws KsqlException on unknown UDAF, or on unsupported {@code argumentType}.
*/
KsqlAggregateFunction<?, ?, ?> getAggregateFunction(
String functionName, Schema argumentType,
String functionName,
Schema argumentType,
AggregateFunctionInitArguments initArgs
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
import java.util.List;
import org.apache.kafka.connect.data.Schema;

/**
* A wrapper around the actual table function which provides methods to get return type and
* description, and allows the function to be invoked.
*/
public interface KsqlTableFunction extends FunctionSignature {

Schema getReturnType();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import java.util.Objects;
import org.apache.kafka.connect.data.Schema;

/**
* Abstract base class for table functions
*/
@Immutable
public abstract class BaseTableFunction implements KsqlTableFunction {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.lang.reflect.TypeVariable;

/**
* An implementation of UdfInvoker which invokes the UDF dynamically using reflection
* An implementation of UdfInvoker which invokes the UDF using reflection
*/
public class DynamicFunctionInvoker implements FunctionInvoker {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ private void init() {
addJsonFunctions();
addStructFieldFetcher();
addUdafFunctions();
addUdtfFunctions();
}

private void addStringFunctions() {
Expand Down Expand Up @@ -392,10 +391,6 @@ private void addUdafFunctions() {
functionRegistry.addAggregateFunctionFactory(new TopkDistinctAggFunctionFactory());
}

private void addUdtfFunctions() {
//functionRegistry.addTableFunctionFactory(new ExplodeFunctionFactory());
}

private void addBuiltInFunction(final KsqlFunction ksqlFunction) {
addBuiltInFunction(ksqlFunction, false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import java.util.stream.Collectors;
import org.apache.kafka.connect.data.Schema;

/**
* A table function factory used for creating user defined table functions.
*/
public class UdtfTableFunctionFactory extends TableFunctionFactory {

private final UdfIndex<KsqlTableFunction> udtfIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
import java.util.Collections;
import java.util.List;

/**
* Implementation of the 'explode' table function. This table function takes an array of values and
* explodes it into zero or more rows, one for each value in the array.
*/
@UdtfDescription(name = "explode", author = KsqlConstants.CONFLUENT_AUTHOR,
description =
"Explodes an array. This function outputs one value for each element of the array.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2018 Confluent Inc.
* Copyright 2019 Confluent Inc.
*
* Licensed under the Confluent Community License (the "License"); you may not use
* this file except in compliance with the License. You may obtain a copy of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
/*
* Optionally, applied to @Udf function parameters.
* Optionally, applied to @Udf or @Udtf function parameters.
*/
public @interface UdfParameter {

Expand Down

0 comments on commit 927fa36

Please sign in to comment.