prestodb/presto · error · RcFileCorruptionException
Invalid float value
Error message
Invalid float value
What it means
TextEncoding for REAL/FLOAT parses ASCII bytes with Float.parseFloat. Non-numeric bytes raise NumberFormatException, rethrown as RcFileCorruptionException('Invalid float value') since well-formed RCFile text data must contain parseable floats.
Source
Thrown at presto-rcfile/src/main/java/com/facebook/presto/rcfile/text/FloatEncoding.java:103
}
return builder.build();
}
@Override
public void decodeValueInto(int depth, BlockBuilder builder, Slice slice, int offset, int length)
throws RcFileCorruptionException
{
type.writeLong(builder, Float.floatToIntBits(parseFloat(slice, offset, length)));
}
private static float parseFloat(Slice slice, int start, int length)
throws RcFileCorruptionException
{
try {
return Float.parseFloat(slice.toStringAscii(start, length));
}
catch (NumberFormatException e) {
throw new RcFileCorruptionException(e, "Invalid float value");
}
}
}
View on GitHub (pinned to 55bb57d202)
Solutions
- Confirm the declared column type matches what the writer encoded
- Fix separator/encoding configuration so fields are split correctly
- Regenerate or repair the corrupted file from source data
- Catch RcFileCorruptionException and handle the corrupt row/file explicitly
Example fix
// before: value 'abc' in a REAL column // after: write '1.5' or change the column type to varchar
Defensive patterns
Strategy: try-catch
Validate before calling
// verify bytes parse as float before decode
Slice v = ...;
try { Float.parseFloat(v.toStringAscii()); } catch (NumberFormatException e) { /* corrupt field */ } Try / catch
try { float f = floatEncoding.decodeColumn(columnData).getFloat(pos); }
catch (RcFileCorruptionException e) {
if (e.getMessage().contains("Invalid float")) {
handleCorruptField(e);
} else { throw e; }
} Prevention
- Match declared REAL column types with writer-side types
- Validate text field delimiters so numeric fields are not split
- Regenerate files whose source data was hand-modified
- Sample-read new files to catch schema drift before large queries
When it happens
Trigger: decodeColumn/decodeValueInto on a text-encoded REAL column encountering bytes outside float literal syntax — misparsed fields, wrong separators, or binary garbage in the column.
Common situations: Column type mismatch between Presto schema and file contents; misconfigured regex/serde separators; files written by other tools with different text formatting; corrupted data.
Related errors
- Invalid double value
- GENERIC_INTERNAL_ERROR
- escape not implemented
- Value (%sb) is not a valid single-precision float
- HIVE_WRITER_CLOSE_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/be1481349a79b1a2.
Report an issue: GitHub.