0

How can i extract day hour and time from frilk table api

final Table select = transactions
                .window(Tumble.over(lit(1).hour()).on($("transaction_time")).as("log_ts"))
                .groupBy($("transaction_time").year(),$("transaction_time").month(),$("transaction_time").day())
                .select(
                        $("account_id"),
                        $("log_ts").start().as("log_ts"),
                        $("amount").sum().as("amount") );
        return select;

i want to group based on each day . example record

cast(2020-01-01T00:12, TIMESTAMP(3))

the above group by is something what i was trying but its showing the following error

org.apache.flink.table.api.ValidationException: Invalid constant for year-month interval: transaction_time

msd
  • 93
  • 6
  • The available temporal functions are listed here: https://ci.apache.org/projects/flink/flink-docs-stable/dev/table/functions/systemFunctions.html#temporal-functions – David Anderson Sep 08 '20 at 07:47
  • @DavidAnderson i came across that but was not sure how to execute it right way – msd Sep 08 '20 at 08:42
  • The easiest way to figure that out would probably be to use the Flink SQL client, so that you can interactively try things until you find something that works. – David Anderson Sep 08 '20 at 09:38
  • @DavidAnderson hi how to add AUTO_INCREMENT TO a uid – msd Sep 14 '20 at 08:56
  • @DavidAnderson. `tEnv.executeSql("CREATE TABLE spend_report (\n" + " main_id BIGINT ,\n" + " account_id BIGINT,\n" + " log_ts TIMESTAMP(3),\n" + " amount BIGINT\n," + " PRIMARY KEY (main_id) NOT ENFORCED " +` – msd Sep 14 '20 at 08:56

0 Answers0