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

Add table_def_changes function for lua unity exporter #8957

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nadavsteindler
Copy link
Contributor

Closes #8292

Change Description

Create a new method in lua:
delta_exporter.table_def_changes takes a list of all table defs and returns only the ones that have changed. This dovetails well with the delta_exporter.export_delta_log function which accepts a list of tables. This way we are only exporting the tables that have actually changed.

Background

See the reported bug

Bug Fix

If this PR is a bug fix, please let us know about:

  1. Problem - User complained of a race condition in concurrent merge hooks exporting unity table to databricks
  2. Root cause - There is no actual need to merge the same table concurrently. Rather the lua script exports all tables, not just the ones that changed.
  3. Solution - Add a lua helper method to filter the unity tables so that we only export those that changed in the merge

Testing Details

How were the changes tested?

@nadavsteindler nadavsteindler added the include-changelog PR description should be included in next release changelog label Apr 10, 2025
@nadavsteindler nadavsteindler self-assigned this Apr 10, 2025
@nadavsteindler nadavsteindler marked this pull request as draft April 10, 2025 11:28
@@ -201,6 +207,35 @@ local function export_delta_log(action, table_def_names, write_object, delta_cli
return response
end

local function table_def_changes(table_def_names,table_descriptors_path,repository_id, source_ref, branch_id)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docs

error("table path is required to proceed with Delta catalog export")
end

--if table_path is in the diff
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write the actual if expression

@@ -34,6 +34,18 @@ local function delta_log_entry_key_generator()
end
end


-- Local function to get the table descriptor
local function get_table_descriptor(repo, commit_id,table_name_yaml, table_descriptors_path)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commit_id should instead be called ref since it can also be a branch name

Copy link

E2E Test Results - DynamoDB Local - Local Block Adapter

13 passed, 1 skipped

Copy link

E2E Test Results - Quickstart

12 passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
include-changelog PR description should be included in next release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure unity export - "table already exists"
1 participant