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

  1. Confirm the declared column type matches what the writer encoded
  2. Fix separator/encoding configuration so fields are split correctly
  3. Regenerate or repair the corrupted file from source data
  4. 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

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


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/be1481349a79b1a2. Report an issue: GitHub.