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

Delta Lake broken when partition column order does not match table column order #13505

Closed
dain opened this issue Aug 5, 2022 · 0 comments · Fixed by #13509
Closed

Delta Lake broken when partition column order does not match table column order #13505

dain opened this issue Aug 5, 2022 · 0 comments · Fixed by #13509
Assignees
Labels
bug Something isn't working correctness

Comments

@dain
Copy link
Member

dain commented Aug 5, 2022

DROP TABLE IF EXISTS test_delta; 

CREATE TABLE test_delta (
   id integer,
   first varchar,
   second varchar
)
WITH (
   type = 'DELTA',
   partitioned_by = ARRAY['second', 'first'] -- NOTE: different than table column order
);

INSERT INTO test_delta (first, id, second)
VALUES ('A', 1, 'B');

-- also broken when inserting with default column order
INSERT INTO test_delta 
VALUES (2, 'X', 'Y');

select * from test_delta;

Here is the output. Notice first and second are swapped:

id first second
1 B A
2 Y X

Some example test queries

-- test cases
SELECT if (first <> 'A', fail('delta partitioning is broken')) FROM test_delta WHERE id = 1;
SELECT if (first <> 'X', fail('delta partitioning is broken')) FROM test_delta WHERE id = 2;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness
Development

Successfully merging a pull request may close this issue.

3 participants