Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Returned number of rows inserted is incorrect #1706

Closed
scsmithr opened this issue Sep 4, 2023 · 2 comments · Fixed by #1722
Closed

Returned number of rows inserted is incorrect #1706

scsmithr opened this issue Sep 4, 2023 · 2 comments · Fixed by #1722
Assignees
Labels
bug 🐛 Something isn't working

Comments

@scsmithr
Copy link
Member

scsmithr commented Sep 4, 2023

Description

> select count(*) from ctas3;
┌─────────────────┐
│ COUNT(UInt8(1)) │
│ ──              │
│ Int64           │
╞═════════════════╡
│ 1000            │
└─────────────────┘
> insert into ctas3 select * exclude registration_dttm from './testdata/parquet/userdata1.parquet';
Inserted 0 rows
> select count(*) from ctas3;
┌─────────────────┐
│ COUNT(UInt8(1)) │
│ ──              │
│ Int64           │
╞═════════════════╡
│ 2000            │
└─────────────────┘
@scsmithr scsmithr added the bug 🐛 Something isn't working label Sep 4, 2023
@adhish20
Copy link
Contributor

adhish20 commented Sep 5, 2023

delta-rs does not currently support output metrics for create and insert operations. Open issue : delta-io/delta-rs#1152

We are just defaulting to 0 while trying to get the output_rows from ExecutionPlan right now

@scsmithr
Copy link
Member Author

scsmithr commented Sep 5, 2023

This doesn't feel like a delta-rs issue. We're calculating number of rows inserted by reading the metrics from the input source: https://github.com/glaredb/glaredb/blob/863ea8670ccfc80cc88aac3d5a7c1f39b8169652/crates/datasources/src/native/insert.rs#L121-L124

We can see that it works for some sources, and not for others:

> create table t (a int);
Table created
> insert into t select * from generate_series(1, 3);
Inserted 3 rows
> create table ctas2 as select * exclude registration_dttm from './testdata/parquet/userdata1.parquet';
Table created
> insert into ctas2 select * exclude registration_dttm from './testdata/parquet/userdata1.parquet';
Inserted 0 rows

But interestingly this works correctly for temp tables:

> create temp table ctas2 as select * exclude registration_dttm from './testdata/parquet/userdata1.parquet';
Table created
> insert into ctas2 select * exclude registration_dttm from './testdata/parquet/userdata1.parquet';
Inserted 1000 rows

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants