{"record":{"id":"7e1c3eb0a93825b8","repo":"apache/flink","slug":"a-predicate-on-a-long-column-requires-an-integer-l","errorCode":null,"errorMessage":"A predicate on a LONG column requires an integer literal, i.e., Byte, Short, Integer, or Long.","messagePattern":"A predicate on a LONG column requires an integer literal, i\\.e\\., Byte, Short, Integer, or Long\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-orc/src/main/java/org/apache/flink/orc/OrcFilters.java","lineNumber":425,"sourceCode":"        ColumnPredicate(String columnName, PredicateLeaf.Type literalType) {\n            this.columnName = columnName;\n            this.literalType = literalType;\n        }\n\n        Object castLiteral(Serializable literal) {\n\n            switch (literalType) {\n                case LONG:\n                    if (literal instanceof Byte) {\n                        return new Long((Byte) literal);\n                    } else if (literal instanceof Short) {\n                        return new Long((Short) literal);\n                    } else if (literal instanceof Integer) {\n                        return new Long((Integer) literal);\n                    } else if (literal instanceof Long) {\n                        return literal;\n                    } else {\n                        throw new IllegalArgumentException(\n                                \"A predicate on a LONG column requires an integer \"\n                                        + \"literal, i.e., Byte, Short, Integer, or Long.\");\n                    }\n                case FLOAT:\n                    if (literal instanceof Float) {\n                        return new Double((Float) literal);\n                    } else if (literal instanceof Double) {\n                        return literal;\n                    } else if (literal instanceof BigDecimal) {\n                        return ((BigDecimal) literal).doubleValue();\n                    } else {\n                        throw new IllegalArgumentException(\n                                \"A predicate on a FLOAT column requires a floating \"\n                                        + \"literal, i.e., Float or Double.\");\n                    }\n                case STRING:\n                    if (literal instanceof String) {\n                        return literal;","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-orc/src/main/java/org/apache/flink/orc/OrcFilters.java#L407-L443","documentation":"While converting a pushed-down predicate literal for an ORC LONG-typed column, the Java literal must be Byte, Short, Integer, or Long so it can be widened to org.apache.hadoop.hive.ql.io.sarg.SearchArgument's Long. Any other type (e.g. a floating-point or string literal compared to a BIGINT column, or a BigDecimal) throws IllegalArgumentException.","triggerScenarios":"An ORC predicate like col_bigint = 3.5 or col_bigint = '123' where the column type maps to PredicateLeaf.Type.LONG but the ValueLiteralExpression's Java value is Float/Double/BigDecimal/String — toOrcType derives LONG from the column, then the literal check fails.","commonSituations":"Comparing a BIGINT/INT column to a decimal literal typed as BigDecimal by the planner; string literals against numeric columns relying on implicit casts that the legacy OrcFilters path does not perform; programmatic filter construction with mismatched types.","solutions":["Make the literal an exact integer type in the query: compare against 42 not 42.0, or CAST the literal to the column type.","When building filters programmatically, wrap the value so it is a Long/Integer/Short/Byte before creating the predicate (e.g. ((Number) v).longValue()).","Use the modern ORC filesystem connector, whose pushdown handles literal casts."],"exampleFix":"// before\nnew OrcFilters.Predicate(\"id\", PredicateLeaf.Type.LONG, 3.5) // wrong literal type\n// after\nnew OrcFilters.Predicate(\"id\", PredicateLeaf.Type.LONG, 3L) // or 4 after rounding","handlingStrategy":"type-guard","validationCode":"// Coerce before building the predicate\nObject lit = (value instanceof Byte || value instanceof Short\n        || value instanceof Integer || value instanceof Long)\n        ? ((Number) value).longValue() : null;\nif (lit == null) throw new IllegalArgumentException(\"LONG column needs integer literal\");","typeGuard":"static boolean isLongPushable(Object v) {\n    return v instanceof Byte || v instanceof Short || v instanceof Integer || v instanceof Long;\n}","tryCatchPattern":null,"preventionTips":["Write integer literals for BIGINT columns (42, not 42.0).","Cast literal types to the column type before constructing ORC predicates."],"tags":["flink","orc","predicate-pushdown","type-mismatch","bigint"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}