amaliujia commented on a change in pull request #1981:
URL: https://github.com/apache/calcite/pull/1981#discussion_r455212526



##########
File path: core/src/test/resources/sql/stream.iq
##########
@@ -64,6 +78,25 @@ SELECT * FROM TABLE(HOP(TABLE ORDERS, DESCRIPTOR(ROWTIME), 
INTERVAL '5' MINUTE,
 
 !ok
 
+SELECT * FROM TABLE(HOP(TABLE ORDERS, DESCRIPTOR(ROWTIME), INTERVAL '5' 
MINUTE, INTERVAL '10' MINUTE, INTERVAL '2' MINUTE));
++---------------------+----+---------+-------+---------------------+---------------------+
+| ROWTIME             | ID | PRODUCT | UNITS | window_start        | 
window_end          |
++---------------------+----+---------+-------+---------------------+---------------------+
+| 2015-02-15 10:15:00 |  1 | paint   |    10 | 2015-02-15 10:07:00 | 
2015-02-15 10:17:00 |
+| 2015-02-15 10:15:00 |  1 | paint   |    10 | 2015-02-15 10:12:00 | 
2015-02-15 10:22:00 |
+| 2015-02-15 10:24:15 |  2 | paper   |     5 | 2015-02-15 10:17:00 | 
2015-02-15 10:27:00 |
+| 2015-02-15 10:24:15 |  2 | paper   |     5 | 2015-02-15 10:22:00 | 
2015-02-15 10:32:00 |
+| 2015-02-15 10:24:45 |  3 | brush   |    12 | 2015-02-15 10:17:00 | 
2015-02-15 10:27:00 |
+| 2015-02-15 10:24:45 |  3 | brush   |    12 | 2015-02-15 10:22:00 | 
2015-02-15 10:32:00 |
+| 2015-02-15 10:58:00 |  4 | paint   |     3 | 2015-02-15 10:52:00 | 
2015-02-15 11:02:00 |
+| 2015-02-15 10:58:00 |  4 | paint   |     3 | 2015-02-15 10:57:00 | 
2015-02-15 11:07:00 |
+| 2015-02-15 11:10:00 |  5 | paint   |     3 | 2015-02-15 11:02:00 | 
2015-02-15 11:12:00 |

Review comment:
       I see. I would prefer to leave that work for another PR because Join 
still has some areas that need a clarification. 
   
   Join windowed streams will need more thoughts. For example, can a TUMBLE 
stream join HOP stream? It might make sense if there is a use case that intends 
to do such join, but such case might be rare. So we could end up with 
validating and rejecting some Join cases. And if we plan to add more 
constraints, then multi-way join will also become a case that need special 
handling because join reordering might lead to an illegal join plan (depends on 
the rules of allowed windowed joins though). 
   
   I feel like it would be better to promote stream to the first class citizen 
in Calcite then in rule matching we should consider different joins: table join 
table, steam join table and stream join stream, and then join involves streams 
might need to consider different optimization factors. e.g. estimated biggest 
window size? number events per second? etc.
   
   Anyway, what I want to say is Join is a big area that can be discussed and 
implemented separately. 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to