### Description

A query like `any where true | head 2147483648` fails with `class java.lang.Long cannot be cast to class java.lang.Integer (java.lang.Long and java.lang.Integer are in module java.base of loader 'bootstrap')`.

While one like `any where true | head 2147483640 + 8` fails with `"type": "arithmetic_exception", "reason": "integer overflow"`.
x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/parser/LogicalPlanBuilder.java
}
        
        if (ctx.until != null) {
            until = queries.remove(queries.size() - 1);
        } else {
            until = defaultUntil(source);
        }
        if (maxSpan.duration() < 0 && queries.stream().anyMatch(x -> x.isMissingEventFilter())) {
            throw new ParsingException(source, "[maxspan] is required for sequences with missing events queries; found none");
        }
        if (queries.stream().allMatch(KeyedFilter::isMissingEventFilter)) {
            throw new ParsingException(source, "A sequence requires at least one positive event query; found none");
        }
        return new Sequence(source, queries, until, maxSpan, fieldTimestamp(), fieldTiebreaker(), resultPosition());
    }
    private KeyedFilter visitSequenceTerm(SequenceTermContext ctx, List<Attribute> joinKeys) {
        return keyedFilter(
            joinKeys,
            ctx,
            ctx.by,
            ctx.subquery(),
            fieldTimestamp(),
            fieldTiebreaker(),
            ctx.subquery().MISSING_EVENT_OPEN() != null
        );
    }
    @Override
    public TimeValue visitSequenceParams(SequenceParamsContext ctx) {
        if (ctx == null) {
            return TimeValue.MINUS_ONE;