Created
February 4, 2021 11:40
-
-
Save vlcanunal/fbdb722a05d5fa262993e915c4b13c43 to your computer and use it in GitHub Desktop.
Usage of hopping window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create table city_analytics_order_realtime_black_friday | |
with (KAFKA_TOPIC='city_analytics.order_realtime_black_friday',PARTITIONS=1,VALUE_FORMAT='JSON') as | |
select timestamptostring(orderDate, 'yyyy-MM') as orderDate, | |
cityId , | |
SUM(cartCount) as totalCount, | |
SUM(productPrice) as totalPrice | |
from city_analytics_order_realtime_full WINDOW HOPPING (SIZE 2 DAYS, ADVANCE BY 5 DAYS) | |
where timestamptostring(orderDate, 'yyyy-MM-dd') >= '2020–11–07' and | |
timestamptostring(orderDate, 'yyyy-MM-dd') <= '2020–11–30' | |
group by timestamptostring(orderDate, 'yyyy-MM'), cityId | |
EMIT CHANGES; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment