Pablo Estrada created CALCITE-3472:
--------------------------------------
Summary: SESSION_END returns same value as SESSION_START
Key: CALCITE-3472
URL: https://issues.apache.org/jira/browse/CALCITE-3472
Project: Calcite
Issue Type: Improvement
Components: stream
Reporter: Pablo Estrada
We've found that the session_end function seems to be returning the same values
as session_start. Furthermore, it seems that they may have the same
implementation, though I'm not fully familiar with the code:
[https://github.com/apache/calcite/blob/d7946a94adfd2e788f5d324910944dd65dab11ee/core/src/main/java/org/apache/calcite/sql2rel/AuxiliaryConverter.java#L50-L68]
An example with Beam SQL:
0: BeamSQL> SELECT
SESSION_START(scores_stream.event_time, INTERVAL '1' SECOND),
SESSION_END(scores_stream.event_time, INTERVAL '1' SECOND),
scores_stream.team,
SUM(scores_stream.score),
COUNT(*)
FROM
scores_stream
GROUP BY scores_stream.team,
SESSION(scores_stream.event_time, INTERVAL '1' SECOND) LIMIT 3;SELECT
. . . . . > SESSION_START(scores_stream.event_time, INTERVAL '1' SECOND),
. . . . . > SESSION_END(scores_stream.event_time, INTERVAL '1' SECOND),
. . . . . > scores_stream.team,
. . . . . > SUM(scores_stream.score),
. . . . . > COUNT(*)
. . . . . > FROM
. . . . . > scores_stream
. . . . . > GROUP BY scores_stream.team,
. . . . . >
T 3; SESSION(scores_stream.event_time, INTERVAL '1' SECOND) LIMI
+--------+--------+------+------------+---------------------+
| EXPR$0 | EXPR$1 | team | EXPR$3 | EXPR$4 |
+--------+--------+------+------------+---------------------+
| 2019-11-04 04:11:38 | 2019-11-04 04:11:38 | blue | 420 | 7 |
| 2019-11-04 04:11:38 | 2019-11-04 04:11:38 | red | 960 | 18 |
| 2019-11-04 04:11:42 | 2019-11-04 04:11:42 | blue | 452 | 11 |
+--------+--------+------+------------+---------------------+
3 rows selected (9.197 seconds)
0: BeamSQL>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)