Skip to content

Native generated scalar expressions: support fixed-length BINARY boundaries #235

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: P3. This is a verified native support gap; the successful probes return equal results through explicit Flink fallback.

PR #220 admits byte-array scalar overloads, but fixed-length BINARY arguments/results still hit generated-expression boundary gates. This is more specific than the completed BYTES predicate/selection work; retain #218 and #223 as related context.

Runtime probe

Input type:

ROW<`f0` BOOLEAN, `f1` ARRAY<INT>, `f2` ARRAY<INT>, `f3` MAP<STRING, INT>, `f4` BINARY(2), `f5` BINARY(2)> NOT NULL

Input: [+I[true, [1, null, 3], [4, 5], {a=1, b=2}, [1, 2], [3, 4]]]

SELECT ELT(1,f4,f5) FROM src;

Flink result: [[0102]]; resolved type: [BINARY(2)]. Native substitutions: 0.

Calc: unsupported generated-expression argument type BINARY(2)

Runtime probe

Input type:

ROW<`f0` STRING> NOT NULL

Input: [+I[123]]

SELECT TRY_CAST(f0 AS BINARY(4)) FROM src;

Flink result: [[31323300]]; resolved type: [BINARY(4)]. Native substitutions: 0.

Calc: unsupported TRY_CAST VARCHAR→BINARY

ELT over runtime BINARY(2) arguments rejects unsupported generated-expression argument type BINARY(2). The older ELT fixture in #223 instead reaches the fixed BINARY(1) result gate. STRING-to-BINARY TRY_CAST also remains unsupported. Cover declared fixed widths, zero-padding/truncation, embedded zero/high bytes, NULLs and typed literals without treating binary operands as text.

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