prestodb/presto · error · RcFileCorruptionException

Invalid double value

Error message

Invalid double value

What it means

TextEncoding for DOUBLE parses ASCII text from the RCFile column using Double.parseDouble. If the bytes are not a valid double literal, the NumberFormatException is rethrown as RcFileCorruptionException('Invalid double value'), because a valid RCFile written by Hive should only contain parseable doubles.

Source

Thrown at presto-rcfile/src/main/java/com/facebook/presto/rcfile/text/DoubleEncoding.java:103

        }
        return builder.build();
    }

    @Override
    public void decodeValueInto(int depth, BlockBuilder builder, Slice slice, int offset, int length)
            throws RcFileCorruptionException
    {
        type.writeDouble(builder, parseDouble(slice, offset, length));
    }

    private static double parseDouble(Slice slice, int start, int length)
            throws RcFileCorruptionException
    {
        try {
            return Double.parseDouble(slice.toStringAscii(start, length));
        }
        catch (NumberFormatException e) {
            throw new RcFileCorruptionException(e, "Invalid double value");
        }
    }
}

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify the table schema matches the actual data written in the file
  2. Check the RCFile text encoding/separator configuration matches the writer
  3. Inspect the offending bytes and fix or regenerate the source file
  4. Catch RcFileCorruptionException per column and treat the value/file as corrupt (skip row or fail query with a clear message)

Example fix

// before: schema says double but file has text like '1,23'
// after: fix data to '1.23' or change column type to varchar
Defensive patterns

Strategy: try-catch

Validate before calling

// verify bytes parse as double before decode path is exercised
Slice v = ...;
try { Double.parseDouble(v.toStringAscii()); } catch (NumberFormatException e) { /* corrupt field */ }

Try / catch

try { double d = doubleEncoding.decodeColumn(columnData).getDouble(pos); }
catch (RcFileCorruptionException e) {
    if (e.getMessage().contains("Invalid double")) {
        handleCorruptField(e); // skip row, null value, or fail with path info
    } else { throw e; }
}

Prevention

When it happens

Trigger: decodeColumn/decodeValueInto reading a text-encoded DOUBLE column whose bytes (from start, length) are non-numeric — garbage bytes, misaligned field boundaries, or wrong column type mapping.

Common situations: Schema drift: column declared DOUBLE in Presto but written as another type/text; wrong field/separator configuration; corrupted or hand-edited text files; charset/binary data landing in a double column.

Related errors


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