Skip to content

Nullable doesn't work when create memory table #14522

@xudong963

Description

@xudong963

Describe the bug

Nullable doesn't work when create memory table.

To Reproduce

DataFusion CLI v44.0.0
> CREATE or replace TABLE table_with_pk (
          sn INT PRIMARY KEY NOT NULL,
          ts TIMESTAMP WITH TIME ZONE NOT NULL,
          currency VARCHAR(3) NOT NULL,
          amount FLOAT
        ) as VALUES
          (0, '2022-01-01 06:00:00Z'::timestamp, 'EUR', 30.0),
          (1, '2022-01-01 08:00:00Z'::timestamp, 'EUR', 50.0),
          (2, '2022-01-01 11:30:00Z'::timestamp, 'TRY', 75.0),
          (3, '2022-01-02 12:00:00Z'::timestamp, 'EUR', 200.0);
0 row(s) fetched.
Elapsed 0.032 seconds.

> show columns FROM table_with_pk;
+---------------+--------------+---------------+-------------+---------------------------------------+-------------+
| table_catalog | table_schema | table_name    | column_name | data_type                             | is_nullable |
+---------------+--------------+---------------+-------------+---------------------------------------+-------------+
| datafusion    | public       | table_with_pk | sn          | Int32                                 | YES         |
| datafusion    | public       | table_with_pk | ts          | Timestamp(Nanosecond, Some("+00:00")) | YES         |
| datafusion    | public       | table_with_pk | currency    | Utf8                                  | YES         |
| datafusion    | public       | table_with_pk | amount      | Float32                               | YES         |
+---------------+--------------+---------------+-------------+---------------------------------------+-------------+
4 row(s) fetched.
Elapsed 0.015 seconds.

Expected behavior

+---------------+--------------+---------------+-------------+---------------------------------------+-------------+
| table_catalog | table_schema | table_name    | column_name | data_type                             | is_nullable |
+---------------+--------------+---------------+-------------+---------------------------------------+-------------+
| datafusion    | public       | table_with_pk | sn          | Int32                                 | NO          |
| datafusion    | public       | table_with_pk | ts          | Timestamp(Nanosecond, Some("+00:00")) | NO          |
| datafusion    | public       | table_with_pk | currency    | Utf8                                  | NO          |
| datafusion    | public       | table_with_pk | amount      | Float32                               | YES         |
+---------------+--------------+---------------+-------------+---------------------------------------+-------------+

Additional context

No response

Metadata

Metadata

Assignees

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