Describe the bug
A projection whose declared output type is FLOAT aborts the job when the expression
contains a FLOAT constant. The native engine evaluates the expression in double
precision and returns a Float64 column, but the plan declares FLOAT, so Flink reads
it with getFloat() against a vector backed by a Double array.
To Reproduce
CREATE TABLE t (f4 FLOAT, i INT) WITH (
'connector' = 'datagen',
'number-of-rows' = '2',
'fields.f4.min' = '1.0',
'fields.f4.max' = '2.0',
'fields.i.min' = '3',
'fields.i.max' = '4'
);
SELECT f4 * CAST(2 AS FLOAT) FROM t;
SELECT f4 + CAST(1 AS FLOAT) FROM t;
SELECT CAST(i AS FLOAT) * CAST(1.5 AS FLOAT) FROM t
Expected behavior
The projection returns a FLOAT column matching Flink's result, evaluated in single precision as the host does.
Additional context
RexExpression encodes FLOAT, REAL and DOUBLE literals identically as double
literals, so DataFusion promotes the expression to Float64. Narrow integer
literals already carry their declared width to avoid the analogous problem
(int * 2 stays int32 and wraps); single-precision literals were not covered.
ArrowConversion.createColumnVector receives the declared LogicalType but
dispatches on the Arrow vector class, so a mismatch between the native result and
the declared output surfaces as a ClassCastException deep inside Flink instead
of a clear error at the boundary.
Describe the bug
A projection whose declared output type is FLOAT aborts the job when the expression
contains a FLOAT constant. The native engine evaluates the expression in double
precision and returns a
Float64column, but the plan declares FLOAT, so Flink readsit with
getFloat()against a vector backed by a Double array.To Reproduce
Expected behavior
The projection returns a FLOAT column matching Flink's result, evaluated in single precision as the host does.
Additional context
RexExpression encodes FLOAT, REAL and DOUBLE literals identically as double
literals, so DataFusion promotes the expression to Float64. Narrow integer
literals already carry their declared width to avoid the analogous problem
(int * 2 stays int32 and wraps); single-precision literals were not covered.
ArrowConversion.createColumnVector receives the declared LogicalType but
dispatches on the Arrow vector class, so a mismatch between the native result and
the declared output surfaces as a ClassCastException deep inside Flink instead
of a clear error at the boundary.