I'm struggling to use the system built-in functions in flink table api. In particular the ROW_NUMBER() function. I saw some examples but all of them were in Flink SQL and I'm looking for table api syntax. I read that there is no any table api function for ROW_NUMBER so I tried to use Expression.callSql(..) with no success. Thanks for any help!
Asked
Active
Viewed 57 times
1 Answers
1
Like you've already mentioned, there's no Table API function for ROW_NUMBER so the only way you can use them, is by executing SQL directly in your Table API application via something like:
tableEnv.sqlQuery(
String.join(
"\n",
"SELECT id AS order_id",
"order_time",
"ROW_NUMBER() OVER (PARTITION BY id ORDER BY order_time) AS rownum",
"FROM Customers");

Martijn Visser
- 1,468
- 1
- 3
- 9