Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-3472

SESSION_END returns same value as SESSION_START

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 1.22.0
    • stream
    • None

    Description

      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>

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              pabloem Pablo Estrada
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: