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

How to add new column when using MergeAsync? #109

Open
flambert860 opened this issue Dec 17, 2024 · 1 comment
Open

How to add new column when using MergeAsync? #109

flambert860 opened this issue Dec 17, 2024 · 1 comment
Assignees

Comments

@flambert860
Copy link

flambert860 commented Dec 17, 2024

How can I change the schema on a table when using the merge?

schema has columns key, a & b
schema2 has columns key, a, b & c
When executing the insert and after merge I do not have the column c

await table.InsertAsync([recordBatchBuilder.Build()], schema, insertOptions, CancellationToken.None);
await table.MergeAsync(query, [recordBatchBuilder2.Build()], schema2, CancellationToken.None);

But I have noticed that if I do the following it works:

await table.InsertAsync([recordBatchBuilder.Build()], schema, insertOptions, CancellationToken.None);
await table.InsertAsync([emptyRecordBatchBuilder.Build()], schema2, insertOptions, CancellationToken.None);
await table.MergeAsync(query, [recordBatchBuilder2.Build()], schema2, CancellationToken.None);
@flambert860 flambert860 changed the title How to add new column when writing batch? Schema evolution How to add new column when using MergeAsync? Dec 29, 2024
@mightyshazam
Copy link
Collaborator

mightyshazam commented Jan 4, 2025

@flambert860 Is your merge query performing an insert with the new columns or an update? Merging also depends on datafusion, so it may just ignore the extra columns when creating the insert statement.

@mightyshazam mightyshazam self-assigned this Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants