Search code examples
javascalaapache-flinkflink-streamingflink-sql

Compiler error on Registering a TemporalTableFunction as a Function


I'm following Flink's Defining Temporal Table Function example, and the compiler refuses to take that code:

TemporalTableFunction rates = 
    ratesHistory.createTemporalTableFunction("r_proctime", "r_currency");
tEnv.registerFunction("Rates", rates);  

My compiler tells me "The method registerFunction(String, ScalarFunction) in the type TableEnvironment is not applicable for the arguments (String, TemporalTableFunction)"

I have scoured the source code here and here, and indeed no registerFunction has the TemporalTableFunction signature. Only the ScalarFunction type. I'm baffled as to why it would compile; but they do have a test on it.

I just can't navigate where the TemporalJoinITCase is getting its registerFunction from.

Flink 1.7.1 with scala 2.11, and the following artifacts: flink-core, flink-java, flink-clients_, flink-streaming-java_, flink-table_, flink-streaming-scala_, flink-json, flink-runtime-web_.

I don't know well how Scala works; could it be some trait that I'm missing from another artifact?

Best regard!


Solution

  • Figured it out:

    I needed to import StreamTableEnvironment from a specific package: org.apache.flink.table.api.java.StreamTableEnvironment. My autocompletion was not being properly update in time, which made me think there was no proper method. But it is there.