apache/flink · error · IllegalArgumentException

A predicate on a STRING column requires a floating literal,

Error message

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

What it means

Thrown when a predicate on an ORC STRING-typed column receives a literal that is not a java String. Note the message text itself is wrong — it is a copy-paste of the FLOAT branch saying 'requires a floating literal, i.e., Float or Double' — but the actual requirement in code is 'literal instanceof String'; trust the condition, not the message.

Source

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

                                        + "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.");
                    }
                case DATE:
                    if (literal instanceof Date) {
                        return literal;
                    } else {
                        throw new IllegalArgumentException(
                                "A predicate on a DATE column requires a java.sql.Date literal.");
                    }
                case TIMESTAMP:

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Ensure the literal for a string column is a java.lang.String (String.valueOf(...) where needed).
  2. Be aware the message is incorrect — interpret it as 'STRING column requires a String literal'.
  3. Prefer the modern ORC filesystem connector for new code; its pushdown conversion is correct.

Example fix

// before
new OrcFilters.Predicate("name", PredicateLeaf.Type.STRING, 42)
// after
new OrcFilters.Predicate("name", PredicateLeaf.Type.STRING, "42")
Defensive patterns

Strategy: type-guard

Validate before calling

Object lit = (value instanceof String) ? value : String.valueOf(value);

Type guard

static boolean isStringPushable(Object v) { return v instanceof String; }

Prevention

When it happens

Trigger: An ORC predicate on a VARCHAR/CHAR/STRING column where the ValueLiteralExpression's Java value is not a String (e.g. an Integer or byte[] passed programmatically through OrcFilters).

Common situations: Programmatic OrcTableSource filter construction passing boxed numbers or byte arrays for string columns; hitting the misleading message and debugging in the wrong direction.

Related errors


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