Skip to content

Dolt reports an internal row-index bug for invalid NTILE(column). #11425

Description

@Yibo-Dong

What happened

NTILE(N) should validate its argument and reject an invalid row-dependent
column argument with a normal SQL error. Dolt reaches an internal row-index
failure.

Environment

Dolt main at commit a995f245c032bc412aed308194d81ee12bc74f6b0a1fae5fd40e0d
(dolt version 2.2.3).

How to reproduce

CREATE TABLE t(id INT PRIMARY KEY, n INT);
INSERT INTO t VALUES (1,0),(2,2);

SELECT id, NTILE(n) OVER (ORDER BY id) AS bucket
FROM t
ORDER BY id;

Expected result

MySQL rejects the query with a regular SQL error because NTILE(N) does not
accept an input column as N.

Actual result

Dolt reports:

unable to find field with index 2 in row of 0 columns.
This is a bug. Please file an issue here: https://github.com/dolthub/dolt/issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcorrectnessWe don't return the same result as MySQLcustomer issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions