Skip to content

Native GROUP BY: extend extrema and value aggregates to DATE/TIME/BOOLEAN #230

Description

@liuyongvs

Verified on PR #220 after rebasing onto merged #222: commit 16ebb1e5a45cc5420abf90473b785d6c0b908a82, released Apache Flink 2.2.1, JDK 17, default compatibility settings. Each probe uses independent stock-Flink and native-enabled environments with bounded runtime DataStream input. Successful comparisons check output values and resolved result types before classifying execution.

Suggested priority: P2. This is a verified native support gap; the successful probes return equal results through explicit Flink fallback.

Successful released-Flink probes still fall back for MIN/MAX over DATE, TIME and BOOLEAN, and FIRST_VALUE/LAST_VALUE/SINGLE_VALUE over TIME and BOOLEAN. STRING and TIMESTAMP/LTZ controls should retain their existing coverage.

Runtime probe

Input type:

ROW<`f0` INT, `f1` TINYINT, `f2` SMALLINT, `f3` BIGINT, `f4` DECIMAL(20, 2), `f5` STRING, `f6` DATE, `f7` TIME(3), `f8` TIMESTAMP_LTZ(3), `f9` BOOLEAN> NOT NULL

Input: [+I[1, 3, 4, 5, 6.25, text, 2024-02-29, 12:34, 2024-02-29T12:34:56Z, true]]

SELECT f0, MIN(f6) FROM src GROUP BY f0;

Flink result: [[1, 2024-02-29]]; resolved type: [INT, DATE]. Native substitutions: 0.

GROUP BY: MIN/MAX over an unsupported value type

Runtime probe

Input type:

ROW<`f0` INT, `f1` BIGINT, `f2` DECIMAL(20, 2), `f3` STRING, `f4` BOOLEAN, `f5` TIME(3), `f6` BYTES, `f7` TIMESTAMP_LTZ(3)> NOT NULL

Input: [+I[1, 2, 3.25, abc, true, 12:34:56, [1, 2], 2024-02-29T12:34:56Z]]

SELECT SINGLE_VALUE(f4) FROM src;

Flink result: [[true]]; resolved type: [BOOLEAN]. Native substitutions: 0.

GROUP BY: FIRST_VALUE/LAST_VALUE/SINGLE_VALUE over an unsupported value type

Additional verified probes: MAX(DATE), MIN/MAX(TIME), MIN/MAX(BOOLEAN), FIRST_VALUE/LAST_VALUE(BOOLEAN), and FIRST_VALUE/LAST_VALUE/SINGLE_VALUE(TIME). Validate arrival order, all-NULL groups, retractions, FILTER, precision and TTL semantics. BYTES MIN/MAX/SINGLE_VALUE probes were rejected by the released host optimizer and are excluded from this successful support gap.

Acceptance

Preserve released Flink values, resolved types, NULL behavior and relevant error/short-circuit semantics. Add runtime-source SQL regressions that assert the specific native operator as well as result parity; do not use constant folding as proof of native support. Keep safe fallback for unverified forms and update the corresponding operator coverage documentation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions