apache/flink · error · IllegalArgumentException

A predicate on a FLOAT column requires a floating literal, i

Error message

A predicate on a FLOAT column requires a floating literal, i.e., Float or Double.

What it means

For an ORC FLOAT-typed column (FLOAT/DOUBLE in the schema), the pushed-down literal must be Float, Double, or BigDecimal (BigDecimal is converted via doubleValue()). Any other Java type — String, integer box types like Integer/Long — triggers IllegalArgumentException because SearchArgument needs a Double.

Source

Thrown at flink-formats/flink-orc/src/main/java/org/apache/flink/orc/OrcFilters.java:437

                        return new Long((Short) literal);
                    } else if (literal instanceof Integer) {
                        return new Long((Integer) literal);
                    } else if (literal instanceof Long) {
                        return literal;
                    } else {
                        throw new IllegalArgumentException(
                                "A predicate on a LONG column requires an integer "
                                        + "literal, i.e., Byte, Short, Integer, or Long.");
                    }
                case FLOAT:
                    if (literal instanceof Float) {
                        return new Double((Float) literal);
                    } else if (literal instanceof Double) {
                        return literal;
                    } else if (literal instanceof BigDecimal) {
                        return ((BigDecimal) literal).doubleValue();
                    } else {
                        throw new IllegalArgumentException(
                                "A predicate on a FLOAT column requires a floating "
                                        + "literal, i.e., Float or Double.");
                    }
                case STRING:
                    if (literal instanceof String) {
                        return literal;
                    } else {
                        throw new IllegalArgumentException(
                                "A predicate on a STRING column requires a floating "
                                        + "literal, i.e., Float or Double.");
                    }
                case BOOLEAN:
                    if (literal instanceof Boolean) {
                        return literal;
                    } else {
                        throw new IllegalArgumentException(
                                "A predicate on a BOOLEAN column requires a Boolean literal.");
                    }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Convert the literal to Double/Float/BigDecimal before building the predicate.
  2. Write the SQL literal unquoted (9.99 not '9.99') so the planner types it as DECIMAL/DOUBLE.
  3. Route to the modern ORC connector pushdown if you cannot control literal typing.

Example fix

// before
Double d = Double.valueOf((String) value);
// ensure predicate literal is Double, not String:
predicate = new OrcFilters.Predicate("price", PredicateLeaf.Type.FLOAT, "9.99");
// after
predicate = new OrcFilters.Predicate("price", PredicateLeaf.Type.FLOAT, Double.parseDouble("9.99"));
Defensive patterns

Strategy: type-guard

Validate before calling

Object lit;
if (value instanceof Float || value instanceof Double || value instanceof BigDecimal) {
    lit = (value instanceof BigDecimal) ? ((BigDecimal) value).doubleValue() : value;
} else if (value instanceof Number) {
    lit = ((Number) value).doubleValue();
} else {
    throw new IllegalArgumentException("FLOAT column needs a numeric literal");
}

Type guard

static boolean isFloatPushable(Object v) {
    return v instanceof Float || v instanceof Double || v instanceof BigDecimal;
}

Prevention

When it happens

Trigger: A predicate on a FLOAT/DOUBLE ORC column where the literal deserializes as String (e.g. from a string-typed filter parameter) or where an integral literal is not widened; e.g. where price = '9.99' with price DOUBLE.

Common situations: Passing filter values as strings from configuration/REST parameters into a legacy OrcTableSource; queries comparing doubles to quoted literals; programmatic predicate building with Integer values for double columns.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/0b89ce605fe186be. Report an issue: GitHub.