Skip to content

Native DECIMAL: support FLOOR and CEIL in verified scalar consumers #226

Closed

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.

The exact-numeric work in #208 explicitly excluded DECIMAL FLOOR/CEIL. They still block otherwise executable scalar expressions. Casting their result to STRING provides a successful released-Flink baseline.

Runtime probe

Input type:

ROW<`f0` DECIMAL(20, 3), `f1` INT> NOT NULL

Input: [+I[123.456, 2]]

SELECT CAST(FLOOR(f0) AS STRING) FROM src;

Flink result: [[123]]; resolved type: [STRING]. Native substitutions: 0.

Calc: FLOOR: only float/double operands admitted

Runtime probe

Input type:

ROW<`f0` DECIMAL(20, 3), `f1` INT> NOT NULL

Input: [+I[123.456, 2]]

SELECT CAST(CEIL(f0) AS STRING) FROM src;

Flink result: [[124]]; resolved type: [STRING]. Native substitutions: 0.

Calc: CEIL: only float/double operands admitted

Direct FLOOR/CEIL DECIMAL collection with this fixture throws an AbstractBinaryWriter.writeDecimal assertion on both sides; it is not a native-only failure. Verify the inferred precision and writer contract before widening direct-result admission. Cover positive/negative values, exact integers, NULL and large precisions.

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

  1. added a commit that references this issue on Sep 27, 2026
    503844e
  2. added a commit that references this issue on Oct 10, 2026
    c588961
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