You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "jackylau (Jira)" <ji...@apache.org> on 2022/08/05 07:36:00 UTC

[jira] [Created] (FLINK-28830) new stack udtf doesn't support atomic type

jackylau created FLINK-28830:
--------------------------------

             Summary: new stack udtf doesn't support atomic type 
                 Key: FLINK-28830
                 URL: https://issues.apache.org/jira/browse/FLINK-28830
             Project: Flink
          Issue Type: Improvement
          Components: Table SQL / Planner
    Affects Versions: 1.16.0
            Reporter: jackylau
             Fix For: 1.16.0


{code:java}
// code placeholder
public class GenerateSeriesFunction extends BuiltInTableFunction<Long> {

    private static final long serialVersionUID = 1L;

    public GenerateSeriesFunction(SpecializedContext specializedContext) {
        super(BuiltInFunctionDefinitions.GENERATE_SERIES, specializedContext);
    }

    public void eval(long start, long stop) {
        eval(start, stop, 1);
    }
    
    public void eval(long start, long stop, long step) {
        long s = start;
        while (s <= stop) {
            collect(s);
            s += step;
        }
    }
}


public static final BuiltInFunctionDefinition GENERATE_SERIES =
        BuiltInFunctionDefinition.newBuilder()
                .name("GENERATE_SERIES")
                .kind(TABLE)
                .inputTypeStrategy(
                        or(
                                sequence(
                                        logical(LogicalTypeFamily.NUMERIC),
                                        logical(LogicalTypeFamily.NUMERIC)),
                                sequence(
                                        logical(LogicalTypeFamily.NUMERIC),
                                        logical(LogicalTypeFamily.NUMERIC),
                                        logical(LogicalTypeFamily.NUMERIC))))
                .outputTypeStrategy(explicit(DataTypes.BIGINT()))
                .runtimeClass(
                        "org.apache.flink.table.runtime.functions.table.GenerateSeriesFunction")
                .build(); {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)