Suri Veernapu
04/23/2024, 2:35 PMwindow_time after joining the streams but still throws the same error org.apache.flink.table.api.ValidationException: The window function requires the timecol is a time attribute type, but is TIMESTAMP(3) however when i checked the datatype it says TIMESTAMP(3) *ROWTIME*.
Please let me know if i'm missing anything. Thanks in advance.Suri Veernapu
04/23/2024, 2:35 PMcreate view orders_dedup as select order_id, order_status, order_ts from (
select *, ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY order_ts DESC) as rn from orders_kafka
) where rn=1;
create view txns_dedup as select order_id, payment_method_type, gateway, txn_ts from (
select *, ROW_NUMBER() OVER (PARTITION BY order_id ORDER BY txn_ts DESC) as rn from transaction_details_kafka
) where rn=1;
with orders_joined as (SELECT L.order_id as order_id, R.payment_method_type, L.order_status,
L.window_start as join_window_start, L.window_end as join_window_end, L.window_time rowtime
FROM (
SELECT * FROM TABLE(TUMBLE(TABLE orders_dedup, DESCRIPTOR(order_ts), INTERVAL '5' MINUTES))
) L
INNER JOIN (
SELECT * FROM TABLE(TUMBLE(TABLE txns_dedup, DESCRIPTOR(txn_ts), INTERVAL '5' MINUTES))
) R
ON L.order_id = R.order_id AND L.window_start >= R.window_start - INTERVAL '15' MINUTES AND L.window_end <= R.window_end + INTERVAL '15' MINUTES
group by L.window_start, L.window_end, L.window_time, L.order_id, R.payment_method_type, L.order_status
)
select join_window_start, join_window_end, payment_method_type,
count(distinct order_id) total_orders
from TABLE(TUMBLE(TABLE orders_joined, DESCRIPTOR(rowtime), INTERVAL '5' MINUTES))
group by join_window_start, join_window_end, payment_method_type;
;Suri Veernapu
04/23/2024, 2:35 PMshikai ng
04/24/2024, 6:13 AMSuri Veernapu
04/24/2024, 6:21 AMSuri Veernapu
04/24/2024, 6:21 AM