Skip to content

[FEATURE] Support GroupBy Window (time span) in Calcite #3354

@LantaoJin

Description

@LantaoJin

Is your feature request related to a problem?
The PPL

source=bank | stats avg(balance) by span(birthdate, 1 day)

Doesn't work as expected because Calcite doesn't support group by window, but it support Tumble table function. see https://github.com/apache/calcite/blob/main/core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java

  @Test void testTumble() {
    final String sql = "select STREAM\n"
        + "  TUMBLE_START(rowtime, INTERVAL '1' MINUTE) AS s,\n"
        + "  TUMBLE_END(rowtime, INTERVAL '1' MINUTE) AS e\n"
        + "from Shipments\n"
        + "GROUP BY TUMBLE(rowtime, INTERVAL '1' MINUTE)";
    sql(sql).ok();
  }

  @Test void testTableFunctionTumble() {
    final String sql = "select *\n"
        + "from table(tumble(table Shipments, descriptor(rowtime), INTERVAL '1' MINUTE))";
    sql(sql).ok();
  }

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Not Started

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions