prestodb/presto · error · ParsingException

Invalid numeric literal:

Error message

Invalid numeric literal: 

What it means

Validation in the LongLiteral constructor: the literal text cannot be parsed by Long.parseLong, so the token is not a representable 64-bit integer. Fires when a query contains an out-of-range or malformed integer literal (e.g. exceeding Long.MAX_VALUE); larger values should be written as DECIMAL or DOUBLE literals.

Source

Thrown at presto-parser/src/main/java/com/facebook/presto/sql/tree/LongLiteral.java:45

    public LongLiteral(String value)
    {
        this(Optional.empty(), value);
    }

    public LongLiteral(NodeLocation location, String value)
    {
        this(Optional.of(location), value);
    }

    private LongLiteral(Optional<NodeLocation> location, String value)
    {
        super(location);
        requireNonNull(value, "value is null");
        try {
            this.value = Long.parseLong(value);
        }
        catch (NumberFormatException e) {
            throw new ParsingException("Invalid numeric literal: " + value);
        }
    }

    public long getValue()
    {
        return value;
    }

    @Override
    public <R, C> R accept(AstVisitor<R, C> visitor, C context)
    {
        return visitor.visitLongLiteral(this, context);
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Reduce the literal so it fits in a signed 64-bit integer (max 9223372036854775807)
  2. Express large numbers as a DECIMAL literal (append BD suffix style) or DOUBLE literal instead
  3. Fix typos such as stray characters in the numeric literal
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-parser/src/main/java/com/facebook/presto/sql/tree/LongLiteral.java:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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