Skip to content

Error when use user field in where clause #14141

Closed
@haohuaijin

Description

@haohuaijin

Describe the bug

DataFusion CLI v44.0.0
> create table t(a int, b int, user text) as values (1,2,'test'), (2,3,null);
0 row(s) fetched.
Elapsed 0.051 seconds.

> select * from t;
+---+---+------+
| a | b | user |
+---+---+------+
| 1 | 2 | test |
| 2 | 3 |      |
+---+---+------+
2 row(s) fetched.
Elapsed 0.006 seconds.

> select * from t where user = 'test';
Error during planning: Invalid function 'user'.
Did you mean 'upper'?

To Reproduce

like above

Expected behavior

this query can run success

Additional context

test in datafusion v44.0.0, v43.0.0 and current main, both reported error
not sure if it is a bug or user is a keyword, but i also check in duckdb, it work

D create table t(a int, b int, user text); insert into t values (1,2,'test'), (2,3,null);
D select * from t where user = 'test';
┌───────┬───────┬─────────┐
│   a   │   b   │  user   │
│ int32 │ int32 │ varchar │
├───────┼───────┼─────────┤
│     1 │     2 │ test    │
└───────┴───────┴─────────┘
D

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions